mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
@@ -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)
|
||||
Reference in New Issue
Block a user