www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6373] New: More descriptive 'hidden by X is deprecated' error

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Jul 24 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373



--- Comment #1 from bearophile_hugs eml.cc 2011-07-26 08:24:32 PDT ---
Some examples where people ask for help:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=28397

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=28465

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal


--- Comment #2 from bearophile_hugs eml.cc 2011-07-26 08:27:28 PDT ---
Raised importance from minor to normal because already 4 persons have asked for
help on this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373



--- Comment #3 from bearophile_hugs eml.cc 2011-07-27 18:50:27 PDT ---
Created an attachment (id=1013)
diff to toobj.c

A kind of patch over dmd 2.054, probably wrong. Be kind.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373


klickverbot <code klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |code klickverbot.at


--- Comment #4 from klickverbot <code klickverbot.at> 2011-07-28 10:40:11 PDT
---
Besides the fact that pull requests are preferred for cases where you are
reasonably sure that you patch is worth closer inspection/inclusion, please use
the unified diff format (diff -u) for patches. It it the de-facto standard in
the open source world and makes it easier to review changes.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 28 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-11-29
07:59:19 PST ---
https://github.com/D-Programming-Language/dmd/pull/1335

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373



--- Comment #6 from github-bugzilla puremagic.com 2012-12-09 09:52:55 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/dc8ccc35c015c19e6b80dc7ec6950b3038d9c79c
Fixes Issue 6373 - Add more descriptive error message when base class method is
hidden.

https://github.com/D-Programming-Language/dmd/commit/ce7f3d86e7faf468eb6b64410d00084e9dce6e28
Merge pull request #1335 from AndrejMitrovic/Fix6373

[diag] Issue 6373 - Add more descriptive error message when base class method
is hidden

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 09 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 09 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373



--- Comment #7 from bearophile_hugs eml.cc 2012-12-09 10:42:21 PST ---
On GigHub in your little patch the new line 814 seems very very long.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 09 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6373



--- Comment #8 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-20
15:00:53 PST ---
*** Issue 4216 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 20 2012