* 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>
This commit is contained in:
parent
48d41ab375
commit
064b72a59c
4 changed files with 26 additions and 0 deletions
|
|
@ -376,6 +376,8 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode =
|
||||||
result = newSymNode(s, n.info)
|
result = newSymNode(s, n.info)
|
||||||
onUse(n.info, s)
|
onUse(n.info, s)
|
||||||
else:
|
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)
|
result = semTemplSymbol(c.c, n, s, c.noGenSym > 0)
|
||||||
of nkBind:
|
of nkBind:
|
||||||
result = semTemplBody(c, n[0])
|
result = semTemplBody(c, n[0])
|
||||||
|
|
|
||||||
1
tests/template/m1027a.nim
Normal file
1
tests/template/m1027a.nim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
const version_str* = "mod a"
|
||||||
1
tests/template/m1027b.nim
Normal file
1
tests/template/m1027b.nim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
const version_str* = "mod b"
|
||||||
22
tests/template/t1027.nim
Normal file
22
tests/template/t1027.nim
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
discard """
|
||||||
|
cmd: "nim check --hints:off $file"
|
||||||
|
errormsg: ""
|
||||||
|
nimout: '''
|
||||||
|
t1027.nim(20, 19) Error: ambiguous identifier: 'version_str' -- use one of the following:
|
||||||
|
m1027a.version_str: string
|
||||||
|
m1027b.version_str: string
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import m1027a, m1027b
|
||||||
|
|
||||||
|
# bug #1027
|
||||||
|
template wrap_me(stuff): untyped =
|
||||||
|
echo "Using " & version_str
|
||||||
|
|
||||||
|
wrap_me("hey")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue