internal: Handle fields called as method calls as the fields they resolve to

This commit is contained in:
Lukas Wirth 2023-03-04 20:33:28 +01:00
parent b85e2af898
commit 5a91f015b4
4 changed files with 63 additions and 4 deletions

View file

@ -469,9 +469,12 @@ impl NameRefClass {
match_ast! {
match parent {
ast::MethodCallExpr(method_call) => {
sema.resolve_method_call(&method_call)
.map(Definition::Function)
.map(NameRefClass::Definition)
sema.resolve_method_call_field_fallback(&method_call)
.map(|it| {
it.map_left(Definition::Function)
.map_right(Definition::Field)
.either(NameRefClass::Definition, NameRefClass::Definition)
})
},
ast::FieldExpr(field_expr) => {
sema.resolve_field(&field_expr)