Files
kotlin-fork/compiler/testData/codegen/box/reflection/lambdaClasses/reflectOnLambdaInSuspend.kt
T
pyos 06408011f0 JVM_IR: prefer to move, not copy, suspend lambda bodies
Copying breaks reflection metadata.
2020-02-07 12:16:26 +01:00

20 lines
415 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_COROUTINES
// FILE: a.kt
import helpers.*
import kotlin.coroutines.*
import kotlin.reflect.jvm.reflect
suspend fun f() = { OK: String -> }
fun box(): String {
lateinit var x: (String) -> Unit
suspend {
x = f()
}.startCoroutine(EmptyContinuation)
return x.reflect()?.parameters?.singleOrNull()?.name ?: "null"
}