Files
kotlin-fork/compiler/testData/codegen/box/reflection/properties/localDelegated/inlineFun.kt
T
vladislav.grechko a6e45f9b59 Find correct class owner for inlined local delegated properties
Note that call-site class has no metadata for inlined local delegated
properties. Thus, for an inlined local delegated property we should
obtain declaration-site class as owner - otherwise, the corresponding
`PropertyReference` will have an owner without property metadata.
2023-06-29 17:44:25 +02:00

27 lines
466 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.*
import kotlin.test.assertEquals
object Delegate {
lateinit var property: KProperty<*>
operator fun getValue(instance: Any?, kProperty: KProperty<*>) {
property = kProperty
}
}
class Foo {
inline fun foo() {
val x by Delegate
x
}
}
fun box(): String {
Foo().foo()
assertEquals("val x: kotlin.Unit", Delegate.property.toString())
return "OK"
}