File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
ide_completion/src/completions Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -2504,9 +2504,8 @@ impl Type {
2504
2504
2505
2505
pub fn autoderef < ' a > ( & ' a self , db : & ' a dyn HirDatabase ) -> impl Iterator < Item = Type > + ' a {
2506
2506
// There should be no inference vars in types passed here
2507
- // FIXME check that?
2508
- let canonical =
2509
- Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( & Interner ) } ;
2507
+ let ty = hir_ty:: replace_errors_with_variables ( & self . ty ) . value ;
2508
+ let canonical = Canonical { value : ty, binders : CanonicalVarKinds :: empty ( & Interner ) } ;
2510
2509
let environment = self . env . env . clone ( ) ;
2511
2510
let ty = InEnvironment { goal : canonical, environment } ;
2512
2511
autoderef ( db, Some ( self . krate ) , ty)
@@ -2600,10 +2599,7 @@ impl Type {
2600
2599
callback : & mut dyn FnMut ( & Ty , AssocItemId ) -> ControlFlow < ( ) > ,
2601
2600
) {
2602
2601
// There should be no inference vars in types passed here
2603
- // FIXME check that?
2604
- // FIXME replace Unknown by bound vars here
2605
- let canonical =
2606
- Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( & Interner ) } ;
2602
+ let canonical = hir_ty:: replace_errors_with_variables ( & self . ty ) ;
2607
2603
2608
2604
let env = self . env . clone ( ) ;
2609
2605
let krate = krate. id ;
Original file line number Diff line number Diff line change @@ -697,4 +697,26 @@ fn f() {
697
697
"# ] ] ,
698
698
) ;
699
699
}
700
+
701
+ #[ test]
702
+ fn completes_method_call_when_receiver_type_has_errors_issue_10297 ( ) {
703
+ check (
704
+ r#"
705
+ //- minicore: iterator, sized
706
+ struct Vec<T>;
707
+ impl<T> IntoIterator for Vec<T> {
708
+ type Item = ();
709
+ type IntoIter = ();
710
+ fn into_iter(self);
711
+ }
712
+ fn main() {
713
+ let x: Vec<_>;
714
+ x.$0;
715
+ }
716
+ "# ,
717
+ expect ! [ [ r#"
718
+ me into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
719
+ "# ] ] ,
720
+ )
721
+ }
700
722
}
You can’t perform that action at this time.
0 commit comments