From 61fcfa8495f6364d62176372d8fd30aa3b1702a6 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Fri, 12 Jul 2019 21:48:27 -0700 Subject: [PATCH] add test for #9607 --- tests/macros/tgenast.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/macros/tgenast.nim b/tests/macros/tgenast.nim index a593ba0b84f03..ed35bf1069b25 100644 --- a/tests/macros/tgenast.nim +++ b/tests/macros/tgenast.nim @@ -87,3 +87,17 @@ block: result = genAst(a, b = a.len) do: # shows 2 ways to get a.len (a.len, b) doAssert foo() == (5, 5) + +block: + # fix https://github.com/nim-lang/Nim/issues/9607 + proc fun1(info:LineInfo): string = "bar1" + proc fun2(info:int): string = "bar2" + macro bar(args: varargs[untyped]): untyped = + let info = args.lineInfoObj + let fun1 = bindSym"fun1" + let fun2 = bindSym"fun2" + result = genAst(info = newLit info) do: + (fun1(info), fun2(info.line)) + doAssert bar() == ("bar1", "bar2") + +