diff options
author | LemonBoy <thatlemon@gmail.com> | 2018-09-17 18:52:40 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2018-09-17 18:52:40 +0200 |
commit | 027cc5013eedce70d5f925e18037e9d1786ebd15 (patch) | |
tree | a86ceaa4944becf2e194eaf26a3266d13226c727 /tests | |
parent | 6dc6ea41468dc99c8826b03b512af8f9a46e660d (diff) | |
download | Nim-027cc5013eedce70d5f925e18037e9d1786ebd15.tar.gz |
Fix error during field access in VM
Tuple constructors can't have nkExprColonExpr but may contain NimNodes of that kind. Fixes #4952
Diffstat (limited to 'tests')
-rw-r--r-- | tests/vm/t4952.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/vm/t4952.nim b/tests/vm/t4952.nim new file mode 100644 index 000000000..fc76fa4df --- /dev/null +++ b/tests/vm/t4952.nim @@ -0,0 +1,17 @@ +import macros + +proc doCheck(tree: NimNode) = + let res: tuple[n: NimNode] = (n: tree) + assert: tree.kind == res.n.kind + for sub in tree: + doCheck(sub) + +macro id(body: untyped): untyped = + doCheck(body) + +id(foo((i: int))) + +static: + let tree = newTree(nnkExprColonExpr) + let t = (n: tree) + assert: t.n.kind == tree.kind |