fixes #3498
Previously it was not possible to use template arguments in template body as the symbols were not resolved correctly leading to Error: undeclared identifier: 'XX', eg.: template defaultOf[T](t: T): expr = (var d: T; d) echo defaultOf(1) #<- invalid identifier, but should output 0
This commit is contained in:
parent
8e4b5e10ba
commit
f838c1baa4
3 changed files with 20 additions and 13 deletions
|
|
@ -228,10 +228,7 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym): PNode =
|
|||
of skParam:
|
||||
result = n
|
||||
of skType:
|
||||
if (s.typ != nil) and (s.typ.kind != tyGenericParam):
|
||||
result = newSymNodeTypeDesc(s, n.info)
|
||||
else:
|
||||
result = n
|
||||
result = newSymNodeTypeDesc(s, n.info)
|
||||
else:
|
||||
result = newSymNode(s, n.info)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue