From 6f6e6fe4eb812e78e087919b69c6b1d023c8536f Mon Sep 17 00:00:00 2001 From: BigEpsilon Date: Wed, 30 Aug 2017 14:44:11 +0200 Subject: [PATCH] Fix #6295 (#6296) --- compiler/renderer.nim | 2 +- tests/macros/tgenericparams.nim | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/macros/tgenericparams.nim diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 7d9536625..220693f68 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -1327,7 +1327,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = if n.hasExplicitParams: put(g, tkBracketLe, "[") - gcomma(g, n) + gsemicolon(g, n) put(g, tkBracketRi, "]") of nkFormalParams: put(g, tkParLe, "(") diff --git a/tests/macros/tgenericparams.nim b/tests/macros/tgenericparams.nim new file mode 100644 index 000000000..d656f045a --- /dev/null +++ b/tests/macros/tgenericparams.nim @@ -0,0 +1,13 @@ +discard """ +output: '''proc foo[T, N: static[int]]() +proc foo[T; N: static[int]]()''' +""" +import macros + +macro test():string = + let expr0 = "proc foo[T, N: static[int]]()" + let expr1 = "proc foo[T; N: static[int]]()" + + $toStrLit(parseExpr(expr0)) & "\n" & $toStrLit(parseExpr(expr1)) + +echo test()