Files
kotlin/compiler/testData/codegen/boxInline/suspend/callableReference/simple.kt
Alexander Udalov 77c87fa6c9 Remove API_VERSION 1.3 from compiler tests
So that these tests will now check behavior on the latest API version
2018-12-20 12:53:23 +01:00

38 lines
758 B
Kotlin
Vendored

// !LANGUAGE: +ReleaseCoroutines
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JVM_IR
// NO_CHECK_LAMBDA_INLINING
// FILE: test.kt
inline suspend fun foo(x: suspend () -> String) = x()
// FILE: box.kt
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.ContinuationAdapter
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(object: ContinuationAdapter<Unit>() {
override fun resume(value: Unit) {
}
override fun resumeWithException(exception: Throwable) {
throw exception
}
})
}
suspend fun String.id() = this
fun box(): String {
var res = ""
builder {
res = foo("OK"::id)
}
return res
}