mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-20 15:27:45 +03:00
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:
parent
34c3f266e0
commit
d1c21e3fcd
@ -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
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user