diff options
author | Florian Diebold <[email protected]> | 2020-02-11 20:07:18 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-02-11 20:09:11 +0000 |
commit | 43df7c3d53198e8ae3509035eb5273d8a94f758b (patch) | |
tree | b6181771c1b322d5a5acf6d6b1aa67c2bfaaedec /crates/ra_hir_ty/src/infer | |
parent | 00e672a51b0caec9e2bb7004281ce2f57bdbefe5 (diff) |
Don't let unknown match arms fall back to !
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 186857b8b..39d8bc0ca 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -165,7 +165,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
165 | Expr::Match { expr, arms } => { | 165 | Expr::Match { expr, arms } => { |
166 | let input_ty = self.infer_expr(*expr, &Expectation::none()); | 166 | let input_ty = self.infer_expr(*expr, &Expectation::none()); |
167 | 167 | ||
168 | let mut result_ty = self.table.new_maybe_never_type_var(); | 168 | let mut result_ty = if arms.len() == 0 { |
169 | Ty::simple(TypeCtor::Never) | ||
170 | } else { | ||
171 | self.table.new_type_var() | ||
172 | }; | ||
169 | 173 | ||
170 | for arm in arms { | 174 | for arm in arms { |
171 | let _pat_ty = self.infer_pat(arm.pat, &input_ty, BindingMode::default()); | 175 | let _pat_ty = self.infer_pat(arm.pat, &input_ty, BindingMode::default()); |