Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line comment in last line of a function #2410

Closed
benjiqq opened this issue Aug 8, 2021 · 2 comments · Fixed by #2412
Closed

line comment in last line of a function #2410

benjiqq opened this issue Aug 8, 2021 · 2 comments · Fixed by #2412
Labels
bug Bug that shouldn't change language semantics when fixed.

Comments

@benjiqq
Copy link
Contributor

benjiqq commented Aug 8, 2021

Version Information

  • vyper Version (output of vyper --version):0.2.14+commit.db2606d
  • OS: osx
  • Python Version (output of python --version): 3.9.6

What's your issue about?

if last line in a function is a comment I get this

x: public(uint256)

@external
def foo(ix: uint256):
    bar: uint256 = self.x
    #?? throws >> ValueError: start (7,7) precedes previous end (8,0)

How can it be fixed?

no idea

@fubuloubu fubuloubu added the bug Bug that shouldn't change language semantics when fixed. label Aug 8, 2021
@charles-cooper
Copy link
Member

Appears #1161 has come back to life

@charles-cooper
Copy link
Member

charles-cooper commented Aug 9, 2021

I figured out why I was not getting an error in the previous issue. My text editor inserts a newline at the ends of files, and when the newline is there there is no issue. Here's a minimal example:

(vyper) charles@cmc-thinkpad ~/vyper $ xxd repros/2410.vy 
00000000: 2320 6661 696c                           # fail
(vyper) charles@cmc-thinkpad ~/vyper $ vyper -f ir repros/2410.vy 
ValueError: start (1,6) precedes previous end (2,0)

(vyper) charles@cmc-thinkpad ~/vyper $ vim repros/2410.vy # add newline
(vyper) charles@cmc-thinkpad ~/vyper $ xxd repros/2410.vy 
00000000: 2320 7375 6363 6573 730a                 # success.
(vyper) charles@cmc-thinkpad ~/vyper $ vyper -f ir repros/2410.vy 
seq

However, this should have been fixed in #1720 ... not sure why this is cropping up again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that shouldn't change language semantics when fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants