Bug 4528 – Better error message for private abstract method

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-07-28T15:20:00Z
Last change time
2013-03-27T05:16:23Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-07-28T15:20:52Z
With this wrong program: abstract class Foo { final abstract void bar(); } void main() {} dmd 2.047 generates the error message: test.d(2): Error: function test.Foo.bar cannot be both final and abstract With this other wrong program: abstract class Foo { private abstract void bar(); } void main() {} dmd generates the error message: prog.d(2): Error: function test.Foo.bar non-virtual functions cannot be abstract But I think this second error message can be improved, because at first look bar() looks virtual: test.d(2): Error: member function test.Foo.bar() cannot be both private and abstract. Or (inspired by C# compiler): test.d(2): Error: member function test.Foo.bar(): abstract functions cannot be private. Or (inspired by Java compiler): test.d(2): Error: method test.Foo.bar(): illegal combination of modifiers: abstract and private.
Comment #1 by andrej.mitrovich — 2012-12-27T16:59:52Z
Comment #2 by github-bugzilla — 2013-03-17T18:24:16Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/47bbd55add98503755346b6db019b988c12b553a Fixes Issue 4528 - Better diagnostic on non-virtual abstract method. https://github.com/D-Programming-Language/dmd/commit/f138c299ade0c9be6341644ea02441d39338a57c Merge pull request #1415 from AndrejMitrovic/Fix4528 Issue 4528 - Better diagnostic on non-virtual abstract method.