Files
kotlin-fork/compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt
T
Dmitriy Novozhilov ea2783eace [FIR] Fix generating this reference in delegated accessors
There was a problem with delegated extension property with dispatch
  receiver that `this` in `getValue` call was set to dispatch receiver
  instead of extension one
2021-02-20 18:27:43 +03:00

21 lines
306 B
Kotlin
Vendored

import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(t: F.A, p: KProperty<*>): Int = 1
}
class F {
val A.prop: Int by Delegate()
class A {
}
fun foo(): Int {
return A().prop
}
}
fun box(): String {
return if(F().foo() == 1) "OK" else "fail"
}