https://issues.dlang.org/show_bug.cgi?id=17301

RazvanN <razvan.nitu1...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1...@gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from RazvanN <razvan.nitu1...@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

--

Reply via email to