Files
kotlin-fork/compiler/testData/codegen/script/localDelegatedPropertyInLambda.kts
T
2023-12-26 10:18:19 +00:00

19 lines
390 B
Kotlin
Vendored

// WITH_REFLECT
// JVM_ABI_K1_K2_DIFF: KT-63960, KT-63963
import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(t: Any?, p: KProperty<*>): String =
if (p.returnType.toString() == "kotlin.String") "OK" else "Fail: ${p.returnType}"
}
fun f(lambda: () -> String): String = lambda()
val x = f {
val prop: String by Delegate()
prop
}
// expected: x: OK