* fixes #21496; Ambiguous calls compiles when module name are equal * add a test case
This commit is contained in:
parent
af086b68f2
commit
ffadc75afe
4 changed files with 13 additions and 1 deletions
|
|
@ -343,7 +343,8 @@ proc addDeclAt*(c: PContext; scope: PScope, sym: PSym, info: TLineInfo) =
|
||||||
if sym.name.s == "_": return
|
if sym.name.s == "_": return
|
||||||
let conflict = scope.addUniqueSym(sym)
|
let conflict = scope.addUniqueSym(sym)
|
||||||
if conflict != nil:
|
if conflict != nil:
|
||||||
if sym.kind == skModule and conflict.kind == skModule and sym.owner == conflict.owner:
|
if sym.kind == skModule and conflict.kind == skModule and
|
||||||
|
sym.position == conflict.position:
|
||||||
# e.g.: import foo; import foo
|
# e.g.: import foo; import foo
|
||||||
# xxx we could refine this by issuing a different hint for the case
|
# xxx we could refine this by issuing a different hint for the case
|
||||||
# where a duplicate import happens inside an include.
|
# where a duplicate import happens inside an include.
|
||||||
|
|
|
||||||
1
tests/import/buzz/m21496.nim
Normal file
1
tests/import/buzz/m21496.nim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
proc fb* = echo "buzz!"
|
||||||
1
tests/import/fizz/m21496.nim
Normal file
1
tests/import/fizz/m21496.nim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
proc fb* = echo "fizz!"
|
||||||
9
tests/import/t21496.nim
Normal file
9
tests/import/t21496.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "redefinition of 'm21496'; previous declaration here: t21496.nim(5, 12)"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import fizz/m21496, buzz/m21496
|
||||||
|
|
||||||
|
# bug #21496
|
||||||
|
|
||||||
|
m21496.fb()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue