Add polymorphic expression reproduction cases from #1745

These work now that we have ways to compile polymorphic expressions.

Closes #1745
This commit is contained in:
Ayaz Hafiz 2022-08-17 17:02:45 -05:00
parent 34c3f266e0
commit d1c21e3fcd
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58
3 changed files with 63 additions and 0 deletions

View File

@ -3369,3 +3369,23 @@ fn issue_3530_uninitialized_capacity_in_list_literal() {
|(_, _, cap)| cap
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn list_let_generalization() {
assert_evals_to!(
indoc!(
r#"
empty : List a
empty = []
xs : List Str
xs = List.append empty "foo"
List.len xs
"#
),
1,
usize
);
}

View File

@ -4019,3 +4019,24 @@ fn mutually_recursive_captures() {
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn int_let_generalization() {
assert_evals_to!(
indoc!(
r#"
manyAux : {} -> I32
manyAux = \_ ->
output = \_ -> 42
output {}
when manyAux {} is
_ -> "done"
"#
),
RocStr::from("done"),
RocStr
);
}

View File

@ -1933,3 +1933,25 @@ fn issue_2165_recursive_tag_destructure() {
RocStr
)
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn tag_union_let_generalization() {
assert_evals_to!(
indoc!(
r#"
manyAux : {} -> [ Loop, Done ]
manyAux = \_ ->
output = Done
output
when manyAux {} is
Loop -> "loop"
Done -> "done"
"#
),
RocStr::from("done"),
RocStr
);
}