Files
kotlin-fork/compiler/testData/codegen/box/reflection/properties/localDelegated/inLambdaInInline.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

21 lines
395 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WITH_REFLECT
// FILE: 1.kt
package test
import kotlin.reflect.*
inline operator fun String.getValue(t:Any?, p: KProperty<*>): String =
if (p.returnType.classifier == String::class) this else "fail"
inline fun foo(crossinline f: () -> String) = {
val x by f()
x
}.let { it() }
// FILE: 2.kt
import test.*
fun box() = foo { "OK" }