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:
+31
@@ -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 }
|
||||
Reference in New Issue
Block a user