mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
fixes #10192
This commit is contained in:
@@ -37,7 +37,7 @@ proc evalTemplateAux(templ, actual: PNode, c: var TemplCtx, result: PNode) =
|
||||
case templ.kind
|
||||
of nkSym:
|
||||
var s = templ.sym
|
||||
if s.owner == nil or s.owner.id == c.owner.id:
|
||||
if (s.owner == nil and s.kind == skParam) or s.owner == c.owner:
|
||||
if s.kind == skParam and sfGenSym notin s.flags:
|
||||
handleParam actual.sons[s.position]
|
||||
elif (s.owner != nil) and (s.kind == skGenericParam or
|
||||
|
||||
@@ -110,3 +110,23 @@ implementUnary(): x*x
|
||||
|
||||
registerInstantiation(int)
|
||||
registerInstantiation(float)
|
||||
|
||||
# bug #10192
|
||||
template nest(body) {.dirty.} =
|
||||
template p1(b1: untyped) {.dirty, used.} =
|
||||
template implp1: untyped {.dirty.} = b1
|
||||
template p2(b2: untyped) {.dirty, used.} =
|
||||
template implp2: untyped {.dirty.} = b2
|
||||
|
||||
body
|
||||
implp1
|
||||
implp2
|
||||
|
||||
template test() =
|
||||
nest:
|
||||
p1:
|
||||
var foo = "bar"
|
||||
p2:
|
||||
doAssert(foo.len == 3)
|
||||
|
||||
test()
|
||||
|
||||
Reference in New Issue
Block a user