JVM_IR: prefer to move, not copy, suspend lambda bodies
Copying breaks reflection metadata.
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
// 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"
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// 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
|
||||
|
||||
fun box(): String {
|
||||
lateinit var x: (String) -> Unit
|
||||
suspend {
|
||||
x = { OK: String -> }
|
||||
}.startCoroutine(EmptyContinuation)
|
||||
return x.reflect()?.parameters?.singleOrNull()?.name ?: "null"
|
||||
}
|
||||
Reference in New Issue
Block a user