* fix #13515 * only compile test * no idea why this PR is unlocking this * don't rope in symchoices * even more restrictive
This commit is contained in:
parent
884f1f6b11
commit
58e6d439d8
2 changed files with 23 additions and 1 deletions
|
|
@ -250,8 +250,14 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
|
||||||
of skUnknown:
|
of skUnknown:
|
||||||
# Introduced in this pass! Leave it as an identifier.
|
# Introduced in this pass! Leave it as an identifier.
|
||||||
result = n
|
result = n
|
||||||
of OverloadableSyms:
|
of OverloadableSyms-{skTemplate,skMacro}:
|
||||||
result = symChoice(c, n, s, scOpen, isField)
|
result = symChoice(c, n, s, scOpen, isField)
|
||||||
|
of skTemplate, skMacro:
|
||||||
|
result = symChoice(c, n, s, scOpen, isField)
|
||||||
|
if result.kind == nkSym:
|
||||||
|
# template/macro symbols might need to be semchecked again
|
||||||
|
# prepareOperand etc don't do this without setting the type to nil
|
||||||
|
result.typ = nil
|
||||||
of skGenericParam:
|
of skGenericParam:
|
||||||
if isField and sfGenSym in s.flags: result = n
|
if isField and sfGenSym in s.flags: result = n
|
||||||
else: result = newSymNodeTypeDesc(s, c.idgen, n.info)
|
else: result = newSymNodeTypeDesc(s, c.idgen, n.info)
|
||||||
|
|
|
||||||
16
tests/template/t13515.nim
Normal file
16
tests/template/t13515.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
|
template test: bool = true
|
||||||
|
|
||||||
|
# compiles:
|
||||||
|
if not test:
|
||||||
|
echo "wtf"
|
||||||
|
|
||||||
|
# does not compile:
|
||||||
|
template x =
|
||||||
|
if not test:
|
||||||
|
echo "wtf"
|
||||||
|
|
||||||
|
x
|
||||||
Loading…
Add table
Add a link
Reference in a new issue