JVM_IR: expect unboxed return value from suspend default stubs

#KT-47206 Fixed
This commit is contained in:
pyos
2021-06-10 09:51:48 +02:00
committed by TeamCityServer
parent 578fcf2ebf
commit cf660cf24a
12 changed files with 133 additions and 30 deletions
@@ -0,0 +1,21 @@
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(Continuation(EmptyCoroutineContext) {
it.getOrThrow()
})
}
inline class IC(val s: String)
suspend fun foo(x: String = "OK") = IC(x)
fun box(): String {
var res = ""
builder {
res = foo().s
}
return res
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
inline class IC(val s: String)
suspend fun foo(x: String = "OK") = suspendCoroutineUninterceptedOrReturn<IC> {
it.resume(IC(x))
COROUTINE_SUSPENDED
}
fun box(): String {
var res = ""
suspend { res = foo().s }.startCoroutine(Continuation(EmptyCoroutineContext) { it.getOrThrow() })
return res
}