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 #5061 from MartinNowak/merge_stable
Merge branch 'merge_stable_convert' into merge_stable
- Loading branch information
Showing
10 changed files
with
256 additions
and
22 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,92 @@ | ||
// REQUIRED_ARGS: -unittest -boundscheck=off | ||
// PERMUTE_ARGS: | ||
// EXTRA_SOURCES: imports/a15030.d imports/b15030.d | ||
|
||
void main() {} | ||
|
||
/+ | ||
Compiler output with -v switch. | ||
With 2.068.0: | ||
-------- | ||
code a | ||
code b | ||
function b.__unittestL5_2 | ||
function b.__unittestL5_2.__lambda1 | ||
function b.__unittestL5_2.__lambda1.__lambda2 | ||
function b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash | ||
function b.__unittestL5_2.__lambda1.__lambda2.__lambda2 | ||
The nested functions '__lambda1', '__lambda2', and 'filter' are | ||
(fortunately) generated from outer to inner. | ||
With 2.068.1: | ||
-------- | ||
code a | ||
function b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter | ||
function b.__unittestL5_2.__lambda1.__lambda2 | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash | ||
code b | ||
function b.__unittestL5_2 | ||
function b.__unittestL5_2.__lambda1 | ||
Assertion failure: '!v->csym' on line 1060 in file 'glue.c' | ||
abnormal program termination | ||
'filer' is generated before its ancestor functions '__lambda1' and '__lambda2' - it's a bug. | ||
Fixed (contains debug prints): | ||
-------- | ||
code a | ||
b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter @[algorithm.d(5)] | ||
--> pushed to unittest @[b.d(5)] | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash | ||
code b | ||
function b.__unittestL5_2 | ||
function b.__unittestL5_2.__lambda1 | ||
function b.__unittestL5_2.__lambda1.__lambda2 | ||
function b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter | ||
function b.__unittestL5_2.__lambda1.__lambda2.__lambda2 | ||
By using `deferredNested` correctly, those nested function generations are ordered again. | ||
Fixed more: | ||
-------- | ||
function D main | ||
code a | ||
code b | ||
function b.__unittestL5_2 | ||
function b.__unittestL5_2.__lambda1 | ||
function b.__unittestL5_2.__lambda1.__lambda2 | ||
function b.__unittestL5_2.__lambda1.__lambda2.filter!(int[]).filter | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals | ||
function b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash | ||
function b.__unittestL5_2.__lambda1.__lambda2.__lambda2 | ||
By the tweak in TemplateInstance::appendToModuleMember(), all the code of | ||
(implicitly) nested instances are stored into corresponding module object file. | ||
+/ |
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,3 @@ | ||
module a; | ||
|
||
import imports.std15030algo; |
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,17 @@ | ||
module b; | ||
|
||
import imports.std15030algo; | ||
|
||
unittest | ||
{ | ||
auto dg = | ||
// __lambda1 | ||
(int[] delegate(int[]) self) => | ||
// __lambda2 | ||
(int[] arr) => arr | ||
? self([arr.filter!( | ||
// __lambda2.__lambda2 | ||
a => a | ||
).front]) | ||
: null; | ||
} |
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,13 @@ | ||
module imports.std15021conv; | ||
|
||
T to(T, A...)(A args) | ||
{ | ||
return toImpl!T(args); | ||
} | ||
|
||
T toImpl(T, S)(S value) | ||
{ | ||
import imports.std15021format; | ||
enforceValidFormatSpec!(S, char)('c'); | ||
return ""; | ||
} |
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,12 @@ | ||
module imports.std15021format; | ||
|
||
T enforceEx(T)(T value, lazy string msg = "") | ||
{ | ||
if (!value) throw new Exception(msg); | ||
return value; | ||
} | ||
|
||
void enforceValidFormatSpec(T, Char)(int spec) | ||
{ | ||
enforceEx(spec == 's'); | ||
} |
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,35 @@ | ||
module imports.std15030algo; | ||
|
||
template filter(alias pred) | ||
{ | ||
auto filter(R)(R r) | ||
{ | ||
return FilterResult!(pred, R)(r); | ||
} | ||
} | ||
|
||
private struct FilterResult(alias pred, R) | ||
{ | ||
R _input; | ||
|
||
this(R r) | ||
{ | ||
_input = r; | ||
while (_input.length != 0 && !pred(_input[0])) | ||
{ | ||
_input = _input[1..$]; | ||
} | ||
} | ||
|
||
@property bool empty() { return _input.length == 0; } | ||
|
||
@property auto ref front() { return _input[0]; } | ||
|
||
void popFront() | ||
{ | ||
do | ||
{ | ||
_input = _input[1..$]; | ||
} while (_input.length != 0 && !pred(_input[0])); | ||
} | ||
} |
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,18 @@ | ||
// PERMUTE_ARGS: -inline -g -debug -unittest | ||
|
||
import imports.std15021conv; | ||
|
||
class AliasDecl {} | ||
|
||
void aliasDecl(AliasDecl ad) | ||
{ | ||
AliasDecl* zis; | ||
|
||
static if (is(typeof(to!string(*zis)))) | ||
{ | ||
pragma(msg, "hit!"); | ||
to!string(*zis); | ||
} | ||
} | ||
|
||
void main() {} |