Thread overview |
---|
July 17, 2006 [Issue 254] New: Interfaces with the same function can give 3 different error messages | ||||
---|---|---|---|---|
| ||||
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. -- |
July 17, 2006 Re: [Issue 254] New: Interfaces with the same function can give 3 different error messages | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 [#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 |
July 19, 2006 [Issue 254] Interfaces with the same function can give 3 different error messages | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=254 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX ------- Comment #1 from bugzilla@digitalmars.com 2006-07-19 01:37 ------- Since the error messages are still valid, it doesn't matter that they differ. -- |
Copyright © 1999-2021 by the D Language Foundation