fixes quoted variables with typedesc types (#21493)
This commit is contained in:
parent
8e9fc5e639
commit
72e262666b
2 changed files with 9 additions and 1 deletions
|
|
@ -2206,7 +2206,7 @@ proc semQuoteAst(c: PContext, n: PNode): PNode =
|
|||
dummyTemplate[paramsPos].add newTreeI(nkIdentDefs, n.info, ids[0], getSysSym(c.graph, n.info, "typed").newSymNode, c.graph.emptyNode)
|
||||
for i in 1..<ids.len:
|
||||
let typ = semExprWithType(c, quotes[i+1], {}).typ
|
||||
if tfTriggersCompileTime notin typ.flags:
|
||||
if tfTriggersCompileTime notin typ.flags and typ.kind != tyTypeDesc:
|
||||
dummyTemplate[paramsPos].add newTreeI(nkIdentDefs, n.info, ids[i], newNodeIT(nkType, n.info, typ), c.graph.emptyNode)
|
||||
else:
|
||||
dummyTemplate[paramsPos].add newTreeI(nkIdentDefs, n.info, ids[i], getSysSym(c.graph, n.info, "typed").newSymNode, c.graph.emptyNode)
|
||||
|
|
|
|||
|
|
@ -311,3 +311,11 @@ block: # bug #9607
|
|||
|
||||
doAssert echoL() == "bar"
|
||||
doAssert echoM() == "bar"
|
||||
|
||||
block:
|
||||
macro hello[T](x: T): untyped =
|
||||
result = quote do:
|
||||
let m: `T` = `x`
|
||||
discard m
|
||||
|
||||
hello(12)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue