JVM_IR: do not handle Nothing in suspend tail call bridges
Else they wouldn't be tail call, would they?
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
suspend fun suspendThenThrow(): Nothing {
|
||||
suspendCoroutineUninterceptedOrReturn<Unit> {
|
||||
it.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
throw RuntimeException()
|
||||
}
|
||||
|
||||
suspend fun foo(x: Int = 1): Nothing = suspendThenThrow()
|
||||
|
||||
interface I {
|
||||
suspend fun bar(): Nothing
|
||||
}
|
||||
|
||||
class C : I by (object : I {
|
||||
override suspend fun bar(): Nothing = suspendThenThrow()
|
||||
})
|
||||
|
||||
var result = ""
|
||||
|
||||
fun box(): String {
|
||||
suspend {
|
||||
try { foo() } catch (e: RuntimeException) { result += "O" }
|
||||
try { C().bar() } catch (e: RuntimeException) { result += "K" }
|
||||
}.startCoroutine(EmptyContinuation)
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user