aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-05-23 12:00:14 +0100
committerFlorian Diebold <[email protected]>2021-05-23 12:00:14 +0100
commit34a3bc4196db302ea5b31c51b6d555336965be5f (patch)
treef5de0f14403a7ff9df56abbfb347c651ade11a92 /crates
parenta5d85a6356dc761d047f46bf04eae09dc9ab80f9 (diff)
Paper over #8931 a bit more
The problem was the skipping of binders in `resolve_method_call_as_callable`; this still doesn't use the _correct_ substitution, but at least it doesn't return a type with free variables in it. Fixes #8931.
Diffstat (limited to 'crates')
-rw-r--r--crates/hir/src/semantics.rs5
-rw-r--r--crates/ide_completion/src/completions/dot.rs1
2 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 38bd376bc..1b5064b5a 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -505,9 +505,10 @@ impl<'db> SemanticsImpl<'db> {
505 } 505 }
506 506
507 fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> { 507 fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> {
508 // FIXME: this erases Substs 508 // FIXME: this erases Substs, we should instead record the correct
509 // substitution during inference and use that
509 let func = self.resolve_method_call(call)?; 510 let func = self.resolve_method_call(call)?;
510 let (ty, _) = self.db.value_ty(func.into()).into_value_and_skipped_binders(); 511 let ty = hir_ty::TyBuilder::value_ty(self.db, func.into()).fill_with_unknown().build();
511 let resolver = self.analyze(call.syntax()).resolver; 512 let resolver = self.analyze(call.syntax()).resolver;
512 let ty = Type::new_with_resolver(self.db, &resolver, ty)?; 513 let ty = Type::new_with_resolver(self.db, &resolver, ty)?;
513 let mut res = ty.as_callable(self.db)?; 514 let mut res = ty.as_callable(self.db)?;
diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs
index 1bff55936..fd9738743 100644
--- a/crates/ide_completion/src/completions/dot.rs
+++ b/crates/ide_completion/src/completions/dot.rs
@@ -480,6 +480,7 @@ impl S {
480} 480}
481 "#, 481 "#,
482 expect![[r#" 482 expect![[r#"
483 me foo() fn(&self) -> &[u8]
483 "#]], 484 "#]],
484 ); 485 );
485 } 486 }