digitalmars.D.bugs - [Issue 15077] New: Two structs with the same name could have a nicer
- via Digitalmars-d-bugs (29/29) Sep 16 2015 https://issues.dlang.org/show_bug.cgi?id=15077
https://issues.dlang.org/show_bug.cgi?id=15077 Issue ID: 15077 Summary: Two structs with the same name could have a nicer error message Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: destructionator gmail.com Consider a case with two modules that define structs with the same name. If you try to assign variables of the two types to each other, the compiler will say something like: f.d(12): Error: cannot implicitly convert expression (white()) of type Color to Color I mentioned this in a SO answer today: you can borrow code from there but it is trivial to make another one. Anyway, I propose the compiler error message to get a little smarter. The current behavior is nice in most cases, a fully-qualifed name often makes error messages long and ugly, but if the error message is ever in the form of `cannot convert A to A`, it should print the fully qualified name so it makes sense. So actually do a string comparison when building the message and if(typeA.toChars() == typeB.toChars()) use_fully_qualified_name. --
Sep 16 2015