diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt index bb6ba117b82..684cb02d4d7 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt @@ -18,13 +18,7 @@ import COROUTINES_PACKAGE.intrinsics.* var result = "" fun builder(c: suspend () -> Unit) { - c.startCoroutine(object : Continuation { - override val context = EmptyCoroutineContext - override fun resume(value: Unit) { - } - override fun resumeWithException(exception: Throwable) { - } - }) + c.startCoroutine(EmptyContinuation) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt b/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt index 9c68456d4a7..70cd1cee3c0 100644 --- a/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt +++ b/compiler/testData/codegen/boxInline/suspend/capturedVariables.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* suspend inline fun test1(c: suspend () -> Unit) { c() @@ -18,19 +20,10 @@ suspend inline fun test2(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun calculate() = suspendCoroutineOrReturn { diff --git a/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt b/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt index b6b6d12a103..a5075cb2728 100644 --- a/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/crossinlineSuspendLambdaInsideCrossinlineSuspendLambda.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* inline suspend fun foo(crossinline a: suspend () -> Unit, crossinline b: suspend () -> Unit) { var x = "OK" @@ -15,17 +17,7 @@ inline suspend fun bar(crossinline l: suspend () -> Unit) { } fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } // FILE: box.kt diff --git a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt index 38b424c2a03..3f4bcfc9006 100644 --- a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueCrossinline.kt @@ -1,9 +1,11 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.* +import helpers.* class Controller { var res = "FAIL 1" @@ -39,19 +41,10 @@ suspend inline fun test3(controller: Controller = defaultController, crossinline // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt index bebcb17605e..af2a989202a 100644 --- a/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt +++ b/compiler/testData/codegen/boxInline/suspend/defaultParameter/defaultValueInline.kt @@ -1,9 +1,11 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.* +import helpers.* class Controller { var res = "FAIL 1" @@ -19,19 +21,10 @@ suspend inline fun test(controller: Controller = defaultController, c: suspend C // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt index 7ac8ac9aab5..15a4f9e48d1 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfCrossinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) // Are suspend calls possible inside lambda matching to the parameter @@ -26,17 +28,7 @@ inline fun test2(crossinline c: suspend () -> Unit) { } fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } // FILE: box.kt diff --git a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt index fd2f34188a8..c7fc5f17467 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineOrdinaryOfNoinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) // Start coroutine call is possible @@ -13,18 +15,6 @@ inline fun test1(noinline c: suspend () -> Unit) { builder { l() } } -val EmptyContinuation = object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } -} - inline fun test2(noinline c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt index ce762521e74..c8f990edbd5 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendContinuation.kt @@ -1,6 +1,7 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING suspend inline fun test1(c: () -> Unit) { @@ -38,19 +39,9 @@ suspend inline fun test5(crossinline c: suspend() -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* import COROUTINES_PACKAGE.jvm.internal.* -object EmptyContinuation: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } -} fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt index 30e4d8cc326..52ff3ae2bbf 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineOrdinary.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -30,23 +32,14 @@ inline fun transform(crossinline c: suspend () -> Unit) { } fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } // FILE: box.kt // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun box() : String { var res = "FAIL 1" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt index 2c026be6949..8d4f7be1c72 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfCrossinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -34,19 +36,10 @@ suspend inline fun test3(crossinline c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt index 8a05e18e298..f4949da52f7 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineOrdinary.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -30,23 +32,14 @@ inline fun transform(crossinline c: suspend () -> Unit) { } fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } // FILE: box.kt // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun box() : String { var res = "FAIL 1" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt index 6e8e45d6fce..c57caf2dea6 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfNoinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) // Are suspend calls possible inside lambda matching to the parameter @@ -14,17 +16,6 @@ suspend inline fun test1(noinline c: suspend () -> Unit) { builder { l() } } -object EmptyContinuation: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } -} suspend inline fun test2(noinline c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) @@ -55,6 +46,7 @@ suspend inline fun test4(noinline c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt index 31d6b35c829..a1032fc5ded 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfOrdinary.kt @@ -1,9 +1,11 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // suspend calls possible inside lambda matching to the parameter @@ -13,17 +15,7 @@ suspend inline fun test(c: () -> Unit) { } fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } inline fun transform(crossinline c: suspend () -> Unit) { @@ -34,6 +26,7 @@ inline fun transform(crossinline c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt index 46fd9840650..6886678e0d9 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineSuspendOfSuspend.kt @@ -1,9 +1,11 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // suspend calls possible inside lambda matching to the parameter @@ -16,19 +18,10 @@ suspend inline fun test(c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt b/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt index 608e08f0c1a..9f1cd2e97a7 100644 --- a/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt +++ b/compiler/testData/codegen/boxInline/suspend/multipleLocals.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING object Result { @@ -58,19 +59,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun dummy() { diff --git a/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt b/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt index ede94ef6926..4309e753c7c 100644 --- a/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt +++ b/compiler/testData/codegen/boxInline/suspend/multipleSuspensionPoints.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING suspend inline fun inlineMe(c: suspend () -> Unit) { @@ -29,19 +30,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt index bfbe2421045..8296129a7ea 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfCrossinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) // Are suspend calls possible inside lambda matching to the parameter @@ -30,17 +32,7 @@ class Controller { } fun builder(controller: Controller, c: suspend Controller.() -> Unit) { - c.startCoroutine(controller, object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(controller, EmptyContinuation) } // FILE: box.kt diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt index 3992c6d3723..26971d321da 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineOrdinaryOfNoinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) // Start coroutine call is possible @@ -12,18 +14,6 @@ interface SuspendRunnable { suspend fun run() } -val EmptyContinuation = object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } -} - class Controller { var res = "FAIL 1" diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt index 0a96fc87d12..db45628aeeb 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineOrdinary.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -34,23 +36,14 @@ class Controller { } fun builder(controller : Controller, c: suspend Controller.() -> Unit) { - c.startCoroutine(controller, object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(controller, EmptyContinuation) } // FILE: box.kt // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun box() : String { val controller = Controller() diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt index c37dd05b485..b8a1f612892 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfCrossinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -38,19 +40,10 @@ class Controller { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(controller: Controller, c: suspend Controller.() -> Unit) { - c.startCoroutine(controller, object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(controller, EmptyContinuation) } suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt index 80dbc3b1cd8..ad42a35a057 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineOrdinary.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // Block is allowed to be called from nested classes/lambdas (as common crossinlines) @@ -34,23 +36,14 @@ class Controller { } fun builder(controller: Controller, c: suspend Controller.() -> Unit) { - c.startCoroutine(controller, object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(controller, EmptyContinuation) } // FILE: box.kt // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun box() : String { val controller = Controller() diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt index 8f2dba065d6..14c5fc5db7d 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfNoinlineSuspend.kt @@ -1,8 +1,10 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called from nested classes/lambdas (as common crossinlines) // Are suspend calls possible inside lambda matching to the parameter @@ -13,17 +15,6 @@ interface SuspendRunnable { suspend fun run() } -object EmptyContinuation: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } -} class Controller { var res = "FAIL 1" @@ -59,6 +50,7 @@ fun builder(controller: Controller, c: suspend Controller.() -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt index 8fec58ae61b..4c5a3303491 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfOrdinary.kt @@ -1,9 +1,11 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // suspend calls possible inside lambda matching to the parameter @@ -21,23 +23,14 @@ class Controller { } fun builder(controller: Controller, c: suspend Controller.() -> Unit) { - c.startCoroutine(controller, object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(controller, EmptyContinuation) } // FILE: box.kt // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt index 937260b73ad..e93f778b2f5 100644 --- a/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt +++ b/compiler/testData/codegen/boxInline/suspend/receiver/inlineSuspendOfSuspend.kt @@ -1,9 +1,11 @@ // FILE: test.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.* +import helpers.* // Block is allowed to be called inside the body of owner inline function // suspend calls possible inside lambda matching to the parameter @@ -20,19 +22,10 @@ class Controller { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(controller: Controller, c: suspend Controller.() -> Unit) { - c.startCoroutine(controller, object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(controller, EmptyContinuation) } suspend fun calculate() = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/returnValue.kt b/compiler/testData/codegen/boxInline/suspend/returnValue.kt index 1d46c637261..33912ea1a47 100644 --- a/compiler/testData/codegen/boxInline/suspend/returnValue.kt +++ b/compiler/testData/codegen/boxInline/suspend/returnValue.kt @@ -1,9 +1,11 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* inline suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> x.resume(v) @@ -20,19 +22,10 @@ suspend inline fun complexSuspend(crossinline c: suspend () -> String): String { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun suspendHere(): String = suspendThere("O") diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt index e22de9f8f45..c70c9cc8570 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambda.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { @@ -13,19 +14,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt index 895e72172b4..97893971ee9 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaInsideLambda.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { @@ -18,19 +19,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt index f1ed0cb7ca9..f0644d6ae53 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerLambdaWithoutCrossinline.kt @@ -1,9 +1,11 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.intrinsics.* +import helpers.* var i = 0; @@ -27,19 +29,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt index 30496d30afa..322027bc1e4 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadness.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING interface SuspendRunnable { @@ -40,19 +41,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt index 0b0484537a4..402d1b2b75f 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerMadnessCallSite.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING interface SuspendRunnable { @@ -19,19 +20,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt index 0f60747829b..c0dd2374146 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObject.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING interface SuspendRunnable { @@ -21,19 +22,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt index 4a6114ece19..eacc3a0f13c 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectInsideInnerObject.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING interface SuspendRunnable { @@ -26,19 +27,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt index 1a3371842ab..b71f2595f49 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING interface SuspendRunnable { @@ -26,19 +27,10 @@ suspend inline fun crossinlineMe(crossinline c1: suspend () -> Unit, crossinline import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt index 589bd0a36ac..17889646054 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectWithoutCapturingCrossinline.kt @@ -1,9 +1,11 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING import COROUTINES_PACKAGE.intrinsics.* +import helpers.* var i = 0; @@ -33,19 +35,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt index 206f0711712..562bf1e3406 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/normalInline.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { @@ -13,19 +14,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) { import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } var i = 0; diff --git a/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt b/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt index 912b4d60d74..dde11dccd53 100644 --- a/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt +++ b/compiler/testData/codegen/boxInline/suspend/tryCatchStackTransform.kt @@ -1,6 +1,7 @@ // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME +// WITH_COROUTINES // NO_CHECK_LAMBDA_INLINING suspend inline fun inlineMe(c: suspend (String) -> String, d: suspend () -> String): String { @@ -19,19 +20,10 @@ suspend inline fun crossinlineMe(crossinline c: suspend (String) -> String, cros // COMMON_COROUTINES_TEST import COROUTINES_PACKAGE.* +import helpers.* fun builder(c: suspend () -> Unit) { - c.startCoroutine(object: Continuation { - override val context: CoroutineContext - get() = EmptyCoroutineContext - - override fun resume(value: Unit) { - } - - override fun resumeWithException(exception: Throwable) { - throw exception - } - }) + c.startCoroutine(EmptyContinuation) } suspend fun yieldString(s: String) = s diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt index 2459828e9a6..1a30239fa4d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineOrdinary.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // COMMON_COROUTINES_TEST +// WITH_COROUTINES // SKIP_TXT import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* // Function is NOT suspend // parameter is crossinline diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt index 580cb24ce37..1b3b489fd96 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfCrossinlineSuspend.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* interface SuspendRunnable { suspend fun run() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt index caf54fde21b..d1da3576b2b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineOrdinary.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* // Function is NOT suspend // parameter is noinline diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt index ad2aa59fa1a..471649c5260 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfNoinlineSuspend.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* interface SuspendRunnable { suspend fun run() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt index f479a760450..cab6c85ba1a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfOrdinary.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* // Function is NOT suspend // parameter is inline diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt index 7da31003c9c..971aef074e8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineOrdinaryOfSuspend.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -UNUSED_PARAMETER // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* interface SuspendRunnable { suspend fun run() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt index 0ab453fa8ef..829171e8a3d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineOrdinary.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* // Function is suspend // parameter is crossinline diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt index 632b19a4b4e..a8aba21f048 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfCrossinlineSuspend.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* interface SuspendRunnable { suspend fun run() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt index 964edd27623..9a228c61458 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineOrdinary.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* // Function is suspend // parameter is noinline diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt index 6503c38adef..baa54b3cecb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfNoinlineSuspend.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -NOTHING_TO_INLINE -UNUSED_PARAMETER // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* interface SuspendRunnable { suspend fun run() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt index 2ca6ed85377..3a3628ddd0c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfOrdinary.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* // Function is suspend // parameter is inline diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt index 79aeff053bc..b78b5ecf1e9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inlineCrossinline/inlineSuspendOfSuspend.kt @@ -1,14 +1,10 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -NOTHING_TO_INLINE // COMMON_COROUTINES_TEST // SKIP_TXT +// WITH_COROUTINES import COROUTINES_PACKAGE.* import COROUTINES_PACKAGE.intrinsics.* - -open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { - companion object : EmptyContinuation() - override fun resume(data: Any?) {} - override fun resumeWithException(exception: Throwable) { throw exception } -} +import helpers.* interface SuspendRunnable { suspend fun run() diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt index 9c6e3f9df16..0546c45ccfd 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.diagnostics.* import org.jetbrains.kotlin.load.java.InternalFlexibleTypeTransformer +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.BindingContext @@ -220,6 +221,8 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava()