impl and tests for big recursive tag unions

This commit is contained in:
Folkert 2023-06-01 19:45:11 +02:00
parent f5578e71b6
commit e7791443e6
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 195 additions and 48 deletions

View file

@ -2171,7 +2171,7 @@ fn refcount_nullable_unwrapped_needing_no_refcount_issue_5027() {
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn issue_5162_recast_nested_nullable_unwrapped_layout() {
with_larger_debug_stack(|| {
assert_evals_to!(
@ -2199,7 +2199,7 @@ fn issue_5162_recast_nested_nullable_unwrapped_layout() {
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn nullable_wrapped_eq_issue_5434() {
assert_evals_to!(
indoc!(
@ -2228,3 +2228,78 @@ fn nullable_wrapped_eq_issue_5434() {
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_tag_id_in_allocation_basic() {
assert_evals_to!(
indoc!(
r###"
app "test" provides [main] to "./platform"
Value : [
A Value,
B I64,
C I64,
D I64,
E I64,
F I64,
G I64,
H I64,
I I64,
]
x : Value
x = H 42
main =
when x is
A _ -> "A"
B _ -> "B"
C _ -> "C"
D _ -> "D"
E _ -> "E"
F _ -> "F"
G _ -> "G"
H _ -> "H"
I _ -> "I"
"###
),
RocStr::from("H"),
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn recursive_tag_id_in_allocation_eq() {
assert_evals_to!(
indoc!(
r###"
app "test" provides [main] to "./platform"
Value : [
A Value,
B I64,
C I64,
D I64,
E I64,
F I64,
G I64,
H I64,
I I64,
]
x : Value
x = G 42
y : Value
y = H 42
main = (x == x) && (x != y) && (y == y)
"###
),
true,
bool
);
}