diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2019-02-06 21:26:55 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-06 21:26:55 +0100 |
commit | 294b2e03b2def1fe5a14e7116af412dc761c81f9 (patch) | |
tree | 2fe8515ddd33d63a8487d0efe2640ca934202965 /tests | |
parent | 0036014727a90886e47c658e72e0936c2193fdbb (diff) | |
download | Nim-294b2e03b2def1fe5a14e7116af412dc761c81f9.tar.gz |
Reject assignments with nkEmpty RHS (#9000)
Fixes #8997
Diffstat (limited to 'tests')
-rw-r--r-- | tests/macros/t8997.nim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/macros/t8997.nim b/tests/macros/t8997.nim new file mode 100644 index 000000000..af04fb127 --- /dev/null +++ b/tests/macros/t8997.nim @@ -0,0 +1,26 @@ +discard """ + line: 24 + errormsg: "illformed AST: " +""" + +import macros + +type + Node* = ref object + children: seq[Node] + +proc newNode*(): Node = + Node(children: newSeq[Node]()) + +macro build*(body: untyped): untyped = + + template appendElement(tmp, childrenBlock) {.dirty.} = + bind newNode + let tmp = newNode() + tmp.children = childrenBlock # this line seems to be the problem + + let tmp = genSym(nskLet, "tmp") + let childrenBlock = newEmptyNode() + result = getAst(appendElement(tmp, childrenBlock)) + +build(body) |