aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r--crates/ra_hir/src/ty/infer.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index dc7101075..b310bf6bd 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -1096,8 +1096,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1096 } 1096 }
1097 let arm_ty = self.infer_expr(arm.expr, &expected); 1097 let arm_ty = self.infer_expr(arm.expr, &expected);
1098 if all_arms_never && Self::is_never(&arm_ty) { 1098 if all_arms_never && Self::is_never(&arm_ty) {
1099 tested_by!(match_first_arm_never);
1099 resulting_match_ty = Some(arm_ty); 1100 resulting_match_ty = Some(arm_ty);
1100 } else { 1101 } else {
1102 tested_by!(match_second_arm_never);
1101 all_arms_never = false; 1103 all_arms_never = false;
1102 resulting_match_ty = None; 1104 resulting_match_ty = None;
1103 } 1105 }
@@ -1106,10 +1108,13 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1106 if let (Ty::Infer(expected_tv), Some(match_ty)) = 1108 if let (Ty::Infer(expected_tv), Some(match_ty)) =
1107 (&expected.ty, &resulting_match_ty) 1109 (&expected.ty, &resulting_match_ty)
1108 { 1110 {
1111 tested_by!(match_all_arms_never);
1109 self.var_unification_table 1112 self.var_unification_table
1110 .union_value(expected_tv.to_inner(), TypeVarValue::Known(match_ty.clone())); 1113 .union_value(expected_tv.to_inner(), TypeVarValue::Known(match_ty.clone()));
1111 match_ty.clone() 1114 match_ty.clone()
1112 } else { 1115 } else {
1116 tested_by!(match_no_never_arms);
1117 tested_by!(match_complex_arm_ty);
1113 expected.ty 1118 expected.ty
1114 } 1119 }
1115 } 1120 }