Reproduce miscompilation in #4685

This commit is contained in:
Ayaz Hafiz 2022-12-05 13:14:32 -06:00
parent 3399fe10a0
commit b6a96ebb85
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,24 @@
procedure Test.0 ():
let Test.8 : Str = "";
let Test.1 : List Str = Array [Test.8];
joinpoint Test.6:
let Test.4 : Str = "C";
ret Test.4;
in
joinpoint Test.5:
let Test.3 : Str = "B";
ret Test.3;
in
let Test.7 : U64 = lowlevel ListLen Test.1;
dec Test.1;
switch Test.7:
case 0:
let Test.2 : Str = "A";
ret Test.2;
case 1:
jump Test.5;
default:
jump Test.5;

View file

@ -2120,3 +2120,17 @@ fn toplevel_accessor_fn_thunk() {
"#
)
}
#[mono_test]
fn list_one_vs_one_spread_issue_4685() {
indoc!(
r#"
app "test" provides [main] to "./platform"
main = when [""] is
[] -> "A"
[_] -> "B"
[_, ..] -> "C"
"#
)
}