mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes quoted variables with typedesc types (#21493)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user