[Issue 12778] Aliasing opBinaryRight to opBinary works only in certain cases

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 24 01:35:15 PDT 2014


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

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

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

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
https://github.com/D-Programming-Language/dmd/pull/3578

(In reply to Andrej Mitrovic from comment #0)
> I don't know if supporting this kind of aliasing was a feature by design or
> by mistake. It's definitely nice to have it, but it fails in 'test2'. It
> should either be fully supported (rejects-valid) or fully rejected
> (accepts-invalid).

If both x.opBinary(y) and y.opBinaryRight(x) found, and they are exactly same
symbol, x.opBinary(y) should be preferred.

This is consistent with current opEquals behavior - if both x.opEquals(y) and
y.opEquals(x) found and they call exactly same symbol, it will be resolved to
x.opEquals(y).

--


More information about the Digitalmars-d-bugs mailing list