diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs index af23eb1f24..e14fcab869 100644 --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -724,11 +724,7 @@ pub fn constrain_expr( let branches_region = { debug_assert!(!branches.is_empty()); - Region::span_across( - &loc_cond.region, - // &branches.first().unwrap().region(), - &branches.last().unwrap().pattern_region(), - ) + Region::span_across(&loc_cond.region, &branches.last().unwrap().value.region) }; let branch_expr_reason = diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs index c83dc2cbdd..eabf05faf1 100644 --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -10375,6 +10375,7 @@ All branches in an `if` must have the same type! 8│ Ok "foo" 9│ 10│ Bad _ -> + 11│ Ok "foo" This `u8` value is a: