diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2019-02-23 12:05:07 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-23 12:05:07 +0100 |
commit | e89aaaeaab40088eb57a0209e152e90ce16ed51c (patch) | |
tree | 548ddfccc533ca49b287aac176f9dd333dc52e39 /tests/errmsgs | |
parent | f86835ce77f05133cdb8eeef0a7986a040a61954 (diff) | |
download | Nim-e89aaaeaab40088eb57a0209e152e90ce16ed51c.tar.gz |
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.
Diffstat (limited to 'tests/errmsgs')
-rw-r--r-- | tests/errmsgs/tstaticexprnotype.nim | 5 | ||||
-rw-r--r-- | tests/errmsgs/tstaticexprscope.nim | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/errmsgs/tstaticexprnotype.nim b/tests/errmsgs/tstaticexprnotype.nim new file mode 100644 index 000000000..8b6735ff8 --- /dev/null +++ b/tests/errmsgs/tstaticexprnotype.nim @@ -0,0 +1,5 @@ +discard """ + action: reject +""" + +let x = static: discard diff --git a/tests/errmsgs/tstaticexprscope.nim b/tests/errmsgs/tstaticexprscope.nim new file mode 100644 index 000000000..7af5bf9b3 --- /dev/null +++ b/tests/errmsgs/tstaticexprscope.nim @@ -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 |