diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-10-25 03:44:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-24 21:44:09 +0200 |
commit | 064b72a59c6ed61939fc89f91f4311ac60a6ec45 (patch) | |
tree | e2eed386d53d03733d58e53f98bbf8b6dc71f980 /compiler | |
parent | 48d41ab375498ba638863b55807bac96eccf667a (diff) | |
download | Nim-064b72a59c6ed61939fc89f91f4311ac60a6ec45.tar.gz |
fixes #1027; disallow templates to use ambiguous identifiers (#20631)
* test qualifiedLookUp in templates * check later * add testcase * add 4errormsg * Update tests/template/m1027a.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update tests/template/m1027b.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semtempl.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index c20f01023..6e824195a 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -376,6 +376,8 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = result = newSymNode(s, n.info) onUse(n.info, s) else: + if s.kind in {skType, skVar, skLet, skConst}: + discard qualifiedLookUp(c.c, n, {checkAmbiguity, checkModule}) result = semTemplSymbol(c.c, n, s, c.noGenSym > 0) of nkBind: result = semTemplBody(c, n[0]) |