Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Sep 10, 2022
1 parent 884f1f6 commit eeed26f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/semtempl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
# field access (dot expr) will be handled by builtinFieldAccess
if not isField:
styleCheckUse(c, n.info, s)
result.typ = nil # for typ.isNil checks that sem this node again

proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode =
result = n
Expand Down
12 changes: 12 additions & 0 deletions tests/template/t13515.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
template test: bool = true

# compiles:
if not test:
echo "wtf"

# does not compile:
template x =
if not test:
echo "wtf"

x

0 comments on commit eeed26f

Please sign in to comment.