diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 695e899ecf0..c77cb3516d2 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -32369,18 +32369,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt"); } - @Test - @TestMetadata("coroutinesDisabled.kt") - public void testCoroutinesDisabled() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt"); - } - - @Test - @TestMetadata("coroutinesEnabledWithWarning.kt") - public void testCoroutinesEnabledWithWarning() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt"); - } - @Test @TestMetadata("illegalSuspendCalls.kt") public void testIllegalSuspendCalls() throws Exception { @@ -32519,12 +32507,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt"); } - @Test - @TestMetadata("suspendCoroutineOrReturn_1_2.kt") - public void testSuspendCoroutineOrReturn_1_2() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt"); - } - @Test @TestMetadata("suspendCovarianJavaOverride.kt") public void testSuspendCovarianJavaOverride() throws Exception { @@ -32609,12 +32591,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt"); } - @Test - @TestMetadata("unsupported.kt") - public void testUnsupported() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt"); - } - @Test @TestMetadata("usageOfResultTypeInReturnType.kt") public void testUsageOfResultTypeInReturnType() throws Exception { diff --git a/compiler/testData/codegen/bytecodeListing/main/suspendMain_before.kt b/compiler/testData/codegen/bytecodeListing/main/suspendMain_before.kt deleted file mode 100644 index 2858c25d1ef..00000000000 --- a/compiler/testData/codegen/bytecodeListing/main/suspendMain_before.kt +++ /dev/null @@ -1,8 +0,0 @@ -// !LANGUAGE: -ExtendedMainConvention -ReleaseCoroutines -// Does not run on JVM_IR since it uses experimental coroutines -// IGNORE_BACKEND: JVM_IR -// WITH_RUNTIME - -// uses kotlin.coroutines.experimental classes under the hood - -suspend fun main(args: Array) {} diff --git a/compiler/testData/codegen/bytecodeListing/main/suspendMain_before.txt b/compiler/testData/codegen/bytecodeListing/main/suspendMain_before.txt deleted file mode 100644 index a5ad55a0e77..00000000000 --- a/compiler/testData/codegen/bytecodeListing/main/suspendMain_before.txt +++ /dev/null @@ -1,5 +0,0 @@ -@kotlin.Metadata -public final class SuspendMain_beforeKt { - // source: 'suspendMain_before.kt' - public final static @org.jetbrains.annotations.Nullable method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[], @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object -} diff --git a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/constCoroutine.kt b/compiler/testData/codegen/bytecodeText/oldLanguageVersions/constCoroutine.kt deleted file mode 100644 index 9ebfa4a947e..00000000000 --- a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/constCoroutine.kt +++ /dev/null @@ -1,29 +0,0 @@ -// !LANGUAGE: -ReleaseCoroutines -// IGNORE_BACKEND: JVM_IR -// WITH_COROUTINES -// TREAT_AS_ONE_FILE - -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun suspendHere() = "" - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - - for (i in 1..3) { - builder { - if (suspendHere() != "OK") throw java.lang.RuntimeException("fail 1") - } - } - - return "OK" -} - -// 2 GETSTATIC kotlin/Unit.INSTANCE -// 1 GETSTATIC helpers/EmptyContinuation.Companion -// 3 GETSTATIC diff --git a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/crossinlineSuspendContinuation_1_2.kt b/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/crossinlineSuspendContinuation_1_2.kt deleted file mode 100644 index 2703f554d39..00000000000 --- a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/crossinlineSuspendContinuation_1_2.kt +++ /dev/null @@ -1,34 +0,0 @@ -// !LANGUAGE: -ReleaseCoroutines -// IGNORE_BACKEND: JVM_IR -// WITH_COROUTINES - -import helpers.* -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* - -suspend fun dummy() {} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -interface SuspendRunnable { - suspend fun run(): String -} - -inline fun inlineMe(crossinline c: suspend () -> String) = object : SuspendRunnable { - override suspend fun run() = c() -} - -fun box(): String { - var res = "FAIL" - builder { - res = inlineMe { dummy(); "OK" }.run() - } - return res -} - -// Test for continuation of 'run' transformation. -// Since continuation is not suspend lambda, it should not have state-machine. -// @CrossinlineSuspendContinuation_1_2Kt$box$1$doResume$$inlined$inlineMe$1$1.class: -// 0 TABLESWITCH diff --git a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/doNotReassignContinuation_1_2.kt b/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/doNotReassignContinuation_1_2.kt deleted file mode 100644 index 53a40fdf234..00000000000 --- a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/doNotReassignContinuation_1_2.kt +++ /dev/null @@ -1,19 +0,0 @@ -// !LANGUAGE: -ReleaseCoroutines -// IGNORE_BACKEND: JVM_IR -// WITH_COROUTINES - -import helpers.* -// TREAT_AS_ONE_FILE -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> - x.resume("OK") -} - -suspend fun suspendThere(param: Int, param2: String, param3: Long): String { - val a = suspendHere() - val b = suspendHere() - return a + b -} - -// 0 ASTORE 4 diff --git a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTableSameSort_1_2.kt b/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTableSameSort_1_2.kt deleted file mode 100644 index feaf753e6be..00000000000 --- a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTableSameSort_1_2.kt +++ /dev/null @@ -1,51 +0,0 @@ -// !LANGUAGE: -ReleaseCoroutines -// IGNORE_BACKEND: JVM_IR -// WITH_COROUTINES - -import helpers.* -// TREAT_AS_ONE_FILE -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> - x.resume("OK") -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -fun box(): String { - var result = "fail 1" - - builder { - // Initialize var with Int value - try { - var i: String = "abc" - i = "123" - println(i) - } finally { } - - // This variable should take the same slot as 'i' had - var s: String - - // We shout not spill 's' to continuation field because it's not effectively initialized - if (suspendHere() == "OK") { - s = "OK" - } - else { - s = "fail 2" - } - - result = s - } - - return result -} - -// 1 LOCALVARIABLE i Ljava/lang/String; L.* 3 -// 1 LOCALVARIABLE s Ljava/lang/String; L.* 3 -// 0 PUTFIELD VarValueConflictsWithTableSameSort_1_2Kt\$box\$1.L\$0 : Ljava/lang/Object; -/* 1 load in try/finally */ -/* 1 load in result = s */ -/* 1 load in println */ -// 3 ALOAD 3 diff --git a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTable_1_2.kt b/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTable_1_2.kt deleted file mode 100644 index d94d0b0169f..00000000000 --- a/compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTable_1_2.kt +++ /dev/null @@ -1,50 +0,0 @@ -// !LANGUAGE: -ReleaseCoroutines -// IGNORE_BACKEND: JVM_IR -// WITH_COROUTINES - -import helpers.* -// TREAT_AS_ONE_FILE -import kotlin.coroutines.experimental.* -import kotlin.coroutines.experimental.intrinsics.* -suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> - x.resume("OK") -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(EmptyContinuation) -} - -val nonConstOne = 1 - -fun box(): String { - var result = "fail 1" - builder { - // Initialize var with Int value - for (i in 1..nonConstOne) { - if ("".length > 0) continue - } - - // This variable should take the same slot as 'i' had - var s: String - - // We should not spill 's' to continuation field because it's not initialized - // More precisely it contains a value of wrong type (it conflicts with contents of local var table), - // so an attempt of spilling may lead to problems on Android - if (suspendHere() == "OK") { - s = "OK" - } - else { - s = "fail 2" - } - - result = s - } - - return result -} - -// 1 LOCALVARIABLE i I L.* 3 -// 1 LOCALVARIABLE s Ljava/lang/String; L.* 3 -// 0 PUTFIELD VarValueConflictsWithTableKt\$box\$1.I\$0 : I -/* 2 loads in cycle */ -// 2 ILOAD 3 diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.fir.kt deleted file mode 100644 index c0821913df0..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !LANGUAGE: -Coroutines -ReleaseCoroutines - -suspend fun suspendHere(): String = "OK" - -fun builder(c: suspend () -> Unit) { - -} - -fun box(): String { - var result = "" - - builder { - suspendHere() - } - - return result -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt deleted file mode 100644 index d50e9e74102..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !LANGUAGE: -Coroutines -ReleaseCoroutines - -suspend fun suspendHere(): String = "OK" - -fun builder(c: suspend () -> Unit) { - -} - -fun box(): String { - var result = "" - - builder { - suspendHere() - } - - return result -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.txt deleted file mode 100644 index 9ca783c969d..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.txt +++ /dev/null @@ -1,5 +0,0 @@ -package - -public fun box(): kotlin.String -public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit -public suspend fun suspendHere(): kotlin.String diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.fir.kt deleted file mode 100644 index 58a01cd04e3..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !LANGUAGE: warn:Coroutines -ReleaseCoroutines - -suspend fun suspendHere(): String = "OK" - -fun builder(c: suspend () -> Unit) { - -} - -fun box(): String { - var result = "" - - builder { - suspendHere() - } - - return result -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt deleted file mode 100644 index 06d51eb4e41..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !LANGUAGE: warn:Coroutines -ReleaseCoroutines - -suspend fun suspendHere(): String = "OK" - -fun builder(c: suspend () -> Unit) { - -} - -fun box(): String { - var result = "" - - builder { - suspendHere() - } - - return result -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.txt deleted file mode 100644 index 9ca783c969d..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.txt +++ /dev/null @@ -1,5 +0,0 @@ -package - -public fun box(): kotlin.String -public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit -public suspend fun suspendHere(): kotlin.String diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.fir.kt deleted file mode 100644 index 889f79e95eb..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.fir.kt +++ /dev/null @@ -1,38 +0,0 @@ -// !LANGUAGE: -ReleaseCoroutines -// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_FEATURE_WARNING -// !CHECK_TYPE -// !WITH_NEW_INFERENCE -// SKIP_TXT - -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -class Controller { - suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn { - if (hashCode() % 2 == 0) { - it.resume(Unit) - COROUTINE_SUSPENDED - } - else { - Unit - } - } - suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn { - it.resume(1) - it checkType { _>() } - it.resume("") - - // We can return anything here, 'suspendCoroutineUninterceptedOrReturn' is not very type-safe - // Also we can call resume and then return the value too, but it's still just our problem - "Not-int" - } -} - -fun builder(c: suspend Controller.() -> Unit) {} - -fun test() { - builder { - noParams() checkType { _() } - yieldString("abc") checkType { _() } - } -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt deleted file mode 100644 index 35cb9f5f308..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt +++ /dev/null @@ -1,38 +0,0 @@ -// !LANGUAGE: -ReleaseCoroutines -// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_FEATURE_WARNING -// !CHECK_TYPE -// !WITH_NEW_INFERENCE -// SKIP_TXT - -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -class Controller { - suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn { - if (hashCode() % 2 == 0) { - it.resume(Unit) - COROUTINE_SUSPENDED - } - else { - Unit - } - } - suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn { - it.resume(1) - it checkType { _>() } - it.resume("") - - // We can return anything here, 'suspendCoroutineUninterceptedOrReturn' is not very type-safe - // Also we can call resume and then return the value too, but it's still just our problem - "Not-int" - } -} - -fun builder(c: suspend Controller.() -> Unit) {} - -fun test() { - builder { - noParams() checkType { _() } - yieldString("abc") checkType { _() } - } -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.fir.kt deleted file mode 100644 index c0821913df0..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !LANGUAGE: -Coroutines -ReleaseCoroutines - -suspend fun suspendHere(): String = "OK" - -fun builder(c: suspend () -> Unit) { - -} - -fun box(): String { - var result = "" - - builder { - suspendHere() - } - - return result -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt deleted file mode 100644 index d50e9e74102..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !LANGUAGE: -Coroutines -ReleaseCoroutines - -suspend fun suspendHere(): String = "OK" - -fun builder(c: suspend () -> Unit) { - -} - -fun box(): String { - var result = "" - - builder { - suspendHere() - } - - return result -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.txt deleted file mode 100644 index 9ca783c969d..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.txt +++ /dev/null @@ -1,5 +0,0 @@ -package - -public fun box(): kotlin.String -public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit -public suspend fun suspendHere(): kotlin.String diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index fa340eff3e9..a975a69d80f 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -32465,18 +32465,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt"); } - @Test - @TestMetadata("coroutinesDisabled.kt") - public void testCoroutinesDisabled() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt"); - } - - @Test - @TestMetadata("coroutinesEnabledWithWarning.kt") - public void testCoroutinesEnabledWithWarning() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt"); - } - @Test @TestMetadata("illegalSuspendCalls.kt") public void testIllegalSuspendCalls() throws Exception { @@ -32615,12 +32603,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt"); } - @Test - @TestMetadata("suspendCoroutineOrReturn_1_2.kt") - public void testSuspendCoroutineOrReturn_1_2() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt"); - } - @Test @TestMetadata("suspendCovarianJavaOverride.kt") public void testSuspendCovarianJavaOverride() throws Exception { @@ -32705,12 +32687,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt"); } - @Test - @TestMetadata("unsupported.kt") - public void testUnsupported() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt"); - } - @Test @TestMetadata("usageOfResultTypeInReturnType.kt") public void testUsageOfResultTypeInReturnType() throws Exception { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt index 32884eee355..dece03d206f 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt @@ -5,62 +5,37 @@ package org.jetbrains.kotlin -import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.test.TargetBackend // Add the directive `// WITH_COROUTINES` to use these helpers in codegen tests (see TestFiles.java). -fun createTextForCoroutineHelpers(isReleaseCoroutines: Boolean, checkStateMachine: Boolean, checkTailCallOptimization: Boolean): String { - val coroutinesPackage = - if (isReleaseCoroutines) - StandardNames.COROUTINES_PACKAGE_FQ_NAME_RELEASE.asString() - else - StandardNames.COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.asString() - +fun createTextForCoroutineHelpers(checkStateMachine: Boolean, checkTailCallOptimization: Boolean): String { fun continuationBody(t: String, useResult: (String) -> String) = - if (isReleaseCoroutines) - """ - |override fun resumeWith(result: Result<$t>) { - | ${useResult("result.getOrThrow()")} - |} - """.trimMargin() - else - """ - |override fun resume(data: $t) { ${useResult("data")} } - |override fun resumeWithException(exception: Throwable) { throw exception } - """.trimMargin() + """ + |override fun resumeWith(result: Result<$t>) { + | ${useResult("result.getOrThrow()")} + |} + """.trimMargin() val handleExceptionContinuationBody = - if (isReleaseCoroutines) - """ - |override fun resumeWith(result: Result) { - | result.exceptionOrNull()?.let(x) - |} - """.trimMargin() - else - """ - |override fun resumeWithException(exception: Throwable) { - | x(exception) - |} - | - |override fun resume(data: Any?) {} - """.trimMargin() + """ + |override fun resumeWith(result: Result) { + | result.exceptionOrNull()?.let(x) + |} + """.trimMargin() val continuationAdapterBody = - if (isReleaseCoroutines) - """ - |override fun resumeWith(result: Result) { - | if (result.isSuccess) { - | resume(result.getOrThrow()) - | } else { - | resumeWithException(result.exceptionOrNull()!!) - | } - |} - | - |abstract fun resumeWithException(exception: Throwable) - |abstract fun resume(value: T) - """.trimMargin() - else - "" + """ + |override fun resumeWith(result: Result) { + | if (result.isSuccess) { + | resume(result.getOrThrow()) + | } else { + | resumeWithException(result.exceptionOrNull()!!) + | } + |} + | + |abstract fun resumeWithException(exception: Throwable) + |abstract fun resume(value: T) + """.trimMargin() val checkStateMachineString = """ class StateMachineCheckerClass { @@ -145,9 +120,9 @@ fun createTextForCoroutineHelpers(isReleaseCoroutines: Boolean, checkStateMachin return """ |package helpers - |import $coroutinesPackage.* - |import $coroutinesPackage.intrinsics.* - |${if (checkTailCallOptimization) "import $coroutinesPackage.jvm.internal.*" else ""} + |import kotlin.coroutines.* + |import kotlin.coroutines.intrinsics.* + |${if (checkTailCallOptimization) "import kotlin.coroutines.jvm.internal.*" else ""} | |fun handleResultContinuation(x: (T) -> Unit): Continuation = object: Continuation { | override val context = EmptyCoroutineContext diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java index fa6d858610b..796dd81e0b8 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java @@ -122,8 +122,6 @@ public class TestFiles { assert oldValue == null : "Module with name " + supportModule.name + " already present in file"; } - boolean isReleaseCoroutines = !isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines"); - boolean checkStateMachine = isDirectiveDefined(expectedText, "CHECK_STATE_MACHINE"); boolean checkTailCallOptimization = isDirectiveDefined(expectedText, "CHECK_TAIL_CALL_OPTIMIZATION"); @@ -131,8 +129,7 @@ public class TestFiles { factory.createFile( supportModule, "CoroutineUtil.kt", - TestHelperGeneratorKt.createTextForCoroutineHelpers( - isReleaseCoroutines, checkStateMachine, checkTailCallOptimization), + TestHelperGeneratorKt.createTextForCoroutineHelpers(checkStateMachine, checkTailCallOptimization), parseDirectives(commonPrefixOrWholeFile) )); } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 0707ec688df..5ca776950e8 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -1478,11 +1478,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { public void testSuspendMain() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain.kt"); } - - @TestMetadata("suspendMain_before.kt") - public void testSuspendMain_before() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain_before.kt"); - } } @TestMetadata("compiler/testData/codegen/bytecodeListing/multiplatform") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index 748faa774f3..08d591e4c5e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -4047,11 +4047,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/oldLanguageVersions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } - @TestMetadata("constCoroutine.kt") - public void testConstCoroutine() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/constCoroutine.kt"); - } - @TestMetadata("noInlineJavaProtectedConstants.kt") public void testNoInlineJavaProtectedConstants() throws Exception { runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/noInlineJavaProtectedConstants.kt"); @@ -4075,39 +4070,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { } } - @TestMetadata("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Coroutines extends AbstractBytecodeTextTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); - } - - public void testAllFilesPresentInCoroutines() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); - } - - @TestMetadata("crossinlineSuspendContinuation_1_2.kt") - public void testCrossinlineSuspendContinuation_1_2() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/crossinlineSuspendContinuation_1_2.kt"); - } - - @TestMetadata("doNotReassignContinuation_1_2.kt") - public void testDoNotReassignContinuation_1_2() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/doNotReassignContinuation_1_2.kt"); - } - - @TestMetadata("varValueConflictsWithTableSameSort_1_2.kt") - public void testVarValueConflictsWithTableSameSort_1_2() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTableSameSort_1_2.kt"); - } - - @TestMetadata("varValueConflictsWithTable_1_2.kt") - public void testVarValueConflictsWithTable_1_2() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTable_1_2.kt"); - } - } - @TestMetadata("compiler/testData/codegen/bytecodeText/oldLanguageVersions/ieee754") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index fabfa8b0978..ba3514d2eaf 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -1478,11 +1478,6 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes public void testSuspendMain() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain.kt"); } - - @TestMetadata("suspendMain_before.kt") - public void testSuspendMain_before() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain_before.kt"); - } } @TestMetadata("compiler/testData/codegen/bytecodeListing/multiplatform") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index 82c87d9937a..85e82f97a6c 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -11,7 +11,6 @@ import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.vfs.StandardFileSystems import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.psi.PsiManager -import com.intellij.testFramework.assertEqualsToFile import junit.framework.TestCase import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettings import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings @@ -996,16 +995,6 @@ abstract class BasicBoxTest( InTextDirectivesUtils.findStringWithPrefixes(text, "// LANGUAGE_VERSION:")?.let { LanguageVersion.fromVersionString(it)?.toSettings()?.trySet() } - if (!InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// COMMON_COROUTINES_TEST").isEmpty()) { - assert(!text.contains("COROUTINES_PACKAGE")) { "Must replace COROUTINES_PACKAGE prior to tests compilation" } - if (!coroutinesPackage.isEmpty()) { - if (coroutinesPackage == "kotlin.coroutines.experimental") { - LanguageVersion.KOTLIN_1_2.toSettings().trySet() - } else { - LanguageVersion.KOTLIN_1_3.toSettings().trySet() - } - } - } parseLanguageVersionSettings(directives)?.trySet()