Files
kotlin-fork/compiler/testData/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt
T
2018-06-28 12:26:41 +02:00

15 lines
401 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
import kotlin.reflect.KProperty
class Delegate(val value: String) {
operator fun provideDelegate(instance: A, property: KProperty<*>): Delegate = Delegate(instance.value)
operator fun getValue(instance: Any?, property: KProperty<*>) = value
}
class A(val value: String) {
val result: String by Delegate("Fail")
}
fun box(): String {
return A("OK").result
}