Bug 14973 – [REG2.068] compiler inference of contexts for nested map seems broken
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-28T03:40:00Z
Last change time
2016-02-02T03:02:15Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2015-08-28T03:40:50Z
This is separated from issue 14962 because the root issue is not exactly same.
import std.range;
import std.algorithm;
class Foo {
int baz() { return 1;}
void bar() {
auto s = [1].map!(i => baz()); // compiles
auto r = [1].map!(i => [1].map!(j => baz())); // error
}
}
testfoo.d(8): Error: need 'this' for 'baz' of type 'int()'
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/algorithm/iteration.d(459): instantiated from here: MapResult!(__lambda2, int[])
testfoo.d(8): instantiated from here: map!(int[])
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/algorithm/iteration.d(549): instantiated from here: __lambda2!int
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/algorithm/iteration.d(459): instantiated from here: MapResult!(__lambda2, int[])
testfoo.d(8): instantiated from here: map!(int[])