Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4971 from 9rnsr/fix14973
[REG2.068] Issue 14973 - compiler inference of contexts for nested map seems broken
- Loading branch information
Showing
8 changed files
with
146 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
template map(fun...) | ||
{ | ||
auto map(R)(R r) | ||
{ | ||
return MapResult!(fun, R)(r); | ||
} | ||
} | ||
|
||
struct MapResult(alias fun, R) | ||
{ | ||
R _input; | ||
|
||
@property bool empty() { return _input.length == 0; } | ||
@property auto front() { return fun(_input[0]); } | ||
void popFront() { _input = _input[1..$]; } | ||
} | ||
|
||
class Foo | ||
{ | ||
int baz() { return 1; } | ||
void bar() | ||
{ | ||
auto s = [1].map!(i => baz()); // compiles | ||
auto r = [1].map!( | ||
// lambda1 | ||
i => | ||
[1].map!( | ||
// lambda2 | ||
j => | ||
baz() | ||
) | ||
); // compiles <- error | ||
} | ||
} | ||
|
||
class Bar | ||
{ | ||
int baz; | ||
void bar() | ||
{ | ||
auto s = [1].map!(i => baz); // compiles | ||
auto r = [1].map!( | ||
// lambda1 | ||
i => | ||
[1].map!( | ||
// lambda2 | ||
j => | ||
baz | ||
) | ||
); // compiles <- error | ||
} | ||
} | ||
|
||
void main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters