[Issue 18944] New: Mixing in new overloads of a function in an object won't resolve the overloads correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 5 09:02:15 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18944

          Issue ID: 18944
           Summary: Mixing in new overloads of a function in an object
                    won't resolve the overloads correctly
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: gooberman at gmail.com

Seems related to ancient issue 9235, but not quote the same. Any additional
overloads of a function that are called from the object itself won't resolve.

Code example at https://run.dlang.io/is/a85Lbq

Changing the code so that every instance of the foo overload is mixed in
results in the program compiling and running as expected.

I came across this when trying to use mixins as a dodgy way to replicate C#'s
partial classes. So this is quite bad as far as usability concerns go.

Error strings at time of submission:

onlineapp.d(26): Error: function onlineapp.LookAtMe.foo(ref float val) is not
callable using argument types (int)
onlineapp.d(26):        cannot pass argument val of type int to parameter ref
float val
onlineapp.d(31): Error: function onlineapp.LookAtMe.foo(ref float val) is not
callable using argument types (string)
onlineapp.d(31):        cannot pass argument val of type string to parameter
ref float val

--


More information about the Digitalmars-d-bugs mailing list