[Issue 6373] New: More descriptive 'hidden by X is deprecated' error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 24 06:04:22 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6373
Summary: More descriptive 'hidden by X is deprecated' error
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: diagnostic
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2011-07-24 06:04:20 PDT ---
Wrong D2 code:
class Foo {
void method(int x) {}
void method(double x) {}
}
class Bar : public Foo { // line 5
override void method(int x) {}
}
void main() {
Foo f = new Bar();
f.method(1);
f.method(1.5);
}
DMD 2.054 gives the error:
test.d(5): Error: class test.Bar use of test.Foo.method(double x) hidden by Bar
is deprecated
While this program gives no errors:
class Foo {
void method(int x) {}
void method(double x) {}
}
class Bar : public Foo {
alias Foo.method method;
override void method(int x) {}
}
void main() {
Foo f = new Bar();
f.method(1);
f.method(1.5);
}
In the error message I suggest to add some reference to this usage of alias,
because in D.learn I've seen some D programmers blocked by this error message.
A possible message (also note the error line number, 6 instead of 5):
test.d(6): Error: class test.Bar use of test.Foo.method(double x) hidden by Bar
is deprecated. Use alias Foo.method method; if intended.
Or even, to be more clear:
test.d(6): Error: class test.Bar use of test.Foo.method(double x) hidden (not
overridden) by Bar is deprecated. Use alias Foo.method method; if intended.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list