Support bound variables in multiple patterns

This commit is contained in:
Ayaz Hafiz 2022-07-21 11:40:09 -04:00
parent bf8fc0d0de
commit ce8b50caea
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 59 additions and 4 deletions

View file

@ -3641,3 +3641,21 @@ fn recursive_call_capturing_function() {
i64
)
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn shared_pattern_variable_in_when_branches() {
assert_evals_to!(
indoc!(
r#"
f = \t ->
when t is
A x | B x -> x
{a: f (A 15u8), b: (B 31u8)}
"#
),
(15u8, 31u8),
(u8, u8)
);
}