Open a new scope for static: expr blocks (#10649)
Bring this in line with how plain blocks are analysed and avoids codegen errors if one references variables defined in such a block.
This commit is contained in:
parent
f86835ce77
commit
e89aaaeaab
3 changed files with 21 additions and 1 deletions
11
tests/errmsgs/tstaticexprscope.nim
Normal file
11
tests/errmsgs/tstaticexprscope.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
discard """
|
||||
errmsg: "undeclared identifier: 'z'"
|
||||
line: 11
|
||||
"""
|
||||
|
||||
# Open a new scope for static expr blocks
|
||||
block:
|
||||
let a = static:
|
||||
var z = 123
|
||||
33
|
||||
echo z
|
||||
Loading…
Add table
Add a link
Reference in a new issue