Files
kotlin-fork/compiler/testData/codegen/boxInline/suspend/twiceRegeneratedAnonymousObject.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

28 lines
629 B
Kotlin
Vendored

// WITH_STDLIB
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
package test
inline fun foo(crossinline x: () -> Unit) = suspend {
try { } finally {
// This object is regenerated twice (normal return & "catch Throwable, execute finally, and rethrow")
// It doesn't *need* to be, but this should work regardless.
{ x() }()
}
}
// FILE: 2.kt
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
import test.*
var result = "fail"
fun box(): String {
suspend {
foo { result = "OK" }()
}.startCoroutine(EmptyContinuation)
return result
}