www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 254] New: Interfaces with the same function can give 3 different error messages

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: jpelcis 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.


-- 
Jul 16 2006
next sibling parent jcc7 <jcc7_member pathlink.com> writes:
In article <bug-254-3 http.d.puremagic.com/issues/>, d-bugmail 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 digitalmars.com
        ReportedBy: jpelcis 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 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 Current: class test.blah interface function bar.blah isn't implemented Proposed: function test.blah.blah expected to return a value of type int Or perhaps the it would add too much complication to the compiler to recognize how the errors in this example are related. jcc7
Jul 17 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=254


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX





Since the error messages are still valid, it doesn't matter that they differ.


-- 
Jul 18 2006