summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-01-13 15:52:50 +0100
committerAraq <rumpf_a@web.de>2019-01-13 15:52:50 +0100
commitaa7ad8897895acaee9e2999652050d5bc52921a7 (patch)
tree6ef6939fe7250ab335c3de9cfa320475e9fc4236 /tests/macros
parentab99bdfc408e56a2e8a1a3ada21effe983433851 (diff)
downloadNim-aa7ad8897895acaee9e2999652050d5bc52921a7.tar.gz
fixes #10075 [backport]
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/tvarargsuntyped.nim31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/macros/tvarargsuntyped.nim b/tests/macros/tvarargsuntyped.nim
index 657ed47d6..f0fcff662 100644
--- a/tests/macros/tvarargsuntyped.nim
+++ b/tests/macros/tvarargsuntyped.nim
@@ -3,7 +3,9 @@ discard """
 (left: 2, r: 7, x: 8, height: 4, s: test, width: 3, y: 9, top: 1, g: 7, b: 8)
 (left: 2, r: 7, x: 8, height: 4, s: text, width: 3, y: 9, top: 1, g: 7, b: 8)
 (left: 2, r: 7, x: 8, height: 4, s: text, width: 3, y: 9, top: 4, g: 7, b: 8)
-(left: 2, r: 7, x: 8, height: 4, s: test, width: 3, y: 9, top: 1, g: 7, b: 8)'''
+(left: 2, r: 7, x: 8, height: 4, s: test, width: 3, y: 9, top: 1, g: 7, b: 8)
+10
+hello 18.0'''
 """
 
 import macros
@@ -78,3 +80,30 @@ let width: cint = 3
 let height: cint = 4
 
 bar(rect(top, left, width, height), "test", point(8, 9), color(7,7,8))
+
+
+# bug #10075
+
+import macros
+
+proc convert_hidden_stdconv(args: NimNode): NimNode =
+  var n = args
+  while n.len == 1 and n[0].kind == nnkHiddenStdConv:
+    n = n[0][1]
+  return n
+
+macro t2(s: int, v: varargs[untyped]): untyped =
+  let v = convert_hidden_stdconv(v)
+  echo v.treeRepr
+  let (v1, v2) = (v[0], v[1])
+  quote do:
+    echo `v1`, " ", `v2`
+
+template t1(s: int, v: varargs[typed]) =
+  #static:
+  #   dumpTree v
+  echo s
+  t2(s, v)
+
+when isMainModule:
+  t1(10, "hello", 18.0)