JVM_IR KT-46597 fix receiver type for inlined callable reference

Receiver type is used by SyntheticAccessorLowering to determine class in
which a synthetic accessor should be generated.
This commit is contained in:
Dmitry Petrov
2021-05-17 15:56:41 +03:00
committed by TeamCityServer
parent 80ce3a5cf8
commit 3a0e3798ec
23 changed files with 612 additions and 60 deletions
@@ -0,0 +1,21 @@
// TARGET_BACKEND: JVM
// FILE: a/Base.java
package a;
public class Base {
protected String property = "OK";
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() =
higherOrder(::property)
inline fun higherOrder(crossinline lambda: () -> String) =
lambda()
}
fun box() = SubClass().call()
@@ -0,0 +1,24 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// FILE: a.kt
package a
abstract class Base {
@JvmField
protected val property = "OK"
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() =
higherOrder(::property)
inline fun higherOrder(crossinline lambda: () -> String) =
lambda()
}
fun box() = SubClass().call()
@@ -0,0 +1,21 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: a.kt
package a
abstract class Base {
protected fun method() = "OK"
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() =
higherOrder(::method)
inline fun higherOrder(crossinline lambda: () -> String) =
lambda()
}
fun box() = SubClass().call()
@@ -0,0 +1,22 @@
// IGNORE_BACKEND: WASM
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: a.kt
package a
abstract class Base {
protected val property get() = "OK"
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() =
higherOrder(::property)
inline fun higherOrder(crossinline lambda: () -> String) =
lambda()
}
fun box() = SubClass().call()
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: a/Base.java
package a;
public class Base {
protected String property = "OK";
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() = ::property
}
fun box() = SubClass().call().invoke()
@@ -0,0 +1,19 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: a.kt
package a
abstract class Base {
@JvmField
protected val property = "OK"
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() = ::property
}
fun box() = SubClass().call().invoke()
@@ -0,0 +1,17 @@
// IGNORE_BACKEND: WASM
// FILE: a.kt
package a
abstract class Base {
protected fun method() = "OK"
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() = ::method
}
fun box() = SubClass().call().invoke()
@@ -0,0 +1,17 @@
// IGNORE_BACKEND: WASM
// FILE: a.kt
package a
abstract class Base {
protected val property get() = "OK"
}
// FILE: b.kt
import a.Base
class SubClass : Base() {
fun call() = ::property
}
fun box() = SubClass().call().invoke()