fixes #10075 [backport]
This commit is contained in:
parent
ab99bdfc40
commit
aa7ad88978
2 changed files with 31 additions and 3 deletions
|
|
@ -2267,8 +2267,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
|
||||||
|
|
||||||
if n.sons[a].kind == nkHiddenStdConv:
|
if n.sons[a].kind == nkHiddenStdConv:
|
||||||
doAssert n.sons[a].sons[0].kind == nkEmpty and
|
doAssert n.sons[a].sons[0].kind == nkEmpty and
|
||||||
n.sons[a].sons[1].kind == nkArgList and
|
n.sons[a].sons[1].kind in {nkBracket, nkArgList}
|
||||||
n.sons[a].sons[1].len == 0
|
|
||||||
# Steal the container and pass it along
|
# Steal the container and pass it along
|
||||||
setSon(m.call, formal.position + 1, n.sons[a].sons[1])
|
setSon(m.call, formal.position + 1, n.sons[a].sons[1])
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -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: 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: 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: 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
|
import macros
|
||||||
|
|
@ -78,3 +80,30 @@ let width: cint = 3
|
||||||
let height: cint = 4
|
let height: cint = 4
|
||||||
|
|
||||||
bar(rect(top, left, width, height), "test", point(8, 9), color(7,7,8))
|
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue