summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-05-24 22:50:43 +0200
committerGitHub <noreply@github.com>2019-05-24 22:50:43 +0200
commit7e53c1c5c58c1db070cd430b5630aca9efdd04ef (patch)
treebb225948131cd801f842a151fe745765a1a242f8
parentef8ddef47b6ea10c6e5e504165245ab514391056 (diff)
downloadNim-7e53c1c5c58c1db070cd430b5630aca9efdd04ef.tar.gz
fixes #11188 (#11319)
-rw-r--r--compiler/semgnrc.nim4
-rw-r--r--tests/modules/mmodule_same_proc.nim6
-rw-r--r--tests/modules/mmodule_same_proc_client.nim2
-rw-r--r--tests/modules/tmodule_same_proc.nim9
4 files changed, 19 insertions, 2 deletions
diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim
index e63e69f68..e63d65a82 100644
--- a/compiler/semgnrc.nim
+++ b/compiler/semgnrc.nim
@@ -152,8 +152,8 @@ proc fuzzyLookup(c: PContext, n: PNode, flags: TSemGenericFlags,
     result = n
     let n = n[1]
     let ident = considerQuotedIdent(c, n)
-    var s = searchInScopes(c, ident).skipAlias(n, c.config)
-    if s != nil and s.kind in routineKinds:
+    var s = searchInScopes(c, ident, routineKinds).skipAlias(n, c.config)
+    if s != nil:
       isMacro = s.kind in {skTemplate, skMacro}
       if withinBind in flags:
         result = newDot(result, symChoice(c, n, s, scClosed))
diff --git a/tests/modules/mmodule_same_proc.nim b/tests/modules/mmodule_same_proc.nim
new file mode 100644
index 000000000..5ce56ec11
--- /dev/null
+++ b/tests/modules/mmodule_same_proc.nim
@@ -0,0 +1,6 @@
+
+# the module being the same name as the proc
+# is a requirement to trigger the error
+import mmodule_same_proc_client
+
+proc bar*[T](foo: T): bool = foo.mmodule_same_proc_client()
diff --git a/tests/modules/mmodule_same_proc_client.nim b/tests/modules/mmodule_same_proc_client.nim
new file mode 100644
index 000000000..e36ec42cf
--- /dev/null
+++ b/tests/modules/mmodule_same_proc_client.nim
@@ -0,0 +1,2 @@
+
+proc mmodule_same_proc_client*(x: string): bool = x.len > 0
diff --git a/tests/modules/tmodule_same_proc.nim b/tests/modules/tmodule_same_proc.nim
new file mode 100644
index 000000000..dc4dfd3d6
--- /dev/null
+++ b/tests/modules/tmodule_same_proc.nim
@@ -0,0 +1,9 @@
+
+import mmodule_same_proc
+
+# importing baz causes the error not to trigger
+#import baz
+
+# bug #11188
+
+discard "foo".bar()