Thread overview
[Issue 10819] Implicit conversion error assigning one SortedRange to another when a function literal has been used
May 24, 2014
Stewart Gordon
Dec 17, 2022
Iain Buclaw
Jan 04, 2023
RazvanN
May 24, 2014
https://issues.dlang.org/show_bug.cgi?id=10819

Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |smjg@iname.com
            Summary|Invalid comparison for      |Implicit conversion error
                   |equality of lambda          |assigning one SortedRange
                   |functions                   |to another when a function
                   |                            |literal has been used

--- Comment #10 from Stewart Gordon <smjg@iname.com> ---
You completely forgot to post the compiler output.  Here's what I get (DMD
2.065 Win32):

bz10189.d(8): Error: cannot implicitly convert expression (c) of type
SortedRange!(int[], (a, b) => a > b) to SortedRange!(int[], (a, b) => a > b)

But the two types are the same.

The same occurs when a D1-style function literal is used

----- bz10189a.d -----
void main() {
    import std.range;
    SortedRange!(int[], "a > b") a;
    SortedRange!(int[], "a > b") b;
    b = a;
    SortedRange!(int[], function bool(a, b) { return a > b; }) c;
    SortedRange!(int[], function bool(a, b) { return a > b; }) d;
    d = c;
}
----------
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd bz10189a.d
bz10189a.d(8): Error: cannot implicitly convert expression (c) of type
SortedRange!(int[], function bool(a, b)
{
return a > b;
}
) to SortedRange!(int[], function bool(a, b)
{
return a > b;
}
)
----------

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=10819

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
January 04, 2023
https://issues.dlang.org/show_bug.cgi?id=10819

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com
          Component|dmd                         |phobos

--- Comment #11 from RazvanN <razvan.nitu1305@gmail.com> ---
We now have traits(isSame) that can perform a primitive form of lambda function comparison. This can now be implemented in the opAssign of SortedRange so it's not a compiler issue anymore. Changing component to phobos.

--