783c3d1500
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
32 lines
676 B
Kotlin
Vendored
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 }
|