diff options
-rw-r--r-- | compiler/semgnrc.nim | 4 | ||||
-rw-r--r-- | tests/modules/mmodule_same_proc.nim | 6 | ||||
-rw-r--r-- | tests/modules/mmodule_same_proc_client.nim | 2 | ||||
-rw-r--r-- | tests/modules/tmodule_same_proc.nim | 9 |
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() |