Files
kotlin-fork/compiler/testData/compileKotlinAgainstKotlin/coroutinesBinary.kt
T
Ilya Matveev a5e4e0284e Mute some box tests for native backend
This patch mutes the following test categories:
   * Tests with java dependencies (System class,
     java stdlib, jvm-oriented annotations etc).
   * Coroutines tests.
   * Reflection tests.
   * Tests with an inheritance from the standard
     collections.
2017-03-10 19:59:37 +03:00

37 lines
760 B
Kotlin
Vendored

// IGNORE_BACKEND: NATIVE
// FILE: A.kt
// WITH_RUNTIME
package a
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
class Controller {
suspend fun suspendHere() = suspendCoroutineOrReturn<String> { x ->
x.resume("OK")
COROUTINE_SUSPENDED
}
}
fun builder(c: suspend Controller.() -> Unit) {
c.startCoroutine(Controller(), object : Continuation<Unit> {
override val context: CoroutineContext = EmptyCoroutineContext
override fun resume(value: Unit) {}
override fun resumeWithException(exception: Throwable) {}
})
}
// FILE: B.kt
import a.builder
fun box(): String {
var result = ""
builder {
result = suspendHere()
}
return result
}