fixes #10075 [backport]

(cherry picked from commit aa7ad88978)
This commit is contained in:
Araq
2019-01-13 15:52:50 +01:00
committed by narimiran
parent 98cdfe073e
commit e21b578740
2 changed files with 31 additions and 3 deletions

View File

@@ -2239,8 +2239,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
if n.sons[a].kind == nkHiddenStdConv:
doAssert n.sons[a].sons[0].kind == nkEmpty and
n.sons[a].sons[1].kind == nkArgList and
n.sons[a].sons[1].len == 0
n.sons[a].sons[1].kind in {nkBracket, nkArgList}
# Steal the container and pass it along
setSon(m.call, formal.position + 1, n.sons[a].sons[1])
else:

View File

@@ -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)