Global rename in test data for coroutines
(cherry picked from commit 132f97b)
This commit is contained in:
committed by
Stanislav Erokhin
parent
8968bc3dd6
commit
b527a4d158
+2
-2
@@ -54,7 +54,7 @@ private var log = ""
|
|||||||
|
|
||||||
private var inAwait = false
|
private var inAwait = false
|
||||||
|
|
||||||
suspend fun <S> await(value: Promise<S>): S = suspendWithCurrentContinuation { continuation: Continuation<S> ->
|
suspend fun <S> await(value: Promise<S>): S = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation: Continuation<S> ->
|
||||||
if (inAwait) {
|
if (inAwait) {
|
||||||
throw IllegalStateException("Can't call await recursively")
|
throw IllegalStateException("Can't call await recursively")
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ suspend fun <S> await(value: Promise<S>): S = suspendWithCurrentContinuation { c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
inAwait = false
|
inAwait = false
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun <S> awaitAndLog(value: Promise<S>): S {
|
suspend fun <S> awaitAndLog(value: Promise<S>): S {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x -> }
|
suspend fun suspendHere(): Any = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> }
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
var exception: Throwable? = null
|
var exception: Throwable? = null
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x ->}
|
suspend fun suspendHere(): Any = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
|
|
||||||
suspend fun <T> await(t: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> await(t: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(t)
|
c.resume(t)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit): String {
|
fun builder(c: suspend () -> Unit): String {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
result += "suspend($value);"
|
result += "suspend($value);"
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
result += "["
|
result += "["
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
result += "suspend($value);"
|
result += "suspend($value);"
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tail calls are not allowed to be Nothing typed. See KT-15051
|
// Tail calls are not allowed to be Nothing typed. See KT-15051
|
||||||
suspend fun suspendLogAndThrow(exception: Throwable): Any? = suspendWithCurrentContinuation { c ->
|
suspend fun suspendLogAndThrow(exception: Throwable): Any? = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
result += "throw(${exception.message});"
|
result += "throw(${exception.message});"
|
||||||
c.resumeWithException(exception)
|
c.resumeWithException(exception)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -6,10 +6,10 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
result += "suspend($value);"
|
result += "suspend($value);"
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||||
c.resume(value)
|
c.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@ import kotlin.coroutines.*
|
|||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
var result = false
|
var result = false
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(a: String = "abc", i: Int = 2): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(a: String = "abc", i: Int = 2): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(a + "#" + (i + 1))
|
x.resume(a + "#" + (i + 1))
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -6,38 +6,38 @@ class Controller {
|
|||||||
var log = ""
|
var log = ""
|
||||||
var resumeIndex = 0
|
var resumeIndex = 0
|
||||||
|
|
||||||
suspend fun <T> suspendWithValue(value: T): T = suspendWithCurrentContinuation { continuation ->
|
suspend fun <T> suspendWithValue(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation ->
|
||||||
log += "suspend($value);"
|
log += "suspend($value);"
|
||||||
continuation.resume(value)
|
continuation.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithException(value: String): Unit = suspendWithCurrentContinuation { continuation ->
|
suspend fun suspendWithException(value: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation ->
|
||||||
log += "error($value);"
|
log += "error($value);"
|
||||||
continuation.resumeWithException(RuntimeException(value))
|
continuation.resumeWithException(RuntimeException(value))
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test(c: suspend Controller.() -> Unit): String {
|
fun test(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation, object: ResumeInterceptor {
|
c.startCoroutine(controller, EmptyContinuation, object: ContinuationDispatcher {
|
||||||
private fun interceptResume(block: () -> Unit) {
|
private fun dispatchResume(block: () -> Unit) {
|
||||||
val id = controller.resumeIndex++
|
val id = controller.resumeIndex++
|
||||||
controller.log += "before $id;"
|
controller.log += "before $id;"
|
||||||
block()
|
block()
|
||||||
controller.log += "after $id;"
|
controller.log += "after $id;"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <P> interceptResume(data: P, continuation: Continuation<P>): Boolean {
|
override fun <P> dispatchResume(data: P, continuation: Continuation<P>): Boolean {
|
||||||
interceptResume {
|
dispatchResume {
|
||||||
continuation.resume(data)
|
continuation.resume(data)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun interceptResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean {
|
override fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean {
|
||||||
interceptResume {
|
dispatchResume {
|
||||||
continuation.resumeWithException(exception)
|
continuation.resumeWithException(exception)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
|||||||
var result = 0
|
var result = 0
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
result++
|
result++
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun <T> suspendHere(v: T): T = suspendWithCurrentContinuation { x ->
|
suspend fun <T> suspendHere(v: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -50,10 +50,10 @@ class GeneratedIterator<T>(block: suspend Generator<T>.() -> Unit) : AbstractIte
|
|||||||
override fun computeNext() {
|
override fun computeNext() {
|
||||||
nextStep.resume(Unit)
|
nextStep.resume(Unit)
|
||||||
}
|
}
|
||||||
suspend override fun yield(value: T) = suspendWithCurrentContinuation<Unit> { c ->
|
suspend override fun yield(value: T) = CoroutineIntrinsics.suspendCoroutineOrReturn<Unit> { c ->
|
||||||
setNext(value)
|
setNext(value)
|
||||||
nextStep = c
|
nextStep = c
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,20 +6,20 @@ class Controller {
|
|||||||
var exception: Throwable? = null
|
var exception: Throwable? = null
|
||||||
val postponedActions = ArrayList<() -> Unit>()
|
val postponedActions = ArrayList<() -> Unit>()
|
||||||
|
|
||||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resumeWithException(e)
|
x.resumeWithException(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: suspend Controller.() -> Unit) {
|
fun run(c: suspend Controller.() -> Unit) {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
|
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var log = ""
|
var log = ""
|
||||||
|
|
||||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { x ->
|
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
log += "suspend($value);"
|
log += "suspend($value);"
|
||||||
x.resume(value)
|
x.resume(value)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder1(c: suspend () -> Unit) {
|
fun builder1(c: suspend () -> Unit) {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ class Controller {
|
|||||||
x.resume(v)
|
x.resume(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend inline fun suspendInline(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend inline fun suspendInline(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
withValue(v, x)
|
withValue(v, x)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend inline fun suspendInline(crossinline b: () -> String): String = suspendInline(b())
|
suspend inline fun suspendInline(crossinline b: () -> String): String = suspendInline(b())
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
|||||||
class Controller {
|
class Controller {
|
||||||
val postponedActions = mutableListOf<() -> Unit>()
|
val postponedActions = mutableListOf<() -> Unit>()
|
||||||
|
|
||||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resumeWithException(e)
|
x.resumeWithException(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: suspend Controller.() -> String) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import kotlin.coroutines.*
|
|||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
var i = 0
|
var i = 0
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume((i++).toString())
|
x.resume((i++).toString())
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun runInstanceOf(): Boolean = suspendWithCurrentContinuation { x ->
|
suspend fun runInstanceOf(): Boolean = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
val y: Any = x
|
val y: Any = x
|
||||||
x.resume(x is Continuation<*>)
|
x.resume(x is Continuation<*>)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun runCast(): Boolean = suspendWithCurrentContinuation { x ->
|
suspend fun runCast(): Boolean = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
val y: Any = x
|
val y: Any = x
|
||||||
x.resume(Continuation::class.isInstance(y as Continuation<*>))
|
x.resume(Continuation::class.isInstance(y as Continuation<*>))
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
// WITH_CONTINUATION
|
// WITH_CONTINUATION
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun <V> suspendHere(v: V): V = suspendWithCurrentContinuation { x ->
|
suspend fun <V> suspendHere(v: V): V = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> String): String {
|
fun builder(c: suspend () -> String): String {
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var result = ""
|
var result = ""
|
||||||
var ok = false
|
var ok = false
|
||||||
suspend fun suspendHere(v: String): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(v: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
result += v
|
result += v
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var ok = false
|
var ok = false
|
||||||
var v = "fail"
|
var v = "fail"
|
||||||
suspend fun suspendHere(v: String): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(v: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
this.v = v
|
this.v = v
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ package lib
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var lastSuspension: Continuation<String>? = null
|
var lastSuspension: Continuation<String>? = null
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
lastSuspension = x
|
lastSuspension = x
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasNext() = lastSuspension != null
|
fun hasNext() = lastSuspension != null
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var lastSuspension: Continuation<String>? = null
|
var lastSuspension: Continuation<String>? = null
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
lastSuspension = x
|
lastSuspension = x
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasNext() = lastSuspension != null
|
fun hasNext() = lastSuspension != null
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var lastSuspension: Continuation<String>? = null
|
var lastSuspension: Continuation<String>? = null
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
lastSuspension = x
|
lastSuspension = x
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasNext() = lastSuspension != null
|
fun hasNext() = lastSuspension != null
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
var lastSuspension: Continuation<String>? = null
|
var lastSuspension: Continuation<String>? = null
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
lastSuspension = x
|
lastSuspension = x
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasNext() = lastSuspension != null
|
fun hasNext() = lastSuspension != null
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
|||||||
class Controller {
|
class Controller {
|
||||||
val postponedActions = ArrayList<() -> Unit>()
|
val postponedActions = ArrayList<() -> Unit>()
|
||||||
|
|
||||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resumeWithException(e)
|
x.resumeWithException(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: suspend Controller.() -> String) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import kotlin.coroutines.*
|
|||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
var cResult = 0
|
var cResult = 0
|
||||||
suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v * 2)
|
x.resume(v * 2)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
|||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
var cResult = 0
|
var cResult = 0
|
||||||
suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v * 2)
|
x.resume(v * 2)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Int): Int {
|
fun builder(c: suspend () -> Int): Int {
|
||||||
|
|||||||
+2
-2
@@ -2,9 +2,9 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resumeWithException(RuntimeException("OK"))
|
x.resumeWithException(RuntimeException("OK"))
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> Int): Int {
|
fun builder(c: suspend () -> Int): Int {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Int = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
suspend fun suspendThere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
"?"
|
"?"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
var globalResult = ""
|
var globalResult = ""
|
||||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: suspend () -> String) {
|
fun builder(c: suspend () -> String) {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
|||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendThere()
|
suspend fun suspendHere(): String = suspendThere()
|
||||||
|
|
||||||
suspend fun suspendThere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v * 2)
|
x.resume(v * 2)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import kotlin.coroutines.*
|
|||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
var i = 0
|
var i = 0
|
||||||
suspend fun suspendHere(): Int = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(i++)
|
x.resume(i++)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
suspend fun suspendThere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("?")
|
x.resume("?")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -3,19 +3,19 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("K")
|
x.resume("K")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithArgument(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithArgument(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithDouble(v: Double): Double = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithDouble(v: Double): Double = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -7,20 +7,20 @@ var wasCalled = false
|
|||||||
class Controller {
|
class Controller {
|
||||||
val postponedActions = ArrayList<() -> Unit>()
|
val postponedActions = ArrayList<() -> Unit>()
|
||||||
|
|
||||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resumeWithException(e)
|
x.resumeWithException(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: suspend Controller.() -> String) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
|||||||
class Controller {
|
class Controller {
|
||||||
val postponedActions = ArrayList<() -> Unit>()
|
val postponedActions = ArrayList<() -> Unit>()
|
||||||
|
|
||||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resumeWithException(e)
|
x.resumeWithException(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: suspend Controller.() -> String) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
|||||||
class Controller {
|
class Controller {
|
||||||
val postponedActions = mutableListOf<() -> Unit>()
|
val postponedActions = mutableListOf<() -> Unit>()
|
||||||
|
|
||||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resume(v)
|
x.resume(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
postponedActions.add {
|
postponedActions.add {
|
||||||
x.resumeWithException(e)
|
x.resumeWithException(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: suspend Controller.() -> String) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere() = suspendWithCurrentContinuation<String> { x ->
|
suspend fun suspendHere() = CoroutineIntrinsics.suspendCoroutineOrReturn<String> { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,9 +4,9 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume(Unit)
|
x.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// TREAT_AS_ONE_FILE
|
// TREAT_AS_ONE_FILE
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// TREAT_AS_ONE_FILE
|
// TREAT_AS_ONE_FILE
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -57,12 +57,12 @@ fun <T> async(c: @Suspend() (() -> T)): CompletableFuture<T> {
|
|||||||
return future
|
return future
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun <V> await(f: CompletableFuture<V>) = suspendWithCurrentContinuation<V> { machine ->
|
suspend fun <V> await(f: CompletableFuture<V>) = CoroutineIntrinsics.suspendCoroutineOrReturn<V> { machine ->
|
||||||
f.whenComplete { value, throwable ->
|
f.whenComplete { value, throwable ->
|
||||||
if (throwable == null)
|
if (throwable == null)
|
||||||
machine.resume(value)
|
machine.resume(value)
|
||||||
else
|
else
|
||||||
machine.resumeWithException(throwable)
|
machine.resumeWithException(throwable)
|
||||||
}
|
}
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -54,12 +54,12 @@ fun <T> async(c: @Suspend() (() -> T)): CompletableFuture<T> {
|
|||||||
return future
|
return future
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun <V> await(f: CompletableFuture<V>) = suspendWithCurrentContinuation<V> { machine ->
|
suspend fun <V> await(f: CompletableFuture<V>) = CoroutineIntrinsics.suspendCoroutineOrReturn<V> { machine ->
|
||||||
f.whenComplete { value, throwable ->
|
f.whenComplete { value, throwable ->
|
||||||
if (throwable == null)
|
if (throwable == null)
|
||||||
machine.resume(value)
|
machine.resume(value)
|
||||||
else
|
else
|
||||||
machine.resumeWithException(throwable)
|
machine.resumeWithException(throwable)
|
||||||
}
|
}
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// FILE: A.kt
|
// FILE: A.kt
|
||||||
package a
|
package a
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun suspendHere() = suspendWithCurrentContinuation<String> { x ->
|
suspend fun suspendHere() = CoroutineIntrinsics.suspendCoroutineOrReturn<String> { x ->
|
||||||
x.resume("OK")
|
x.resume("OK")
|
||||||
Suspend
|
Suspend
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -3,21 +3,21 @@
|
|||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun noParams(): Unit = suspendWithCurrentContinuation {
|
suspend fun noParams(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn {
|
||||||
if (hashCode() % 2 == 0) {
|
if (hashCode() % 2 == 0) {
|
||||||
it.resume(Unit)
|
it.resume(Unit)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Unit
|
Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
suspend fun yieldString(value: String) = suspendWithCurrentContinuation<Int> {
|
suspend fun yieldString(value: String) = CoroutineIntrinsics.suspendCoroutineOrReturn<Int> {
|
||||||
it.resume(1)
|
it.resume(1)
|
||||||
it checkType { _<Continuation<Int>>() }
|
it checkType { _<Continuation<Int>>() }
|
||||||
it.resume(<!TYPE_MISMATCH!>""<!>)
|
it.resume(<!TYPE_MISMATCH!>""<!>)
|
||||||
|
|
||||||
// We can return anything here, 'suspendWithCurrentContinuation' is not very type-safe
|
// We can return anything here, 'CoroutineIntrinsics.suspendCoroutineOrReturn' is not very type-safe
|
||||||
// Also we can call resume and then return the value too, but it's still just our problem
|
// Also we can call resume and then return the value too, but it's still just our problem
|
||||||
"Not-int"
|
"Not-int"
|
||||||
}
|
}
|
||||||
@@ -4,15 +4,15 @@ import kotlin.coroutines.*
|
|||||||
fun nonSuspend() {}
|
fun nonSuspend() {}
|
||||||
|
|
||||||
suspend fun foo() {
|
suspend fun foo() {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendWithCurrentContinuation { x: Continuation<Int> -> }<!>
|
CoroutineIntrinsics.<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendCoroutineOrReturn { x: Continuation<Int> -> }<!>
|
||||||
|
|
||||||
nonSuspend()
|
nonSuspend()
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun unitSuspend() {
|
suspend fun unitSuspend() {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendWithCurrentContinuation { x: Continuation<Int> -> }<!>
|
CoroutineIntrinsics.<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendCoroutineOrReturn { x: Continuation<Int> -> }<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun baz(): Int = run {
|
suspend fun baz(): Int = run {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendWithCurrentContinuation { x: Continuation<Int> -> }<!>
|
CoroutineIntrinsics.<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendCoroutineOrReturn { x: Continuation<Int> -> }<!>
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
// Tail calls are not allowed to be Nothing typed. See KT-15051
|
// Tail calls are not allowed to be Nothing typed. See KT-15051
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = <!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendWithCurrentContinuation { c ->
|
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = CoroutineIntrinsics.<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendCoroutineOrReturn { c ->
|
||||||
c.resumeWithException(exception)
|
c.resumeWithException(exception)
|
||||||
SUSPENDED
|
CoroutineIntrinsics.SUSPENDED
|
||||||
}<!>
|
}<!>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ suspend fun baz(): Int = 1
|
|||||||
|
|
||||||
suspend fun tryCatch(): Int {
|
suspend fun tryCatch(): Int {
|
||||||
return try {
|
return try {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendWithCurrentContinuation { x: Continuation<Int> -> }<!>
|
CoroutineIntrinsics.<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendCoroutineOrReturn { x: Continuation<Int> -> }<!>
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>baz()<!> // another suspend function
|
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>baz()<!> // another suspend function
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ suspend fun tryCatch(): Int {
|
|||||||
|
|
||||||
suspend fun tryFinally(): Int {
|
suspend fun tryFinally(): Int {
|
||||||
return try {
|
return try {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendWithCurrentContinuation { x: Continuation<Int> -> }<!>
|
CoroutineIntrinsics.<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendCoroutineOrReturn { x: Continuation<Int> -> }<!>
|
||||||
} finally {
|
} finally {
|
||||||
nonSuspend()
|
nonSuspend()
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ suspend fun returnInFinally(): Int {
|
|||||||
|
|
||||||
suspend fun tryCatchFinally(): Int {
|
suspend fun tryCatchFinally(): Int {
|
||||||
return try {
|
return try {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendWithCurrentContinuation { x: Continuation<Int> -> }<!>
|
CoroutineIntrinsics.<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>suspendCoroutineOrReturn { x: Continuation<Int> -> }<!>
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>baz()<!> // another suspend function
|
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>baz()<!> // another suspend function
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -14,17 +14,17 @@ suspend fun bar1() {
|
|||||||
return if (1.hashCode() > 0) {
|
return if (1.hashCode() > 0) {
|
||||||
foo()
|
foo()
|
||||||
}
|
}
|
||||||
else suspendWithCurrentContinuation { x: Continuation<Unit> -> }
|
else CoroutineIntrinsics.suspendCoroutineOrReturn { x: Continuation<Unit> -> }
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun bar2() =
|
suspend fun bar2() =
|
||||||
if (1.hashCode() > 0) {
|
if (1.hashCode() > 0) {
|
||||||
foo()
|
foo()
|
||||||
}
|
}
|
||||||
else suspendWithCurrentContinuation { x: Continuation<Unit> -> }
|
else CoroutineIntrinsics.suspendCoroutineOrReturn { x: Continuation<Unit> -> }
|
||||||
|
|
||||||
suspend fun bar3() =
|
suspend fun bar3() =
|
||||||
when {
|
when {
|
||||||
true -> { foo() }
|
true -> { foo() }
|
||||||
else -> suspendWithCurrentContinuation { x: Continuation<Unit> -> }
|
else -> CoroutineIntrinsics.suspendCoroutineOrReturn { x: Continuation<Unit> -> }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ fun async(coroutine x: Controller.() -> Continuation<Unit>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
suspend fun step(param: Int) = suspendWithCurrentContinuation<Int> { next ->
|
suspend fun step(param: Int) = CoroutineIntrinsics.suspendCoroutineOrReturn<Int> { next ->
|
||||||
next.resume(param + 1)
|
next.resume(param + 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user