mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-14 17:59:56 +00:00
Use resolve_method_call_as_callable to handle function types
This commit is contained in:
parent
afde04b443
commit
e8a63e43b1
1 changed files with 3 additions and 2 deletions
|
|
@ -145,8 +145,9 @@ fn find_definition_for_known_blanket_dual_impls(
|
||||||
// - return_type is B (type of b)
|
// - return_type is B (type of b)
|
||||||
// We will find the definition of B::from(a: A).
|
// We will find the definition of B::from(a: A).
|
||||||
let method_call = ast::MethodCallExpr::cast(original_token.parent()?.parent()?)?;
|
let method_call = ast::MethodCallExpr::cast(original_token.parent()?.parent()?)?;
|
||||||
let receiver_type = sema.type_of_expr(&method_call.receiver()?)?.adjusted();
|
let callable = sema.resolve_method_call_as_callable(&method_call)?;
|
||||||
let return_type = sema.type_of_expr(&method_call.clone().into())?.original();
|
let (_, receiver_type) = callable.receiver_param(db)?;
|
||||||
|
let return_type = callable.return_type();
|
||||||
|
|
||||||
let (search_method, search_trait, return_type) = match method_call.name_ref()?.text().as_str() {
|
let (search_method, search_trait, return_type) = match method_call.name_ref()?.text().as_str() {
|
||||||
"into" => ("from", FamousDefs(sema, krate).core_convert_From()?, return_type),
|
"into" => ("from", FamousDefs(sema, krate).core_convert_From()?, return_type),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue