FIR: Fix incorrect resolution to synthetic property by implicit receiver

When there's an explicit one

^KT-39028 Fixed
This commit is contained in:
Denis Zharkov
2020-06-10 16:24:09 +03:00
parent 293f78efe8
commit 5ab05e6e47
5 changed files with 67 additions and 3 deletions
@@ -0,0 +1,21 @@
// !CHECK_TYPE
// FILE: JavaClass.java
public class JavaClass {
public String getFoo() {
return "";
}
}
// FILE: main.kt
interface A
val A.foo: Int get() = 1
fun bar(a: A) {
a.foo checkType { _<Int>() } // OK, resolved to extension property
}
fun JavaClass.bar(a: A) {
a.foo checkType { _<Int>() }
}
@@ -0,0 +1,33 @@
FILE: main.kt
public abstract interface A : R|kotlin/Any| {
}
public final val R|A|.foo: R|kotlin/Int|
public get(): R|kotlin/Int| {
^ Int(1)
}
public final fun bar(a: R|A|): R|kotlin/Unit| {
R|<local>/a|.R|/foo|.R|tests/_checkType/checkType|<R|kotlin/Int|>(checkType@fun R|tests/_checkType/Inv<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| {
this@R|special/anonymous|.R|tests/_checkType/_|<R|kotlin/Int|>()
}
)
}
public final fun R|JavaClass|.bar(a: R|A|): R|kotlin/Unit| {
R|<local>/a|.R|/foo|.R|tests/_checkType/checkType|<R|kotlin/Int|>(checkType@fun R|tests/_checkType/Inv<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| {
this@R|special/anonymous|.R|tests/_checkType/_|<R|kotlin/Int|>()
}
)
}
FILE: CHECK_TYPE.kt
public final fun <T> checkSubtype(t: R|T|): R|T| {
^checkSubtype R|<local>/t|
}
public final class Inv<T> : R|kotlin/Any| {
public constructor<T>(): R|tests/_checkType/Inv<T>| {
super<R|kotlin/Any|>()
}
}
public final fun <E> R|tests/_checkType/Inv<E>|._(): R|kotlin/Unit| {
}
public final infix fun <T> R|T|.checkType(f: R|tests/_checkType/Inv<T>.() -> kotlin/Unit|): R|kotlin/Unit| {
}