www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13868] New: Types with the same name in different packages

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

          Issue ID: 13868
           Summary: Types with the same name in different packages produce
                    poor diagnostics
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: redballoon36 gmail.com

Consider the following modules:

first.d:
struct A { }

second.d
struct A { }

third.d:
import first;
import second;

void main()
{
    first.A a;
    second.a b;
    a = b;
}

Compiling these three files together produces the following error message:
Error: cannot implicitly convert expression (b) of type A to A

When it is not immediately clear that a and b come from different packages,
this error message is not helpful.  When the names of the types are similar, it
would be helpful to have the package / module name emitted in the diagnostic.

--
Dec 15 2014