add fixme to use type checker rather than manually comparing types

This commit is contained in:
Josh Mcguigan 2020-04-07 05:17:59 -07:00
parent a208de15b7
commit 9fc1f51b7a

View file

@ -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()