parent
fe0291f127
commit
a296f091e4
2 changed files with 19 additions and 1 deletions
|
|
@ -263,9 +263,16 @@ proc semRoutineInTemplBody(c: var TemplCtx, n: PNode, k: TSymKind): PNode =
|
|||
n.sons[namePos] = ident
|
||||
else:
|
||||
n.sons[namePos] = semRoutineInTemplName(c, n.sons[namePos])
|
||||
# open scope for parameters
|
||||
openScope(c)
|
||||
for i in patternPos..bodyPos:
|
||||
for i in patternPos..miscPos:
|
||||
n.sons[i] = semTemplBody(c, n.sons[i])
|
||||
# open scope for locals
|
||||
openScope(c)
|
||||
n.sons[bodyPos] = semTemplBody(c, n.sons[bodyPos])
|
||||
# close scope for locals
|
||||
closeScope(c)
|
||||
# close scope for parameters
|
||||
closeScope(c)
|
||||
|
||||
proc semTemplSomeDecl(c: var TemplCtx, n: PNode, symKind: TSymKind; start=0) =
|
||||
|
|
|
|||
11
tests/template/tprocparshadow.nim
Normal file
11
tests/template/tprocparshadow.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
discard """
|
||||
output: "10"
|
||||
"""
|
||||
|
||||
template something(name: untyped) =
|
||||
proc name(x: int) =
|
||||
var x = x # this one should not be rejected by the compiler (#5225)
|
||||
echo x
|
||||
|
||||
something(what)
|
||||
what(10)
|
||||
Loading…
Add table
Add a link
Reference in a new issue