diff --git a/compiler/testData/codegen/box/coroutines/await.kt b/compiler/testData/codegen/box/coroutines/await.kt index 91c3fcb390e..27843579618 100644 --- a/compiler/testData/codegen/box/coroutines/await.kt +++ b/compiler/testData/codegen/box/coroutines/await.kt @@ -2,6 +2,8 @@ // WITH_COROUTINES // NO_INTERCEPT_RESUME_TESTS // FILE: promise.kt +import kotlin.coroutines.* + class Promise(private val executor: ((T) -> Unit) -> Unit) { private var value: Any? = null private var thenList: MutableList<(T) -> Unit>? = mutableListOf() @@ -47,6 +49,8 @@ fun processQueue() { } // FILE: await.kt +import kotlin.coroutines.* + private var log = "" private var inAwait = false @@ -91,6 +95,7 @@ fun asyncOperation(resultSupplier: () -> T) = Promise { resolve -> fun getLog() = log // FILE: main.kt +import kotlin.coroutines.* private fun test() = async { val o = await(asyncOperation { "O" }) diff --git a/compiler/testData/codegen/box/coroutines/beginWithException.kt b/compiler/testData/codegen/box/coroutines/beginWithException.kt index 4a8e5e5e278..912473df223 100644 --- a/compiler/testData/codegen/box/coroutines/beginWithException.kt +++ b/compiler/testData/codegen/box/coroutines/beginWithException.kt @@ -1,5 +1,6 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x -> } diff --git a/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt b/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt index 99d469f161a..e5838d75936 100644 --- a/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt +++ b/compiler/testData/codegen/box/coroutines/beginWithExceptionNoHandleException.kt @@ -1,5 +1,6 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x ->} fun builder(c: suspend () -> Unit) { diff --git a/compiler/testData/codegen/box/coroutines/coercionToUnit.kt b/compiler/testData/codegen/box/coroutines/coercionToUnit.kt index b2359d46de0..32308564194 100644 --- a/compiler/testData/codegen/box/coroutines/coercionToUnit.kt +++ b/compiler/testData/codegen/box/coroutines/coercionToUnit.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + suspend fun await(t: T): T = suspendWithCurrentContinuation { c -> c.resume(t) diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt b/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt index 08c92e28a7b..492b7a9bcd3 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/breakFinally.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt index ede4518c044..9647d92b666 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/breakStatement.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt index f919476b046..75056773142 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/doWhileStatement.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt b/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt index 0906f80227e..34ba99071e1 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/forContinue.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt index f2bac094be3..e03fac1e285 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/forStatement.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt index f00cabe115b..02a0bfcc219 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt b/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt index 88fc5a9ecbe..668bcc75e1f 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/returnFromFinally.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + // Does not work in JVM backend, probably due to bug. It's not clear which behaviour is right. // TODO: fix the bug and enable for JVM backend diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt b/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt index 468c4330977..383ce99c611 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/switchLikeWhen.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt b/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt index 41ba24471b9..35bf5990651 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/throwFromCatch.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt index 64ce60d984d..ae133566269 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt b/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt index dc16288e13a..2b346f92658 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/whileStatement.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" diff --git a/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt b/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt index f800577a1f5..69ff61f6390 100644 --- a/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt +++ b/compiler/testData/codegen/box/coroutines/controllerAccessFromInnerLambda.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = false suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> diff --git a/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt b/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt index b03ba5cfad2..fc1059e1a1a 100644 --- a/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/defaultParametersInSuspend.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(a: String = "abc", i: Int = 2): String = suspendWithCurrentContinuation { x -> x.resume(a + "#" + (i + 1)) diff --git a/compiler/testData/codegen/box/coroutines/emptyClosure.kt b/compiler/testData/codegen/box/coroutines/emptyClosure.kt index dbff2ec7163..b3df5ba9f12 100644 --- a/compiler/testData/codegen/box/coroutines/emptyClosure.kt +++ b/compiler/testData/codegen/box/coroutines/emptyClosure.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + var result = 0 class Controller { diff --git a/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt b/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt index df2c7dc1014..4b030d434ef 100644 --- a/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt +++ b/compiler/testData/codegen/box/coroutines/falseUnitCoercion.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(v: T): T = suspendWithCurrentContinuation { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/generate.kt b/compiler/testData/codegen/box/coroutines/generate.kt index 64b80d692e5..7872db5ada5 100644 --- a/compiler/testData/codegen/box/coroutines/generate.kt +++ b/compiler/testData/codegen/box/coroutines/generate.kt @@ -1,6 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES // FULL_JDK +import kotlin.coroutines.* fun box(): String { val x = gen().joinToString() diff --git a/compiler/testData/codegen/box/coroutines/handleException.kt b/compiler/testData/codegen/box/coroutines/handleException.kt index 382290a0ac2..db68901a685 100644 --- a/compiler/testData/codegen/box/coroutines/handleException.kt +++ b/compiler/testData/codegen/box/coroutines/handleException.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var exception: Throwable? = null val postponedActions = ArrayList<() -> Unit>() diff --git a/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt b/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt index ac2d4c3bdc5..2efaebac409 100644 --- a/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt +++ b/compiler/testData/codegen/box/coroutines/handleResultCallEmptyBody.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + fun builder(c: suspend () -> Unit): String { var ok = false diff --git a/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt b/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt index 6d5f8f002a4..4355bfc05f4 100644 --- a/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt +++ b/compiler/testData/codegen/box/coroutines/handleResultNonUnitExpression.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt b/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt index b9e33cd8ff5..c064f78094e 100644 --- a/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt +++ b/compiler/testData/codegen/box/coroutines/handleResultSuspended.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var log = "" diff --git a/compiler/testData/codegen/box/coroutines/illegalState.kt b/compiler/testData/codegen/box/coroutines/illegalState.kt index 5e19ca40252..7741cda6d1a 100644 --- a/compiler/testData/codegen/box/coroutines/illegalState.kt +++ b/compiler/testData/codegen/box/coroutines/illegalState.kt @@ -2,6 +2,8 @@ // WITH_COROUTINES // TARGET_BACKEND: JVM // NO_INTERCEPT_RESUME_TESTS +import kotlin.coroutines.* + suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) SUSPENDED diff --git a/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt b/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt index 345bed29fc4..37f76b41bed 100644 --- a/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt +++ b/compiler/testData/codegen/box/coroutines/inlineSuspendFunction.kt @@ -4,6 +4,8 @@ // CHECK_NOT_CALLED: suspendInline_61zpoe$ // CHECK_NOT_CALLED: suspendInline_6r51u9$ // CHECK_NOT_CALLED: suspendInline +import kotlin.coroutines.* + class Controller { fun withValue(v: String, x: Continuation) { x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt b/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt index 23deef85b1f..fa63d551ec1 100644 --- a/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt +++ b/compiler/testData/codegen/box/coroutines/inlinedTryCatchFinally.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + var globalResult = "" var wasCalled = false class Controller { diff --git a/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt b/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt index 0279de5aa72..e03b5afe3fa 100644 --- a/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt +++ b/compiler/testData/codegen/box/coroutines/innerSuspensionCalls.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var i = 0 suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> diff --git a/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt b/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt index dea5419cdc7..7ad0e1874f8 100644 --- a/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt +++ b/compiler/testData/codegen/box/coroutines/instanceOfContinuation.kt @@ -1,6 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES // WITH_REFLECT +import kotlin.coroutines.* class Controller { suspend fun runInstanceOf(): Boolean = suspendWithCurrentContinuation { x -> diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt index 62945baabae..0f190d3b6d7 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt index 6dfee9e4e64..a1cf038a9a9 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt index 4385372b63b..c469756b9e8 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt index 042bf869862..a8abe172293 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt index 4314fde8ed9..77ab204d475 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt index 2d1f9025165..8cf35efbff7 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt index 9420cd8e63a..628f16827ac 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt @@ -1,6 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES // TARGET_BACKEND: JVM +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt index 0fc51683acf..d3e995f9352 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt index 941a7aa9da9..8557055d2c9 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt @@ -1,6 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES // TARGET_BACKEND: JVM +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt index 198f0e71ac6..cfd7dc23d10 100644 --- a/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt +++ b/compiler/testData/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x -> x.resume(Unit) diff --git a/compiler/testData/codegen/box/coroutines/interceptResume.kt b/compiler/testData/codegen/box/coroutines/interceptResume.kt index ae1f6815695..9613d7b35e1 100644 --- a/compiler/testData/codegen/box/coroutines/interceptResume.kt +++ b/compiler/testData/codegen/box/coroutines/interceptResume.kt @@ -1,6 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES // NO_INTERCEPT_RESUME_TESTS +import kotlin.coroutines.* class Controller { var log = "" diff --git a/compiler/testData/codegen/box/coroutines/iterateOverArray.kt b/compiler/testData/codegen/box/coroutines/iterateOverArray.kt index a7cfe751875..c7c278227c8 100644 --- a/compiler/testData/codegen/box/coroutines/iterateOverArray.kt +++ b/compiler/testData/codegen/box/coroutines/iterateOverArray.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/kt12958.kt b/compiler/testData/codegen/box/coroutines/kt12958.kt index 36c51dba0f7..50959fbcfb2 100644 --- a/compiler/testData/codegen/box/coroutines/kt12958.kt +++ b/compiler/testData/codegen/box/coroutines/kt12958.kt @@ -1,6 +1,8 @@ // WITH_RUNTIME // WITH_COROUTINES // WITH_CONTINUATION +import kotlin.coroutines.* + suspend fun suspendHere(v: V): V = suspendWithCurrentContinuation { x -> x.resume(v) SUSPENDED diff --git a/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt b/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt index 03878f2e13c..4e2e3b913dd 100644 --- a/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt +++ b/compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var result = "" var ok = false diff --git a/compiler/testData/codegen/box/coroutines/lastStatementInc.kt b/compiler/testData/codegen/box/coroutines/lastStatementInc.kt index 38071bc44ea..33adaa438df 100644 --- a/compiler/testData/codegen/box/coroutines/lastStatementInc.kt +++ b/compiler/testData/codegen/box/coroutines/lastStatementInc.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") SUSPENDED diff --git a/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt b/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt index 6cbcdc3544e..d81faced79b 100644 --- a/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt +++ b/compiler/testData/codegen/box/coroutines/lastStementAssignment.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") SUSPENDED diff --git a/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt b/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt index 577b5d7fbb1..2a35ac3a787 100644 --- a/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt +++ b/compiler/testData/codegen/box/coroutines/lastUnitExpression.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var ok = false var v = "fail" diff --git a/compiler/testData/codegen/box/coroutines/multiModule/simple.kt b/compiler/testData/codegen/box/coroutines/multiModule/simple.kt index 68bd7df83be..aab87e880f5 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/simple.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/simple.kt @@ -4,6 +4,8 @@ // FILE: controller.kt package lib +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") @@ -16,6 +18,7 @@ class Controller { // MODULE: main(controller) // FILE: main.kt import lib.* +import kotlin.coroutines.* fun builder(c: suspend Controller.() -> Unit) { c.startCoroutine(Controller(), EmptyContinuation) diff --git a/compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt b/compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt index 47ac0f0f98e..144e3a43bda 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt @@ -4,6 +4,8 @@ // FILE: controller.kt package lib +import kotlin.coroutines.* + @AllowSuspendExtensions class Controller { suspend fun String.suspendHere(): String = suspendWithCurrentContinuation { x -> @@ -23,6 +25,7 @@ inline suspend fun Controller.inlineSuspendExtension(v: String) = v.inlineSuspen // MODULE: main(controller) // FILE: main.kt import lib.* +import kotlin.coroutines.* suspend fun Controller.localSuspendExtension(v: String) = v.suspendHere() diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt index 3fd3a9bcad8..c766fe6d932 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCalls.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var lastSuspension: Continuation? = null var result = "fail" diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt index 942573976bf..7559fe7f181 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var lastSuspension: Continuation? = null var result = "fail" diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt index e4118bf2cae..5221d5fda53 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var lastSuspension: Continuation? = null var result = "fail" diff --git a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt index 9149d29c27b..d08073a6bd5 100644 --- a/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt +++ b/compiler/testData/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var lastSuspension: Continuation? = null var result = "fail" diff --git a/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt b/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt index f95c0240e8e..9667017257c 100644 --- a/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt +++ b/compiler/testData/codegen/box/coroutines/nestedTryCatch.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + var globalResult = "" var wasCalled = false class Controller { diff --git a/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt b/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt index 1b42249c4df..5a8a13d4fe6 100644 --- a/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt +++ b/compiler/testData/codegen/box/coroutines/noSuspensionPoints.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + fun builder(c: suspend () -> Int): Int { var res = 0 diff --git a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt index fb8e05feebf..2a2aaf407bd 100644 --- a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt +++ b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var cResult = 0 suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x -> diff --git a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt index 962806af988..fed77d76f53 100644 --- a/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt +++ b/compiler/testData/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var cResult = 0 diff --git a/compiler/testData/codegen/box/coroutines/returnByLabel.kt b/compiler/testData/codegen/box/coroutines/returnByLabel.kt index 8746d092401..b8ddd0c2e8e 100644 --- a/compiler/testData/codegen/box/coroutines/returnByLabel.kt +++ b/compiler/testData/codegen/box/coroutines/returnByLabel.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") SUSPENDED diff --git a/compiler/testData/codegen/box/coroutines/simple.kt b/compiler/testData/codegen/box/coroutines/simple.kt index 8667ba72c21..164d856e610 100644 --- a/compiler/testData/codegen/box/coroutines/simple.kt +++ b/compiler/testData/codegen/box/coroutines/simple.kt @@ -1,6 +1,8 @@ // IGNORE_BACKEND: JS // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/simpleException.kt b/compiler/testData/codegen/box/coroutines/simpleException.kt index c132a0087ef..52fc0c3d146 100644 --- a/compiler/testData/codegen/box/coroutines/simpleException.kt +++ b/compiler/testData/codegen/box/coroutines/simpleException.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resumeWithException(RuntimeException("OK")) diff --git a/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt index 0263c388b8d..9ecfdae2a13 100644 --- a/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/simpleWithHandleResult.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") SUSPENDED diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt index c5b87d0694a..eca0c8ab351 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/exception.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = throw RuntimeException("OK") diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt index a6aea10af7a..9cfb1fe7fbb 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt @@ -4,6 +4,8 @@ // CHECK_NOT_CALLED: suspendInline_61zpoe$ // CHECK_NOT_CALLED: suspendInline_6r51u9$ // CHECK_NOT_CALLED: suspendInline +import kotlin.coroutines.* + class Controller { suspend inline fun suspendInline(v: String): String = v diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt index 5ec046e3d22..fac7fc9c42d 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/simple.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere() = "OK" diff --git a/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt b/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt index 24ede4c84c8..bd4c7c87a46 100644 --- a/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt +++ b/compiler/testData/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): Int = suspendWithCurrentContinuation { x -> 1 diff --git a/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt b/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt index 877aa1221d0..552087ceeec 100644 --- a/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt +++ b/compiler/testData/codegen/box/coroutines/statementLikeLastExpression.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + var globalResult = "" suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/suspendDelegation.kt b/compiler/testData/codegen/box/coroutines/suspendDelegation.kt index 399c6c3d342..b1b39797ace 100644 --- a/compiler/testData/codegen/box/coroutines/suspendDelegation.kt +++ b/compiler/testData/codegen/box/coroutines/suspendDelegation.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = suspendThere() diff --git a/compiler/testData/codegen/box/coroutines/suspendExtension.kt b/compiler/testData/codegen/box/coroutines/suspendExtension.kt index 81b3c775a68..b2ab62fa9f0 100644 --- a/compiler/testData/codegen/box/coroutines/suspendExtension.kt +++ b/compiler/testData/codegen/box/coroutines/suspendExtension.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + @AllowSuspendExtensions class Controller { suspend fun String.suspendHere(): String = suspendWithCurrentContinuation { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt b/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt index 10fbb6f4635..f3f50be9914 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x -> x.resume(v * 2) diff --git a/compiler/testData/codegen/box/coroutines/suspendInCycle.kt b/compiler/testData/codegen/box/coroutines/suspendInCycle.kt index 8b6d794d0e9..6414e7ffb9b 100644 --- a/compiler/testData/codegen/box/coroutines/suspendInCycle.kt +++ b/compiler/testData/codegen/box/coroutines/suspendInCycle.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { var i = 0 suspend fun suspendHere(): Int = suspendWithCurrentContinuation { x -> diff --git a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt index 9797d49e50d..6992fe0dbad 100644 --- a/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt +++ b/compiler/testData/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("K") diff --git a/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt index 1e317cfef90..629055790c4 100644 --- a/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + var globalResult = "" var wasCalled = false class Controller { diff --git a/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt index a0dd14b4ba1..0180965b58c 100644 --- a/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/tryCatchWithHandleResult.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + var globalResult = "" var wasCalled = false class Controller { diff --git a/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt b/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt index c6ed7064698..41f3f50c53e 100644 --- a/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt +++ b/compiler/testData/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(v: String): String = suspendWithCurrentContinuation { x -> x.resume(v) diff --git a/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt b/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt index b1e5896fcf3..8edc919578d 100644 --- a/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt +++ b/compiler/testData/codegen/box/coroutines/tryFinallyWithHandleResult.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + var globalResult = "" var wasCalled = false class Controller { diff --git a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt index fb36151d1ad..746438e2deb 100644 --- a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt +++ b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTable.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") diff --git a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt index 5791fe6cbb7..eb4ad0a4276 100644 --- a/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt +++ b/compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt @@ -1,5 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES +import kotlin.coroutines.* + class Controller { suspend fun suspendHere(): String = suspendWithCurrentContinuation { x -> x.resume("OK") diff --git a/compiler/tests-common/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/org/jetbrains/kotlin/test/KotlinTestUtils.java index 43e6bf9418d..a4492c55f5f 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -644,6 +644,7 @@ public class KotlinTestUtils { if (isDirectiveDefined(expectedText, "WITH_COROUTINES")) { testFiles.add(factory.createFile(null, "CoroutineUtil.kt", + "import kotlin.coroutines.*\n" + "fun handleResultContinuation(x: (T) -> Unit): Continuation = object: Continuation {\n" + " override fun resumeWithException(exception: Throwable) {\n" + " throw exception\n" +