diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-08-23 18:58:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-23 18:58:55 +0200 |
commit | fbb2763204ada801f3935e9cbab80abab9a7e945 (patch) | |
tree | 7ad629fe7e4d39797e25100aea2877fb842f852d /tests/misc/tlocals.nim | |
parent | b07694cd90ab7c6eb4660971ddb818b461d4eed8 (diff) | |
download | Nim-fbb2763204ada801f3935e9cbab80abab9a7e945.tar.gz |
fixes #11958 (#12013)
Diffstat (limited to 'tests/misc/tlocals.nim')
-rw-r--r-- | tests/misc/tlocals.nim | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/misc/tlocals.nim b/tests/misc/tlocals.nim index e6c73313d..ad9e7d032 100644 --- a/tests/misc/tlocals.nim +++ b/tests/misc/tlocals.nim @@ -1,5 +1,7 @@ discard """ - output: '''(x: "string here", a: 1)''' + output: '''(x: "string here", a: 1) +b is 5 +x is 12''' """ proc simple[T](a: T) = @@ -28,3 +30,35 @@ proc test(baz: int, qux: var int): int = var x1 = 456 discard test(123, x1) + +# bug #11958 +proc foo() = + var a = 5 + proc bar() {.nimcall.} = + var b = 5 + for k, v in fieldpairs(locals()): + echo k, " is ", v + + bar() +foo() + + +proc foo2() = + var a = 5 + proc bar2() {.nimcall.} = + for k, v in fieldpairs(locals()): + echo k, " is ", v + + bar2() +foo2() + + +proc foo3[T](y: T) = + var a = 5 + proc bar2[T](x: T) {.nimcall.} = + for k, v in fieldpairs(locals()): + echo k, " is ", v + + bar2(y) + +foo3(12) |