Files
kotlin-fork/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt48825.kt
T
pyos 783c3d1500 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
2021-09-21 18:08:22 +02:00

32 lines
676 B
Kotlin
Vendored

// 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 }