Skip to content

Commit 12624d6

Browse files
committed
Use expr pass for positive soundness tests
The soundness check operates at the expr pass level. Positive tests don't need LLVM codegen to verify the check doesn't reject valid code. Stop at "expr" instead of "ir" to avoid hitting a pre-existing LLVM 21 codegen crash in genprim_string_serialise that only manifests in CI debug builds. Also reverts the Foo workaround — with expr pass, String iso tests work correctly.
1 parent ff74b3b commit 12624d6

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

test/libponyc/badpony.cc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,19 +1472,16 @@ TEST_F(BadPonyTest, MatchIsoCaptureWithConsume)
14721472
// From issue #3596
14731473
// Consuming the match expression makes the discriminee ephemeral,
14741474
// so iso captures are sound.
1475-
// Uses a custom class instead of String to avoid hitting an unrelated
1476-
// LLVM 21 codegen issue in genprim_string_serialise.
14771475
const char* src =
1478-
"class Foo\n"
1479-
14801476
"actor Main\n"
14811477
" new create(env: Env) =>\n"
1482-
" let x: Foo iso = recover iso Foo end\n"
1478+
" let x: String iso = recover iso String end\n"
14831479
" match consume x\n"
1484-
" | let y: Foo iso => None\n"
1480+
" | let y: String iso => None\n"
14851481
" end";
14861482

1487-
TEST_COMPILE(src);
1483+
// Soundness check is in the expr pass; stop before codegen.
1484+
DO(test_compile(src, "expr"));
14881485
}
14891486

14901487
TEST_F(BadPonyTest, MatchNonIsoCaptureFromUnion)
@@ -1500,7 +1497,8 @@ TEST_F(BadPonyTest, MatchNonIsoCaptureFromUnion)
15001497
" | let s: String => None\n"
15011498
" end";
15021499

1503-
TEST_COMPILE(src);
1500+
// Soundness check is in the expr pass; stop before codegen.
1501+
DO(test_compile(src, "expr"));
15041502
}
15051503

15061504
TEST_F(BadPonyTest, MatchViewpointRefCaptureFromField)
@@ -1522,7 +1520,8 @@ TEST_F(BadPonyTest, MatchViewpointRefCaptureFromField)
15221520
"actor Main\n"
15231521
" new create(env: Env) => None";
15241522

1525-
TEST_COMPILE(src);
1523+
// Soundness check is in the expr pass; stop before codegen.
1524+
DO(test_compile(src, "expr"));
15261525
}
15271526

15281527
TEST_F(BadPonyTest, MatchValConstraintCapture)
@@ -1544,7 +1543,8 @@ TEST_F(BadPonyTest, MatchValConstraintCapture)
15441543
"actor Main\n"
15451544
" new create(env: Env) => None";
15461545

1547-
TEST_COMPILE(src);
1546+
// Soundness check is in the expr pass; stop before codegen.
1547+
DO(test_compile(src, "expr"));
15481548
}
15491549

15501550
TEST_F(BadPonyTest, MatchAliasedViewpointCapture)
@@ -1568,5 +1568,6 @@ TEST_F(BadPonyTest, MatchAliasedViewpointCapture)
15681568
"actor Main\n"
15691569
" new create(env: Env) => None";
15701570

1571-
TEST_COMPILE(src);
1571+
// Soundness check is in the expr pass; stop before codegen.
1572+
DO(test_compile(src, "expr"));
15721573
}

0 commit comments

Comments
 (0)