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(1.2=>1.4 onwards): enum with same name in different scope gives wrong RT results #17162

Closed
timotheecour opened this issue Feb 24, 2021 · 1 comment · Fixed by #17710

Comments

@timotheecour
Copy link
Member

timotheecour commented Feb 24, 2021

Example

when true:
  # proc main = # ditto
  template main =
    block:
      type A = enum a0, a1, a2
      for ai in A:
        echo (ai,)
    block:
      type A = enum b0, b1, b2, b3
      for ai in A:
        echo (ai,)

  static: main() # ok
  main() # bug

Current Output

vm:
(a0,)
(a1,)
(a2,)
(b0,)
(b1,)
(b2,)
(b3,)

rt:
(a0,)
(a1,)
(a2,)
(a0,)
(a1,)
(a2,)
(3 (invalid data!),)

Expected Output

rt should be like vm:
(a0,)
(a1,)
(a2,)
(b0,)
(b1,)
(b2,)
(b3,)

Additional Information

  • works 1.2.8
  • fails 1.4.0
  • fails 1.5.1 74a8f23

Note that it works in vm or in js but not in c backend
EDIT: seems very similar to #15526
(and also to #5170 but that was fixed)

@timotheecour
Copy link
Member Author

after git bisect the culprit is 2629d61 #15091 /cc @Clyybber:

git bisect start v1.4.2 v1.2.0
git bisect run zsh -c "source ~/.zshrc && nim=$nim_csources_local_X d_nim_build_simple_local --skipusercfg --hints:off -o:bin/nim.bisect && bin/nim.bisect c -r --skipparentcfg --skipusercfg -d:case4 $timn_D/tests/nim/all/t11895.nim"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant