Skip to content

Commit

Permalink
Update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dkorpel committed Nov 21, 2024
1 parent 3706959 commit 8a0e8fb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 34 deletions.
16 changes: 4 additions & 12 deletions compiler/test/runnable/imports/test23722b.d
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
struct A {
import core.stdc.stdio;
alias x = () {
printf("x\n");
};
alias y = () {
printf("y\n");
};
auto f(string s, alias g)() {
return true;
}

// do_x should call A.x (and print "x")
void do_x() {
A.x();
}
alias a = f!("a", output => output);
alias b = f!("b", output => true);
24 changes: 12 additions & 12 deletions compiler/test/runnable/mangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,11 @@ void test11776()
if (1)
{
auto s = S11776!(a => 1)();
static assert(typeof(s).mangleof ==
"S"~"6mangle"~tl!("56")~
enum expected = "S"~"6mangle"~tl!("56")~
("__T"~"6S11776"~"S"~tl!("42")~
(id!("6mangle","Qs")~"9test11776"~"FZ"~"9__lambda1MFZ"~id!("9__lambda1","Qn"))~"Z"
)~id!("6S11776", "QBm"));
(id!("6mangle","Qs")~"9test11776"~"FZ"~"17__lambda_L444_C14MFZ17__lambda_L450_C30")~"Z"
)~id!("6S11776", "QCm");
static assert(typeof(s).mangleof == expected);
}
};
}
Expand Down Expand Up @@ -509,21 +509,21 @@ void func12231a()()
if (is(typeof({
class C {}
static assert(C.mangleof ==
"C6mangle"~tl!("16")~"__U10func12231aZ"~id!("10func12231a","Qn")~"FZ9__lambda1MFZ1C");
"C6mangle"~tl!("16")~"__U10func12231aZ"~id!("10func12231a","Qn")~"FZ17__lambda_L509_C15MFZ1C");
// ### L #
})))
{}

void func12231b()()
if (is(typeof({
class C {} static assert(C.mangleof ==
"C6mangle"~tl!("16")~"__U10func12231bZ"~id!("10func12231b","Qn")~"FZ9__lambda1MFZ1C");
"C6mangle"~tl!("16")~"__U10func12231bZ"~id!("10func12231b","Qn")~"FZ17__lambda_L518_C15MFZ1C");
// L__L L LL
})) &&
is(typeof({
class C {}
static assert(C.mangleof ==
"C6mangle"~tl!("16")~"__U10func12231bZ"~id!("10func12231b","Qn")~"FZ9__lambda2MFZ1C");
"C6mangle"~tl!("16")~"__U10func12231bZ"~id!("10func12231b","Qn")~"FZ17__lambda_L523_C15MFZ1C");
// L__L L LL
})))
{}
Expand All @@ -532,14 +532,14 @@ void func12231c()()
if (is(typeof({
class C {}
static assert(C.mangleof ==
"C6mangle"~tl!("16")~"__U10func12231cZ"~id!("10func12231c","Qn")~"FZ9__lambda1MFZ1C");
"C6mangle"~tl!("16")~"__U10func12231cZ"~id!("10func12231c","Qn")~"FZ17__lambda_L532_C15MFZ1C");
// L__L L LL
})))
{
(){
class C {}
static assert(C.mangleof ==
"C6mangle"~tl!("16")~"__T10func12231cZ"~id!("10func12231c","Qn")~"FZ9__lambda1MFZ1C");
"C6mangle"~tl!("16")~"__T10func12231cZ"~id!("10func12231c","Qn")~"FZ16__lambda_L539_C5MFZ1C");
// L__L L LL
}();
}
Expand All @@ -548,14 +548,14 @@ void func12231c(X)()
if (is(typeof({
class C {}
static assert(C.mangleof ==
"C6mangle"~tl!("20")~"__U10func12231cTAyaZ"~id!("10func12231c","Qr")~"FZ9__lambda1MFZ1C");
"C6mangle"~tl!("20")~"__U10func12231cTAyaZ"~id!("10func12231c","Qr")~"FZ17__lambda_L548_C15MFZ1C");
// L__L L___L LL
})))
{
(){
class C {}
static assert(C.mangleof ==
"C6mangle"~tl!("20")~"__T10func12231cTAyaZ"~id!("10func12231c","Qr")~"FZ9__lambda1MFZ1C");
"C6mangle"~tl!("20")~"__T10func12231cTAyaZ"~id!("10func12231c","Qr")~"FZ16__lambda_L555_C5MFZ1C");
// L__L L___L LL
}();
}
Expand Down Expand Up @@ -616,7 +616,7 @@ static assert(funcd.mangleof == "_D6mangle5funcdFPFZNnZi");
struct S21753 { void function() f1; }
void fun21753(S21753 v)() {}
alias fl21753 = (){};
static assert((fun21753!(S21753(fl21753))).mangleof == "_D6mangle__T8fun21753VSQv6S21753S1f_DQBj10" ~ fl21753.stringof ~ "MFNaNbNiNfZvZQCbQp");
static assert((fun21753!(S21753(fl21753))).mangleof == "_D6mangle__T8fun21753VSQv6S21753S1f_DQBj16" ~ fl21753.stringof ~ "MFNaNbNiNfZvZQChQp");

/***************************************************/
void main()
Expand Down
10 changes: 3 additions & 7 deletions compiler/test/runnable/test23722.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
// Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code
import imports.test23722b;

// do_y should call A.y (and print "y")
void do_y() {
A.y();
bool f() {
return b;
}

extern (C) void main() {
do_y(); // should print y
do_x(); // should print x
}
void main() {}
4 changes: 2 additions & 2 deletions compiler/test/runnable/testkeyword.d
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void main(string[] args) nothrow

auto funcLiteral = (int x, int y)
{
enum thisFunc = "testkeyword.main.__lambda5";
enum thisFunc2 = "testkeyword.main.__lambda5(int x, int y)";
enum thisFunc = "testkeyword.main.__lambda_L98_C24";
enum thisFunc2 = "testkeyword.main.__lambda_L98_C24(int x, int y)";

static assert(getFuncArgFile() == thisFile);
static assert(getFuncArgLine() == 104);
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/runnable/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Creating library {{RESULTS_DIR}}/runnable/traits_0.lib and object {{RESULTS_DIR}
TRANSFORM_OUTPUT: remove_lines("Creating library")
TEST_OUTPUT:
---
__lambda1
__lambda_L1073_C5
---
*/

Expand Down

0 comments on commit 8a0e8fb

Please sign in to comment.