Replace trivial usages of suspendCoroutineOrReturn in tests
This is necessary since suspendCoroutineOrReturn gets removed in 1.3
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@ import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
class Controller {
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun noParams(): Unit = suspendCoroutineOrReturn {
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
||||
if (hashCode() % 2 == 0) {
|
||||
it.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
@@ -16,12 +16,12 @@ class Controller {
|
||||
Unit
|
||||
}
|
||||
}
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun yieldString(value: String) = suspendCoroutineOrReturn<Int> {
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
||||
it.resume(1)
|
||||
it checkType { _<Continuation<Int>>() }
|
||||
it.<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>resume<!>("")
|
||||
|
||||
// We can return anything here, 'suspendCoroutineOrReturn' is not very type-safe
|
||||
// We can return anything here, 'suspendCoroutineUninterceptedOrReturn' 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"
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
class Controller {
|
||||
suspend fun noParams(): Unit = suspendCoroutineOrReturn {
|
||||
suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
||||
if (hashCode() % 2 == 0) {
|
||||
it.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
@@ -14,12 +14,12 @@ class Controller {
|
||||
Unit
|
||||
}
|
||||
}
|
||||
suspend fun yieldString(value: String) = suspendCoroutineOrReturn<Int> {
|
||||
suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
||||
it.resume(1)
|
||||
it checkType { _<Continuation<Int>>() }
|
||||
it.resume(<!TYPE_MISMATCH!>""<!>)
|
||||
|
||||
// We can return anything here, 'suspendCoroutineOrReturn' is not very type-safe
|
||||
// We can return anything here, 'suspendCoroutineUninterceptedOrReturn' 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"
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ import kotlin.coroutines.experimental.intrinsics.*
|
||||
<!UNRESOLVED_REFERENCE!>it<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>resume<!>(Unit)
|
||||
}
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>suspend<!> fun bar(): Unit = <!UNRESOLVED_REFERENCE!>suspendCoroutineOrReturn<!> {
|
||||
<!UNSUPPORTED_FEATURE!>suspend<!> fun bar(): Unit = <!UNRESOLVED_REFERENCE!>suspendCoroutineUninterceptedOrReturn<!> {
|
||||
<!UNRESOLVED_REFERENCE!>it<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>resume<!>(Unit)
|
||||
<!UNRESOLVED_REFERENCE!>COROUTINE_SUSPENDED<!>
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,15 +6,15 @@ import COROUTINES_PACKAGE.intrinsics.*
|
||||
fun nonSuspend() {}
|
||||
|
||||
suspend fun foo() {
|
||||
suspendCoroutineOrReturn { x: Continuation<Int> -> }
|
||||
suspendCoroutineUninterceptedOrReturn { x: Continuation<Int> -> }
|
||||
|
||||
nonSuspend()
|
||||
}
|
||||
|
||||
suspend fun unitSuspend() {
|
||||
suspendCoroutineOrReturn { x: Continuation<Int> -> }
|
||||
suspendCoroutineUninterceptedOrReturn { x: Continuation<Int> -> }
|
||||
}
|
||||
|
||||
suspend fun baz(): Int = run {
|
||||
suspendCoroutineOrReturn { x: Continuation<Int> -> }
|
||||
suspendCoroutineUninterceptedOrReturn { x: Continuation<Int> -> }
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineOrReturn { c ->
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Nothing = suspendCoroutineUninterceptedOrReturn { c ->
|
||||
c.resumeWithException(exception)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ suspend fun baz(): Int = 1
|
||||
|
||||
suspend fun tryCatch(): Int {
|
||||
return try {
|
||||
suspendCoroutineOrReturn { x: Continuation<Int> -> }
|
||||
suspendCoroutineUninterceptedOrReturn { x: Continuation<Int> -> }
|
||||
} catch (e: Exception) {
|
||||
baz() // another suspend function
|
||||
}
|
||||
@@ -17,7 +17,7 @@ suspend fun tryCatch(): Int {
|
||||
|
||||
suspend fun tryFinally(): Int {
|
||||
return try {
|
||||
suspendCoroutineOrReturn { x: Continuation<Int> -> }
|
||||
suspendCoroutineUninterceptedOrReturn { x: Continuation<Int> -> }
|
||||
} finally {
|
||||
nonSuspend()
|
||||
}
|
||||
@@ -33,7 +33,7 @@ suspend fun returnInFinally(): Int {
|
||||
|
||||
suspend fun tryCatchFinally(): Int {
|
||||
return try {
|
||||
suspendCoroutineOrReturn { x: Continuation<Int> -> }
|
||||
suspendCoroutineUninterceptedOrReturn { x: Continuation<Int> -> }
|
||||
} catch (e: Exception) {
|
||||
baz() // another suspend function
|
||||
} finally {
|
||||
|
||||
+3
-3
@@ -16,17 +16,17 @@ suspend fun bar1() {
|
||||
return if (1.hashCode() > 0) {
|
||||
foo()
|
||||
}
|
||||
else suspendCoroutineOrReturn { x: Continuation<Unit> -> }
|
||||
else suspendCoroutineUninterceptedOrReturn { x: Continuation<Unit> -> }
|
||||
}
|
||||
|
||||
suspend fun bar2() =
|
||||
if (1.hashCode() > 0) {
|
||||
foo()
|
||||
}
|
||||
else suspendCoroutineOrReturn { x: Continuation<Unit> -> }
|
||||
else suspendCoroutineUninterceptedOrReturn { x: Continuation<Unit> -> }
|
||||
|
||||
suspend fun bar3() =
|
||||
when {
|
||||
true -> { foo() }
|
||||
else -> suspendCoroutineOrReturn { x: Continuation<Unit> -> }
|
||||
else -> suspendCoroutineUninterceptedOrReturn { x: Continuation<Unit> -> }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user