FIR IDE: fix property accessor resolution

For property access with implicit receiver, the resolved fir is a
FirPropertyAccessExpression and hence we need to handle it in
KtFirCallResolver.
This commit is contained in:
Tianyu Geng
2021-10-28 16:06:14 -07:00
committed by Ilya Kirillov
parent 1a22124c02
commit a8ae704c0c
10 changed files with 84 additions and 3 deletions
@@ -0,0 +1,9 @@
// FILE: call.kt
fun JavaClass.call() {
<expr>foo</expr>
}
// FILE: JavaClass.java
class JavaClass {
int getFoo() { return 42; }
}
@@ -0,0 +1,4 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = /JavaClass.getFoo(<dispatch receiver>: JavaClass): kotlin.Int
substitutor = <empty substitutor>
@@ -0,0 +1,11 @@
// FILE: call.kt
fun JavaClass.call() {
<expr>foo</expr> = 42
}
// FILE: JavaClass.java
class JavaClass {
private int foo = -1;
int getFoo() { return foo; }
void setFoo(int v) { foo = v; }
}
@@ -0,0 +1,4 @@
KtFunctionCall:
argumentMapping = { 42 -> (v: kotlin.Int) }
targetFunction = /JavaClass.setFoo(<dispatch receiver>: JavaClass, v: kotlin.Int): kotlin.Unit
substitutor = <empty substitutor>
@@ -0,0 +1,7 @@
class A {
val i: Int = 1
}
fun A.foo() {
<expr>i</expr>
}
@@ -0,0 +1,4 @@
KtFunctionCall:
argumentMapping = { }
targetFunction = <getter>(): kotlin.Int
substitutor = <empty substitutor>
@@ -0,0 +1,7 @@
class A {
var i: Int = 1
}
fun A.foo() {
<expr>i</expr> = 1
}
@@ -0,0 +1,4 @@
KtFunctionCall:
argumentMapping = { 1 -> (value: kotlin.Int) }
targetFunction = <setter>(value: kotlin.Int): kotlin.Unit
substitutor = <empty substitutor>