[Issue 254] New: Interfaces with the same function can give 3 different error messages

jcc7 jcc7_member at pathlink.com
Mon Jul 17 13:37:42 PDT 2006


In article <bug-254-3 at http.d.puremagic.com/issues/>, d-bugmail at puremagic.com
says...
>
>http://d.puremagic.com/issues/show_bug.cgi?id=254
>
>           Summary: Interfaces with the same function can give 3 different
>                    error messages
>           Product: D
>           Version: 0.162
>          Platform: PC
>        OS/Version: Windows
>            Status: NEW
>          Keywords: diagnostic
>          Severity: trivial
>          Priority: P3
>         Component: DMD
>        AssignedTo: bugzilla at digitalmars.com
>        ReportedBy: jpelcis at gmail.com
>
>
>This part remains the same.
>
>------------------------------------
>
>interface foo {
>        void blah ();
>}
>
>interface bar {
>        int blah ();
>}
>
>------------------------------------
>
>class blah : foo, bar {
>        int blah () {}
>}
>
>test.d(10): function test.blah.blah of type int() overrides but is not
>covariant
> with test.foo.blah of type void()
>
>------------------------------------
>
>class blah : bar, foo {
>        int blah () {}
>}
>
>test.d(10): function test.blah.blah expected to return a value of type int
>
>------------------------------------
>
>class blah : foo, bar {
>        void blah () {}
>}
>
>test.d(9): class test.blah interface function bar.blah isn't implemented
>
>------------------------------------
>
>All of the error messages are technically correct, but only one of them should
>be returned.

This might be due to the fact that Walter likes vary the error message based on
which part of the compiler generates the message: 
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/7852

I think it'd be nice if he'd use error numbers instead, though, and unified the
error messages as much as possible. If the same type of error were generated in
separate places in the compiler, that could be included in the message as well.

Maybe it could be something like this...

Current: function test.blah.blah of type int() overrides but is not covariant
with test.foo.blah of type void()

Proposed: function test.blah.blah expected to return a value of type int
[#403.1]


Current: function test.blah.blah expected to return a value of type int 

Proposed: function test.blah.blah expected to return a value of type int
[#403.2]


Current:
class test.blah interface function bar.blah isn't implemented

Proposed: function test.blah.blah expected to return a value of type int
[#403.3]


Or perhaps the it would add too much complication to the compiler to recognize
how the errors in this example are related.

jcc7



More information about the Digitalmars-d-bugs mailing list