mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Fallback to method resolution on unresolved field access with matching method name
This commit is contained in:
parent
9c3de09f6d
commit
35fbc0210c
5 changed files with 140 additions and 72 deletions
|
@ -492,7 +492,7 @@ impl NameRefClass {
|
|||
match_ast! {
|
||||
match parent {
|
||||
ast::MethodCallExpr(method_call) => {
|
||||
sema.resolve_method_call_field_fallback(&method_call)
|
||||
sema.resolve_method_call_fallback(&method_call)
|
||||
.map(|it| {
|
||||
it.map_left(Definition::Function)
|
||||
.map_right(Definition::Field)
|
||||
|
@ -500,9 +500,12 @@ impl NameRefClass {
|
|||
})
|
||||
},
|
||||
ast::FieldExpr(field_expr) => {
|
||||
sema.resolve_field(&field_expr)
|
||||
.map(Definition::Field)
|
||||
.map(NameRefClass::Definition)
|
||||
sema.resolve_field_fallback(&field_expr)
|
||||
.map(|it| {
|
||||
it.map_left(Definition::Field)
|
||||
.map_right(Definition::Function)
|
||||
.either(NameRefClass::Definition, NameRefClass::Definition)
|
||||
})
|
||||
},
|
||||
ast::RecordPatField(record_pat_field) => {
|
||||
sema.resolve_record_pat_field(&record_pat_field)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue