Remove coroutineContext from kotlin.coroutines.experimental.intrinsics package

#KT-22400: Fixed
This commit is contained in:
Ilmir Usmanov
2018-05-04 18:24:29 +03:00
parent 54ca2cbbe0
commit 5e4ce4f880
13 changed files with 149 additions and 198 deletions
@@ -1,31 +1,17 @@
// !API_VERSION: 1.2
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import kotlin.coroutines.experimental.*
import COROUTINES_PACKAGE.*
import kotlin.test.assertEquals
@Suppress("DEPRECATION_ERROR")
suspend fun suspendHereOld() =
if (kotlin.coroutines.experimental.intrinsics.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.intrinsics.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
suspend fun suspendHereNew() =
suspend fun suspendHere() =
if (coroutineContext != EmptyCoroutineContext)
"${coroutineContext} != $EmptyCoroutineContext"
else
"OK"
@Suppress("DEPRECATION_ERROR")
suspend fun multipleArgsOld(a: Any, b: Any, c: Any) =
if (kotlin.coroutines.experimental.intrinsics.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.intrinsics.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
suspend fun multipleArgsNew(a: Any, b: Any, c: Any) =
suspend fun multipleArgs(a: Any, b: Any, c: Any) =
if (coroutineContext != EmptyCoroutineContext)
"${coroutineContext} != $EmptyCoroutineContext"
else
@@ -53,32 +39,14 @@ fun builder(c: suspend () -> String): String {
}
fun box(): String {
var res = builder { suspendHereOld() }
var res = builder { suspendHere() }
if (res != "OK") {
return "fail 1 $res"
}
res = builder { multipleArgsOld(1, 1, 1) }
res = builder { multipleArgs(1, 1, 1) }
if (res != "OK") {
return "fail 2 $res"
}
res = builder {
@Suppress("DEPRECATION_ERROR")
if (kotlin.coroutines.experimental.intrinsics.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.intrinsics.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
}
if (res != "OK") {
return "fail 3 $res"
}
res = builder { suspendHereNew() }
if (res != "OK") {
return "fail 4 $res"
}
res = builder { multipleArgsNew(1, 1, 1) }
if (res != "OK") {
return "fail 5 $res"
}
res = builder {
if (coroutineContext != EmptyCoroutineContext)
"${coroutineContext} != $EmptyCoroutineContext"
@@ -86,7 +54,7 @@ fun box(): String {
"OK"
}
if (res != "OK") {
return "fail 6 $res"
return "fail 3 $res"
}
return "OK"
@@ -1,34 +1,20 @@
// !API_VERSION: 1.2
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
import COROUTINES_PACKAGE.*
import kotlin.test.assertEquals
@Suppress("DEPRECATION_ERROR")
class Controller {
suspend fun controllerSuspendHereOld() =
if (kotlin.coroutines.experimental.intrinsics.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.intrinsics.coroutineContext} != $EmptyCoroutineContext"
suspend fun controllerSuspendHere() =
if (coroutineContext != EmptyCoroutineContext)
"${coroutineContext} != $EmptyCoroutineContext"
else
"OK"
suspend fun controllerMultipleArgsOld(a: Any, b: Any, c: Any) =
if (kotlin.coroutines.experimental.intrinsics.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.intrinsics.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
suspend fun controllerSuspendHereNew() =
if (kotlin.coroutines.experimental.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
suspend fun controllerMultipleArgsNew(a: Any, b: Any, c: Any) =
if (kotlin.coroutines.experimental.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.coroutineContext} != $EmptyCoroutineContext"
suspend fun controllerMultipleArgs(a: Any, b: Any, c: Any) =
if (coroutineContext != EmptyCoroutineContext)
"${coroutineContext} != $EmptyCoroutineContext"
else
"OK"
@@ -54,41 +40,23 @@ class Controller {
fun box(): String {
val c = Controller()
var res = c.builder { controllerSuspendHereOld() }
var res = c.builder { controllerSuspendHere() }
if (res != "OK") {
return "fail 1 $res"
}
res = c.builder { controllerMultipleArgsOld(1, 1, 1) }
res = c.builder { controllerMultipleArgs(1, 1, 1) }
if (res != "OK") {
return "fail 2 $res"
}
res = c.builder {
@Suppress("DEPRECATION_ERROR")
if (kotlin.coroutines.experimental.intrinsics.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.intrinsics.coroutineContext} != $EmptyCoroutineContext"
if (coroutineContext != EmptyCoroutineContext)
"${coroutineContext} != $EmptyCoroutineContext"
else
"OK"
}
if (res != "OK") {
return "fail 3 $res"
}
res = c.builder { controllerSuspendHereNew() }
if (res != "OK") {
return "fail 4 $res"
}
res = c.builder { controllerMultipleArgsNew(1, 1, 1) }
if (res != "OK") {
return "fail 5 $res"
}
res = c.builder {
if (kotlin.coroutines.experimental.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
}
if (res != "OK") {
return "fail 6 $res"
}
return "OK"
}
@@ -1,9 +1,8 @@
// !API_VERSION: 1.2
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
import COROUTINES_PACKAGE.*
import kotlin.test.assertEquals
@Suppress("DEPRECATION_ERROR")
@@ -20,18 +19,6 @@ class Controller {
suspend fun controllerSuspendHere() =
if (coroutineContext == EmptyCoroutineContext) "$coroutineContext == $EmptyCoroutineContext" else "OK"
suspend fun controllerSuspendHereIntrinsicOld() =
if (kotlin.coroutines.experimental.intrinsics.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.intrinsics.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
suspend fun controllerSuspendHereIntrinsicNew() =
if (kotlin.coroutines.experimental.coroutineContext != EmptyCoroutineContext)
"${kotlin.coroutines.experimental.coroutineContext} != $EmptyCoroutineContext"
else
"OK"
suspend fun controllerMultipleArgs(a: Any, b: Any, c: Any) =
if (coroutineContext == EmptyCoroutineContext) "$coroutineContext == $EmptyCoroutineContext" else "OK"
@@ -65,17 +52,9 @@ fun box(): String {
if (res != "OK") {
return "fail 2 $res"
}
res = v.builder { controllerSuspendHereIntrinsicOld() }
if (res != "OK") {
return "fail 3 $res"
}
res = v.builder { controllerSuspendHereIntrinsicNew() }
if (res != "OK") {
return "fail 4 $res"
}
res = v.builder { controllerSuspendHere() }
if (res != "OK") {
return "fail 5 $res"
return "fail 3 $res"
}
return "OK"
@@ -1,19 +1,14 @@
// !API_VERSION: 1.2
// WITH_RUNTIME
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
// COMMON_COROUTINES_TEST
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
suspend fun suspendHere(ctx: CoroutineContext) = suspendCoroutineOrReturn<String> { x ->
if (x.context == ctx) x.resume("OK") else x.resume("FAIL")
}
@Suppress("DEPRECATION_ERROR")
suspend fun mustBeTailCallOld(): String {
return suspendHere(kotlin.coroutines.experimental.intrinsics.coroutineContext)
}
suspend fun mustBeTailCallNew(): String {
return suspendHere(kotlin.coroutines.experimental.coroutineContext)
suspend fun mustBeTailCall(): String {
return suspendHere(coroutineContext)
}
suspend fun retrieveCoroutineContext(): CoroutineContext =
@@ -3,7 +3,7 @@ final class CoroutineContextIntrinsicKt$notTailCall$1 {
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
inner class CoroutineContextIntrinsicKt$notTailCall$1
method <init>(p0: kotlin.coroutines.experimental.Continuation): void
method <init>(p0: COROUTINES_PACKAGE.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
@@ -12,9 +12,8 @@ final class CoroutineContextIntrinsicKt$notTailCall$1 {
@kotlin.Metadata
public final class CoroutineContextIntrinsicKt {
inner class CoroutineContextIntrinsicKt$notTailCall$1
public final static @org.jetbrains.annotations.Nullable method mustBeTailCallNew(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method mustBeTailCallOld(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method notTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method retrieveCoroutineContext(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.CoroutineContext, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method mustBeTailCall(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method notTailCall(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method retrieveCoroutineContext(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.CoroutineContext, @org.jetbrains.annotations.NotNull p1: COROUTINES_PACKAGE.Continuation): java.lang.Object
}