mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
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.
This commit is contained in:
parent
a5d85a6356
commit
34a3bc4196
2 changed files with 4 additions and 2 deletions
|
@ -505,9 +505,10 @@ impl<'db> SemanticsImpl<'db> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> {
|
fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> {
|
||||||
// FIXME: this erases Substs
|
// FIXME: this erases Substs, we should instead record the correct
|
||||||
|
// substitution during inference and use that
|
||||||
let func = self.resolve_method_call(call)?;
|
let func = self.resolve_method_call(call)?;
|
||||||
let (ty, _) = self.db.value_ty(func.into()).into_value_and_skipped_binders();
|
let ty = hir_ty::TyBuilder::value_ty(self.db, func.into()).fill_with_unknown().build();
|
||||||
let resolver = self.analyze(call.syntax()).resolver;
|
let resolver = self.analyze(call.syntax()).resolver;
|
||||||
let ty = Type::new_with_resolver(self.db, &resolver, ty)?;
|
let ty = Type::new_with_resolver(self.db, &resolver, ty)?;
|
||||||
let mut res = ty.as_callable(self.db)?;
|
let mut res = ty.as_callable(self.db)?;
|
||||||
|
|
|
@ -480,6 +480,7 @@ impl S {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
|
me foo() fn(&self) -> &[u8]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue