JVM_IR: resolve fake overrides of inline delegated property operators

before checking whether they use the KProperty parameter. (Otherwise the
body is empty and the check always says that the parameter is unused.)

^KT-48825 Fixed
This commit is contained in:
pyos
2021-09-20 16:29:31 +02:00
committed by Alexander Udalov
parent e9d5d9da48
commit 783c3d1500
9 changed files with 71 additions and 1 deletions
@@ -0,0 +1,31 @@
// IGNORE_BACKEND: JVM
// MODULE: lib
// FILE: lib.kt
import kotlin.reflect.KProperty
open class A {
inline operator fun Int.getValue(thisRef: Any?, property: KProperty<*>): String =
property.name
}
// MODULE: main(lib)
// FILE: main.kt
import kotlin.reflect.KProperty
open class B : A() {
var result = "fail"
inline operator fun String.getValue(thisRef: Any?, property: KProperty<*>): String =
property.name
inline operator fun String.setValue(thisRef: Any?, property: KProperty<*>, value: String) {
result = this + property.name
}
}
class C : B() {
val O by 1
var K by O
}
fun box() = C().run { K = "..."; result }