From 7d256067f9de22aa01e044f536d3558dfc87d964 Mon Sep 17 00:00:00 2001 From: Folkert Date: Mon, 12 Jul 2021 17:40:49 +0200 Subject: [PATCH] allow multiple guards in the same pattern --- compiler/mono/src/exhaustive.rs | 2 +- compiler/test_gen/src/gen_tags.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/mono/src/exhaustive.rs b/compiler/mono/src/exhaustive.rs index 4170015a7b..e9804e2c27 100644 --- a/compiler/mono/src/exhaustive.rs +++ b/compiler/mono/src/exhaustive.rs @@ -353,7 +353,7 @@ fn to_nonredundant_rows( vec![simplify(&loc_pat.value)] }; - if is_useful(checked_rows.clone(), next_row.clone()) { + if any_has_guard || is_useful(checked_rows.clone(), next_row.clone()) { checked_rows.push(next_row); } else { return Err(Error::Redundant { diff --git a/compiler/test_gen/src/gen_tags.rs b/compiler/test_gen/src/gen_tags.rs index 40e5403914..74b8da70ec 100644 --- a/compiler/test_gen/src/gen_tags.rs +++ b/compiler/test_gen/src/gen_tags.rs @@ -502,7 +502,6 @@ fn when_on_single_value_tag() { } #[test] -#[ignore] fn if_guard_multiple() { assert_evals_to!( indoc!(