Thread overview
[Issue 7560] New: Expanding inherited overload sets gives error
Feb 22, 2012
blm768@gmail.com
Feb 22, 2012
blm768@gmail.com
Feb 23, 2012
blm768@gmail.com
[Issue 7560] Base class overloaded methods created by mixins can't be overriden
Apr 30, 2012
blm768@gmail.com
Apr 30, 2012
Kenji Hara
February 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7560

           Summary: Expanding inherited overload sets gives error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: blm768@gmail.com


--- Comment #0 from blm768@gmail.com 2012-02-21 19:33:31 PST ---
I've been working on a project that involves overloading and inheritance and I've run into a bit of a problem. My code looks something like this:

class Base {
    void get(ubyte b);
}

class Derived: Base {
    alias Base.get get;
    void get(string s);
}

When I try to compile it, DMD says that the alias Derived.get conflicts with Derived.get(string). This behavior makes sense to a degree (declaring get(string) is creating a new overload instead of overriding an old one), but it's probably not what anyone wants. It should be a fairly simple fix; just a little special-case code in DMD for this type of alias or something...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7560



--- Comment #1 from blm768@gmail.com 2012-02-22 07:20:05 PST ---
For some reason, it appears that my test case actually does compile :)
I guess I'd better check my test cases next time.
The original code is still broken, though; I'll try to put together a test case
that actually breaks.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7560



--- Comment #2 from blm768@gmail.com 2012-02-22 16:05:39 PST ---
I found a test case that should work:

class Base {
    template getter(T) {
        void get(ref T[] i, uint n) {}
    }
    mixin getter!uint;
    mixin getter!char;
}

class Derived: Base {
    alias Base.get get;
    void get(ref char[] x) {}
}

It appears to be a problem with trying to create new overloads when the base class overloads are put there by multiple mixins. Using only one mixin seems to work fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7560


blm768@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Base class overloaded       |Base class overloaded
                   |methods created by mixins   |methods created by mixins
                   |can't be overrided          |can't be overriden


--- Comment #3 from blm768@gmail.com 2012-04-30 07:41:26 PDT ---
The original description is inaccurate; the second comment provides the correct information and test case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7560


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-04-30 08:43:41 PDT ---
https://github.com/D-Programming-Language/dmd/pull/916

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7560



--- Comment #5 from github-bugzilla@puremagic.com 2012-04-30 12:03:21 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7cea8d2bef94d2e7394c4ef96792acd782f73173
fix Issue 7560 - Base class overloaded methods created by mixins can't be
overriden

https://github.com/D-Programming-Language/dmd/commit/3e1358125feb935445370000ec883dc4afc3befc Merge pull request #916 from 9rnsr/fix7560

Issue 7560 - Base class overloaded methods created by mixins can't be overriden

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