forked from rust-lang/rust-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for rust-lang#17497 - Invalid RA diagnostic error: expected 2 arg…
…uments, found 1 Also fixes rust-lang#17233 The issue occurs because in some configurations of traits where one of them has Deref as a supertrait, RA's type inference algorithm fails to fully resolve a trait's self type, and instead uses a TyKind::BoundVar. This then erroneously matches with types that do not implement the trait. In other words, unconnected types appear to inherit the trait's methods. The fix is to insert a heuristic when invoking lookup_method() that allows the caller to determine if the returned method is a good match. If the returned method would result in diagnostic errors, the caller instructs the algorithm to continue iterating the possible methods to see if a better one exists (i.e. one that won't result in diagnostic errors). Includes a unit test that only passes after applying the fixes in this commit.
- Loading branch information
Showing
3 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters