-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Nim doesn't catch wrong var {.global.} initialization #3505
Comments
This issue has been automatically marked as stale because it has not had recent activity. If you think it is still a valid issue, write a comment below; otherwise it will be closed. Thank you for your contributions. |
this works in current devel 3b973f3, and similar issues are closed, guess it's just reopened by adding a label. |
It doesn't work if the proc gets called proc foo =
let a = 0
var b {.global.} = a # Nim should complain about this
foo()
|
hmm, seems like we need transform the lvalue to global too. |
…20812) * fix #3505 wrong var {.global.} initialization, asign variable to it * fix #5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]>
… to it (nim-lang#20812) * fix nim-lang#3505 wrong var {.global.} initialization, asign variable to it * fix nim-lang#5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]>
…20812) * fix #3505 wrong var {.global.} initialization, asign variable to it * fix #5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 1410243)
…20812) * fix #3505 wrong var {.global.} initialization, asign variable to it * fix #5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 1410243)
…20812) * fix #3505 wrong var {.global.} initialization, asign variable to it * fix #5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 1410243)
…20812) * fix #3505 wrong var {.global.} initialization, asign variable to it * fix #5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 1410243)
…20812) * fix #3505 wrong var {.global.} initialization, asign variable to it * fix #5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 1410243)
… to it (nim-lang#20812) * fix nim-lang#3505 wrong var {.global.} initialization, asign variable to it * fix nim-lang#5132 as well * follow suggestions * handle all call kinds * Update tests/global/t3505.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * Update compiler/semstmts.nim * follow suggestion * Update compiler/semstmts.nim Co-authored-by: Andreas Rumpf <[email protected]>
Test
Result:
The text was updated successfully, but these errors were encountered: