Files
kotlin-fork/compiler/testData/codegen/box/reflection/properties/localDelegated/localAndNonLocal.kt
T
pyos 6c68474489 JVM_IR: use correct signatures for local delegated property references
Which is `<v#N>` where N is the index of that property in the containing
class.
2019-03-19 12:00:29 +01:00

35 lines
647 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.KProperty
object Delegate {
operator fun getValue(thiz: Any?, property: KProperty<*>): String {
return property.name + ":" + property.returnType
}
}
class C {
val a by Delegate
fun test(): String {
if (a != "a:kotlin.String") return "Fail a: $a"
val b by Delegate
if (b != "b:kotlin.String") return "Fail b: $b"
return "OK"
}
}
val x by Delegate
fun box(): String {
if (x != "x:kotlin.String") return "Fail x: $x"
val y by Delegate
if (y != "y:kotlin.String") return "Fail y: $y"
return C().test()
}