On Sunday, 14 August 2016 at 15:53:21 UTC, ag0aep6g wrote:
On 08/14/2016 04:27 PM, Uranuz wrote:
[...]
Looks like a compiler bug, since it works without the struct:
----
import std.algorithm: map;
import std.array: array;
import std.typecons: tuple;
immutable aaa = [
tuple("1", "one"),
tuple("2", "two"),
tuple("3", "three")
];
immutable bbb = aaa.map!( a => a[0] ).array;
----
And that's essentially the same thing.
It has already been filed:
https://issues.dlang.org/show_bug.cgi?id=15908
For a workaround, it works when you explicitly state the type
of the parameter:
----
struct A
{
import std.algorithm: map;
import std.array: array;
import std.typecons: tuple, Tuple;
static immutable aaa = [
tuple("1", "one"),
tuple("2", "two"),
tuple("3", "three")
];
alias Tup = Tuple!(string, string);
static immutable bbb = aaa.map!( (Tup a) => a[0] ).array;
}
----
OK. I just declared alias for predicate outside struct to
workaround. Maybe compiler trying to get context when attemting
to infer arguments for some reason, but fails. Or something
else...