From ed6ee71225840e1941447605aaf7d8a33b38d2fe Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Fri, 22 Jul 2022 16:51:44 -0400 Subject: [PATCH] Add test when bound symbols differ in branch patterns, but no bound symbol is used --- .../compiler/test_gen/src/gen_primitives.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/compiler/test_gen/src/gen_primitives.rs b/crates/compiler/test_gen/src/gen_primitives.rs index 6759455af4..b4a450856c 100644 --- a/crates/compiler/test_gen/src/gen_primitives.rs +++ b/crates/compiler/test_gen/src/gen_primitives.rs @@ -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] #[ignore = "TODO currently fails in alias analysis because `B y` does not introduce `x`"] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]