diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-04-13 17:06:46 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-13 17:45:58 +0200 |
commit | 47335aab4148b2cd5b28cd3012d6d6e0a0c82db7 (patch) | |
tree | 33c87e807f22b59d61dbe2aa0f42430c0d0399d3 /tests | |
parent | ab426faa226f7041c60e671ad2a3ba79b46ee1c0 (diff) | |
download | Nim-47335aab4148b2cd5b28cd3012d6d6e0a0c82db7.tar.gz |
introduce nkTupleConstr AST node for unary tuple construction; breaking change
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tuples/tanontuples.nim | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/tuples/tanontuples.nim b/tests/tuples/tanontuples.nim index 49803e5ac..f514670d3 100644 --- a/tests/tuples/tanontuples.nim +++ b/tests/tuples/tanontuples.nim @@ -1,7 +1,10 @@ discard """ - output: '''61, 125''' + output: '''61, 125 +(Field0: 0) (Field0: 13)''' """ +import macros + proc `^` (a, b: int): int = result = 1 for i in 1..b: result = result * a @@ -12,3 +15,12 @@ var n = (56, 3) m = (n[0] + m[1], m[1] ^ n[1]) echo m[0], ", ", m[1] + +# also test we can produce unary anon tuples in a macro: +macro mm(): untyped = + result = newTree(nnkTupleConstr, newLit(13)) + +proc nowTuple(): (int,) = + result = (0,) + +echo nowTuple(), " ", mm() |