mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
add fixme to use type checker rather than manually comparing types
This commit is contained in:
parent
a208de15b7
commit
9fc1f51b7a
1 changed files with 7 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue