diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_ty/src/expr.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs index 19323fda1..1e7395b16 100644 --- a/crates/ra_hir_ty/src/expr.rs +++ b/crates/ra_hir_ty/src/expr.rs | |||
@@ -88,6 +88,11 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
88 | let mut seen = Matrix::empty(); | 88 | let mut seen = Matrix::empty(); |
89 | for pat in pats { | 89 | for pat in pats { |
90 | // We skip any patterns whose type we cannot resolve. | 90 | // We skip any patterns whose type we cannot resolve. |
91 | // | ||
92 | // This could lead to false positives in this diagnostic, so | ||
93 | // it might be better to skip the entire diagnostic if we either | ||
94 | // cannot resolve a match arm or determine that the match arm has | ||
95 | // the wrong type. | ||
91 | if let Some(pat_ty) = infer.type_of_pat.get(pat) { | 96 | if let Some(pat_ty) = infer.type_of_pat.get(pat) { |
92 | // We only include patterns whose type matches the type | 97 | // We only include patterns whose type matches the type |
93 | // of the match expression. If we had a InvalidMatchArmPattern | 98 | // of the match expression. If we had a InvalidMatchArmPattern |
@@ -97,6 +102,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
97 | // When comparing the types, we also have to consider that rustc | 102 | // When comparing the types, we also have to consider that rustc |
98 | // will automatically de-reference the match expression type if | 103 | // will automatically de-reference the match expression type if |
99 | // necessary. | 104 | // necessary. |
105 | // | ||
106 | // FIXME we should use the type checker for this. | ||
100 | if pat_ty == match_expr_ty | 107 | if pat_ty == match_expr_ty |
101 | || match_expr_ty | 108 | || match_expr_ty |
102 | .as_reference() | 109 | .as_reference() |