JVM_IR: do not box inline classes in suspend multifile bridges
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
// TARGET_PLATFORM: JVM
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// FILE: a.kt
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("A")
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I(val x: Any?)
|
||||
|
||||
suspend fun <T> suspendHere(x: T): T = suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(x)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun f(): I = I(suspendHere("OK"))
|
||||
|
||||
// FILE: z.kt
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
suspend { result = f().x as String }.startCoroutine(EmptyContinuation)
|
||||
return result
|
||||
}
|
||||
+3
-6
@@ -8,16 +8,13 @@ import kotlin.coroutines.intrinsics.*
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I(val x: Any?)
|
||||
|
||||
suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { c ->
|
||||
c.resume(Unit)
|
||||
suspend fun <T> suspendHere(x: T): T = suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(x)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
class C {
|
||||
private suspend fun f(): I {
|
||||
suspendHere()
|
||||
return I("OK")
|
||||
}
|
||||
private suspend fun f(): I = I(suspendHere("OK"))
|
||||
|
||||
fun g() = suspend { f() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user