Thread overview | |||||
---|---|---|---|---|---|
|
February 25, 2012 [Issue 7586] New: Equality lambda inference problem on tuples | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7586 Summary: Equality lambda inference problem on tuples Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2012-02-25 10:08:07 PST --- I am not sure what's the cause of this problem. import std.algorithm, std.typecons; alias Tuple!int T; void main() { const T del = T(1); T[] items1 = [T(0), T(1), T(2)]; auto r1 = filter!(x => x != del)(items1); // OK auto r2 = filter!(x => del != x)(items1); // error const(T[]) items2 = [T(0), T(1), T(2)]; auto r3 = filter!(x => x != del)(items2); // error } test.d(7): Error: function std.typecons.Tuple!(int).Tuple.opEquals!(Tuple!(int)).opEquals (Tuple!(int) rhs) is not callable using argument types (Tuple!(int)) const ...\dmd2\src\phobos\std\algorithm.d(1089): Error: template instance test.main.__lambda4!(Tuple!(int)) error instantiating test.d(7): instantiated from here: filter!(Tuple!(int)[]) test.d(7): Error: template instance test.main.filter!(__lambda4).filter!(Tuple!(int)[]) error instantiating test.d(9): Error: function std.typecons.Tuple!(int).Tuple.opEquals!(const(Tuple!(int))).opEquals (const(Tuple!(int)) rhs) is not callable using argument types (const(Tuple!(int))) const ...\dmd2\src\phobos\std\algorithm.d(1089): Error: template instance test.main.__lambda6!(const(Tuple!(int))) error instantiating test.d(9): instantiated from here: filter!(const(Tuple!(int))[]) test.d(9): Error: template instance test.main.filter!(__lambda6).filter!(const(Tuple!(int))[]) error instantiating If x => x != del works then I think x => del != x too should work. The third case is a filter done on a const(Tuple!(int)[]), I think it's legit code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 26, 2012 [Issue 7586] Equality lambda inference problem on tuples | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=7586 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-02-25 20:01:34 PST --- The root issue is bug 5783, and lambda inference isn't related. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 26, 2012 [Issue 7586] Equality lambda inference problem on tuples | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=7586 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #2 from bearophile_hugs@eml.cc 2012-02-26 14:52:17 PST --- *** This issue has been marked as a duplicate of issue 5783 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation