// FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.intrinsics.* var i = 0; suspend fun suspendHere() = suspendCoroutineOrReturn { i++ COROUTINE_SUSPENDED } interface SuspendRunnable { suspend fun run() } suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { val o = object : SuspendRunnable { override suspend fun run() { suspendHere() suspendHere() suspendHere() suspendHere() suspendHere() } } o.run() } // FILE: inlineSite.kt // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* fun builder(c: suspend () -> Unit) { c.startCoroutine(object: Continuation { override val context: CoroutineContext get() = EmptyCoroutineContext override fun resume(value: Unit) { } override fun resumeWithException(exception: Throwable) { throw exception } }) } fun box(): String { var res = "OK" builder { crossinlineMe { res = "FAIL 1" } } if (i != 1) return "FAIL 2" return res }