31f9e9e7a8
#KT-62305 fixed NB: kotlin reflection do not see script class constructor after this change, and it's ok, since the fact that the script is compiled into a class is an implementation detail. If needed, java reflection could be used to access the constructor.
18 lines
348 B
Kotlin
Vendored
18 lines
348 B
Kotlin
Vendored
// WITH_REFLECT
|
|
|
|
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
|