[Issue 17301] Unhelpful error message on template and non-template struct defined in separate modules
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 18 09:45:21 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=17301
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |razvan.nitu1305 at gmail.com
Resolution|--- |INVALID
--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
This bug report is invalid. Lookup is first performed in the module scope and
only if the symbol is not found the imports are then searched. In this case,
HashMap is defined in moduleA and therefore the compiler picks it up and
outputs the appropriate error message. If the symbols are in the same scope, of
course an ambiguity is raised. This behavior is according to the spec [1],
point 4: "Symbol lookup stops as soon as a matching symbol is found. If two
symbols with the same name are found at the same lookup phase, this ambiguity
will result in a compilation error.". In this bug report, the symbols are not
found in the same lookup phase and according to the rules moduleA.HashMap is
found first.
[1] https://dlang.org/spec/module.html#name_lookup
--
More information about the Digitalmars-d-bugs
mailing list