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

Regression in 0.20.0: Nested proc using outer scope variable fails to compile #11523

Closed
khogeland opened this issue Jun 17, 2019 · 3 comments

Comments

@khogeland
Copy link

commented Jun 17, 2019

This code no longer compiles:

proc foo(): proc =
  let a = 0
  return proc(): (int, int) =
    #return (0, 0) #works
    #return (a) #works
    #result = (a, 0) #works
    return (a, 0)
discard foo()

0.20.0:

$ choosenim 0.20.0 && nim c -f bug.nim
      Info: Version 0.20.0 already selected
Hint: used config file '/Users/kevin/.choosenim/toolchains/nim-0.20.0/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: bug [Processing]
/Users/travis/build/nim-lang/nightlies/nim/e7471cebae2a404f3e4239f199f5a0c422484aac/lib/system/fatal.nim(39) sysFatal
Error: unhandled exception: /Users/travis/build/nim-lang/nightlies/nim/e7471cebae2a404f3e4239f199f5a0c422484aac/compiler/lambdalifting.nim(721, 18) `n[0].kind == nkEmpty`  [AssertionError]

0.19.6:

$ choosenim 0.19.6 && nim c -f bug.nim
   Switched to Nim 0.19.6
Hint: used config file '/Users/kevin/.choosenim/toolchains/nim-0.19.6/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: bug [Processing]
CC: nasty_bug
CC: stdlib_system
Hint:  [Link]
Hint: operation successful (12404 lines compiled; 0.453 sec total; 16.383MiB peakmem; Debug Build) [SuccessX]

@Araq Araq added the Regression label Jun 17, 2019

@narimiran

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

git bisect shows 045e026 as a commit which introduced the regression.

@Araq Araq closed this in 135fdde Jun 26, 2019

narimiran added a commit that referenced this issue Jul 2, 2019

fixes #11523
(cherry picked from commit 135fdde)
@petabyteboy

This comment has been minimized.

Copy link

commented Jul 13, 2019

Will this be backported for 0.20 or when can I expect a release with the fix?

@narimiran

This comment has been minimized.

Copy link
Member

commented Jul 13, 2019

Yes, the fix for this will be part of v0.20.2, which should be out this month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.