JVM_IR: prefer to move, not copy, suspend lambda bodies

Copying breaks reflection metadata.
This commit is contained in:
pyos
2020-02-06 16:00:17 +01:00
committed by Ilmir Usmanov
parent 5acb3e14fb
commit 06408011f0
7 changed files with 111 additions and 62 deletions
@@ -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"
}
@@ -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"
}