From 9fc1f51b7ade2cda7d410450ab1347311eb074af Mon Sep 17 00:00:00 2001 From: Josh Mcguigan Date: Tue, 7 Apr 2020 05:17:59 -0700 Subject: add fixme to use type checker rather than manually comparing types --- crates/ra_hir_ty/src/expr.rs | 7 +++++++ 1 file changed, 7 insertions(+) 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> { let mut seen = Matrix::empty(); for pat in pats { // We skip any patterns whose type we cannot resolve. + // + // This could lead to false positives in this diagnostic, so + // it might be better to skip the entire diagnostic if we either + // cannot resolve a match arm or determine that the match arm has + // the wrong type. if let Some(pat_ty) = infer.type_of_pat.get(pat) { // We only include patterns whose type matches the type // of the match expression. If we had a InvalidMatchArmPattern @@ -97,6 +102,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { // When comparing the types, we also have to consider that rustc // will automatically de-reference the match expression type if // necessary. + // + // FIXME we should use the type checker for this. if pat_ty == match_expr_ty || match_expr_ty .as_reference() -- cgit v1.2.3