Global rename in test data for coroutines

(cherry picked from commit 132f97b)
This commit is contained in:
Stanislav Erokhin
2016-12-15 19:54:03 +03:00
committed by Stanislav Erokhin
parent 8968bc3dd6
commit b527a4d158
93 changed files with 210 additions and 210 deletions
@@ -3,21 +3,21 @@
import kotlin.coroutines.*
class Controller {
suspend fun noParams(): Unit = suspendWithCurrentContinuation {
suspend fun noParams(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn {
if (hashCode() % 2 == 0) {
it.resume(Unit)
SUSPENDED
CoroutineIntrinsics.SUSPENDED
}
else {
Unit
}
}
suspend fun yieldString(value: String) = suspendWithCurrentContinuation<Int> {
suspend fun yieldString(value: String) = CoroutineIntrinsics.suspendCoroutineOrReturn<Int> {
it.resume(1)
it checkType { _<Continuation<Int>>() }
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
"Not-int"
}
@@ -4,15 +4,15 @@ import kotlin.coroutines.*
fun nonSuspend() {}
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()
}
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 {
<!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> -> }<!>
}
@@ -1,7 +1,7 @@
// Tail calls are not allowed to be Nothing typed. See KT-15051
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)
SUSPENDED
CoroutineIntrinsics.SUSPENDED
}<!>
@@ -7,7 +7,7 @@ suspend fun baz(): Int = 1
suspend fun tryCatch(): Int {
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) {
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>baz()<!> // another suspend function
}
@@ -15,7 +15,7 @@ suspend fun tryCatch(): Int {
suspend fun tryFinally(): Int {
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 {
nonSuspend()
}
@@ -31,7 +31,7 @@ suspend fun returnInFinally(): Int {
suspend fun tryCatchFinally(): Int {
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) {
<!SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE!>baz()<!> // another suspend function
} finally {
@@ -14,17 +14,17 @@ suspend fun bar1() {
return if (1.hashCode() > 0) {
foo()
}
else suspendWithCurrentContinuation { x: Continuation<Unit> -> }
else CoroutineIntrinsics.suspendCoroutineOrReturn { x: Continuation<Unit> -> }
}
suspend fun bar2() =
if (1.hashCode() > 0) {
foo()
}
else suspendWithCurrentContinuation { x: Continuation<Unit> -> }
else CoroutineIntrinsics.suspendCoroutineOrReturn { x: Continuation<Unit> -> }
suspend fun bar3() =
when {
true -> { foo() }
else -> suspendWithCurrentContinuation { x: Continuation<Unit> -> }
else -> CoroutineIntrinsics.suspendCoroutineOrReturn { x: Continuation<Unit> -> }
}