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



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




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



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




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



---
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



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




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


[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




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




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