summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-03-13 03:03:14 +0800
committerGitHub <noreply@github.com>2023-03-12 20:03:14 +0100
commitffadc75afead6baed0885877edb2c3b1c9ef1b2e (patch)
tree697bd616ab2eb1e91a2eff7eb92ba2a3f2e1283e /compiler
parentaf086b68f2f718a4ad20e37bf3a00d9a57abec4d (diff)
downloadNim-ffadc75afead6baed0885877edb2c3b1c9ef1b2e.tar.gz
fixes #21496; Ambiguous calls compiles when module name are equal (#21500)
* fixes #21496; Ambiguous calls compiles when module name are equal

* add a test case
Diffstat (limited to 'compiler')
-rw-r--r--compiler/lookups.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim
index e7bca08bc..3f028a52f 100644
--- a/compiler/lookups.nim
+++ b/compiler/lookups.nim
@@ -343,7 +343,8 @@ proc addDeclAt*(c: PContext; scope: PScope, sym: PSym, info: TLineInfo) =
   if sym.name.s == "_": return
   let conflict = scope.addUniqueSym(sym)
   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
       # xxx we could refine this by issuing a different hint for the case
       # where a duplicate import happens inside an include.