Add test when bound symbols differ in branch patterns, but no bound symbol is used

This commit is contained in:
Ayaz Hafiz 2022-07-22 16:51:44 -04:00
parent ee516eaa2f
commit ed6ee71225
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -3660,6 +3660,25 @@ fn shared_pattern_variable_in_when_branches() {
); );
} }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn symbol_not_bound_in_all_patterns_runs_when_no_bound_symbol_used() {
assert_evals_to!(
indoc!(
r#"
f = \t -> when t is
A x | B y -> 31u8
{a: f (A 15u8), b: f (B 15u8)}
"#
),
31u8,
u8,
|x| x,
true // allow errors
);
}
#[test] #[test]
#[ignore = "TODO currently fails in alias analysis because `B y` does not introduce `x`"] #[ignore = "TODO currently fails in alias analysis because `B y` does not introduce `x`"]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]