Special-case 2-branch if/else errors

This commit is contained in:
Richard Feldman 2020-04-03 01:51:42 -04:00
parent dc3e2d307c
commit 98f4f46248
6 changed files with 158 additions and 75 deletions

View file

@ -435,7 +435,10 @@ pub fn constrain_expr(
loc_body.region,
&loc_body.value,
ForReason(
Reason::IfBranch { index: index + 1 },
Reason::IfBranch {
index: index + 1,
total_branches: branches.len(),
},
Type::Variable(*branch_var),
loc_body.region,
),
@ -451,6 +454,7 @@ pub fn constrain_expr(
ForReason(
Reason::IfBranch {
index: branches.len() + 1,
total_branches: branches.len() + 1,
},
Type::Variable(*branch_var),
final_else.region,