Remove LANGUAGE_VERSION from codegen tests on coroutines

Use `// !LANGUAGE: -ReleaseCoroutines` instead in tests which require
old (1.2) coroutines, and nothing in tests which require new coroutines
because master is already 1.3. Also remove superfluous API_VERSION and
other directives which have no effect anymore. Do not include runtime
automatically with `WITH_COROUTINES`/`COMMON_COROUTINES_TEST` in box
tests; require `WITH_RUNTIME` for that (majority of tests already had it
anyway), but remove it from bytecode text tests where runtime is always
added automatically. Fix the coroutine package selection code in
KotlinTestUtils and update the bunch files correspondingly.

Disable tests in `box/coroutines/noStdLib` on JVM: despite the name,
these tests were launched with stdlib because of the code in
CodegenTestCase, and they do not work without it because at least
CoroutineUtil.kt requires stdlib to compile correctly
This commit is contained in:
Alexander Udalov
2018-12-17 17:35:08 +01:00
parent 5b58eb8491
commit ec2dd58165
75 changed files with 173 additions and 324 deletions
@@ -1,4 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines +ExperimentalBuilderInference
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
@@ -1,4 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines +ExperimentalBuilderInference
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
@@ -1,4 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines +ExperimentalBuilderInference
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
@@ -1,8 +1,9 @@
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.2
import helpers.*
import kotlin.coroutines.experimental.*
@@ -45,4 +46,4 @@ fun getSequence(a: Foo) =
}
}
yield("end")
}
}
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.3
import helpers.*
import kotlin.coroutines.*
@@ -44,4 +44,4 @@ fun getSequence(a: Foo) =
}
}
yield("end")
}
}
@@ -1,9 +1,9 @@
// LANGUAGE_VERSION: 1.3
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -1,9 +1,9 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
@@ -1,4 +1,3 @@
// LANGUAGE_VERSION: 1.3
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
@@ -1,9 +1,10 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED
@@ -1,5 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,5 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -49,14 +47,14 @@ fun box(): String {
builder {
foo()
}
if (!"$continuation".contains("21")) return "$continuation"
if (!"$continuation".contains("19")) return "$continuation"
continuation!!.resumeWith(Result.success(Unit))
if (!"$continuation".contains("22")) return "$continuation"
if (!"$continuation".contains("20")) return "$continuation"
builder {
lambda()
}
if (!"$continuation".contains("33")) return "$continuation"
if (!"$continuation".contains("31")) return "$continuation"
continuation!!.resumeWith(Result.success(Unit))
if (!"$continuation".contains("34")) return "$continuation"
if (!"$continuation".contains("32")) return "$continuation"
return "OK"
}
@@ -1,5 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,5 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -49,14 +47,14 @@ fun box(): String {
builder {
res = named()
}
if (res != Pair("runtimeDebugMetadata.kt", 35)) {
if (res != Pair("runtimeDebugMetadata.kt", 33)) {
return "" + res
}
builder {
dummy()
res = getSourceFileAndLineNumberFromContinuation()
}
if (res != Pair("runtimeDebugMetadata.kt", 57)) {
if (res != Pair("runtimeDebugMetadata.kt", 55)) {
return "" + res
}
@@ -64,8 +62,8 @@ fun box(): String {
suspended()
}
res = (continuation!! as BaseContinuationImpl).getSourceFileAndLineNumber()
if (res != Pair("runtimeDebugMetadata.kt", 40)) {
if (res != Pair("runtimeDebugMetadata.kt", 38)) {
return "" + res
}
return "OK"
}
}
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
@@ -1,4 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// WITH_REFLECT
// WITH_COROUTINES
@@ -1,9 +1,6 @@
// !LANGUAGE: +ReleaseCoroutines
// !API_VERSION: 1.3
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
@@ -1,5 +1,3 @@
// !LANGUAGE: +ReleaseCoroutines
// !API_VERSION: 1.3
// IGNORE_BACKEND: JS, JS_IR, NATIVE
// IGNORE_BACKEND: JVM_IR
// WITH_COROUTINES
@@ -33,4 +31,4 @@ class Checker {
}
// FILE: box.kt
fun box() = Checker.check()
fun box() = Checker.check()
@@ -1,10 +1,6 @@
// !LANGUAGE: +ReleaseCoroutines
// !API_VERSION: 1.3
// IGNORE_BACKEND: JS, NATIVE, JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_REFLECT
// WITH_RUNTIME
// WITH_COROUTINES
import kotlin.test.assertEquals
@@ -1,10 +1,6 @@
// !LANGUAGE: +ReleaseCoroutines
// !API_VERSION: 1.3
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JVM_IR
// WITH_REFLECT
// WITH_RUNTIME
// WITH_COROUTINES
import kotlin.test.assertEquals
@@ -1,10 +1,6 @@
// !LANGUAGE: +ReleaseCoroutines
// !API_VERSION: 1.3
// TODO: muted automatically, investigate should it be ran for JS or not
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS, NATIVE, JS_IR
// IGNORE_LIGHT_ANALYSIS
// WITH_RUNTIME
// WITH_COROUTINES
@@ -1,9 +1,5 @@
// !LANGUAGE: +ReleaseCoroutines
// !API_VERSION: 1.3
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS, JS_IR, JVM_IR, NATIVE
// WITH_RUNTIME
fun box(): String {
suspend fun bar() {}
@@ -1,9 +1,8 @@
// !LANGUAGE: +ReleaseCoroutines
// !API_VERSION: 1.3
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JVM_IR
// WITH_COROUTINES
// WITH_RUNTIME
import helpers.*
import kotlin.coroutines.*
@@ -1,8 +1,8 @@
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JS_IR, JS
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.2
import helpers.*
import kotlin.coroutines.*
@@ -16,4 +16,4 @@ fun box(): String {
assert(suspendLambda0 is SuspendFunction0<*>) { "Failed: suspendLambda0 is SuspendFunction0<*>" }
return "OK"
}
}
@@ -3,7 +3,6 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.3
import helpers.*
import kotlin.coroutines.*
@@ -65,4 +64,4 @@ fun box(): String {
checkReified<suspend () -> Unit> {}
return "OK"
}
}
@@ -1,4 +1,3 @@
// LANGUAGE_VERSION: 1.3
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
@@ -1,8 +1,9 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
// TARGET_BACKEND: JVM
import kotlin.coroutines.experimental.*
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.3
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -1,4 +1,3 @@
// LANGUAGE_VERSION: 1.3
// WITH_RUNTIME
// WITH_COROUTINES
// TARGET_BACKEND: JVM
@@ -1,6 +1,6 @@
// LANGUAGE_VERSION: 1.3
// IGNORE_BACKEND: NATIVE, JS, JS_IR, JVM_IR
// WITH_COROUTINES
// WITH_RUNTIME
// MODULE: lib
// FILE: lib.kt
interface I {}
@@ -1,10 +1,11 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: NATIVE, JS, JS_IR
// WITH_COROUTINES
// WITH_RUNTIME
// MODULE: lib
// FILE: lib.kt
interface I {}
suspend inline fun foo() = object : I {}
@@ -1,12 +1,11 @@
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS, JVM, JVM_IR
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
class Controller {
var result = ""
@@ -1,11 +1,11 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JVM, JVM_IR
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
class Controller {
var result = ""
@@ -1,7 +1,8 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JVM, JVM_IR
// COMMON_COROUTINES_TEST
// WITH_COROUTINES
// CHECK_BYTECODE_LISTING
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
@@ -73,4 +74,4 @@ fun box(): String {
}
if (res != 12) return "FAIL"
return "OK"
}
}
@@ -1,11 +1,11 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JVM, JVM_IR
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
class Controller {
var result = ""
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JVM, JVM_IR
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
@@ -1,11 +1,11 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JVM, JVM_IR
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
class Controller {
var result = ""
@@ -1,9 +1,6 @@
// !LANGUAGE: +ReleaseCoroutines
// WITH_COROUTINES
// WITH_REFLECT
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
import helpers.*
@@ -66,4 +63,4 @@ fun box(): String {
proceed()
if (log != "before;suspended;after;") return log
return res ?: "FAIL 4"
}
}
@@ -1,9 +1,6 @@
// !LANGUAGE: +ReleaseCoroutines
// WITH_COROUTINES
// WITH_REFLECT
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
import helpers.*
@@ -74,4 +71,4 @@ fun box(): String {
proceed()
if (log != "before;suspended;after;") return log
return res ?: "FAIL 5"
}
}
@@ -1,4 +1,4 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// WITH_COROUTINES
// WITH_REFLECT
@@ -1,4 +1,3 @@
// LANGUAGE_VERSION: 1.3
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
@@ -1,4 +1,4 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,8 +1,9 @@
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.2
import helpers.*
import kotlin.coroutines.experimental.*
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.3
import helpers.*
import kotlin.coroutines.*
@@ -1,4 +1,3 @@
// LANGUAGE_VERSION: 1.3
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
@@ -1,16 +1,15 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
// WITH_COROUTINES
// FILE: main.kt
// TARGET_BACKEND: JVM
import helpers.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
open class A(val v: String) {
suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x ->
x.resume(v)
@@ -1,4 +1,3 @@
// LANGUAGE_VERSION: 1.3
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
@@ -1,4 +1,4 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,9 +1,8 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// FILE: inlined.kt
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// FILE: inlined.kt
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -1,9 +1,8 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// FILE: inlined.kt
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// FILE: inlined.kt
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -1,4 +1,6 @@
// COMMON_COROUTINES_TEST
// WITH_RUNTIME
suspend fun empty() {}
suspend fun withoutReturn() { empty() }
suspend fun withReturn() { return empty() }
@@ -1,4 +1,6 @@
// COMMON_COROUTINES_TEST
// WITH_RUNTIME
suspend fun catchException(): String {
try {
return suspendWithException()
@@ -1,4 +1,6 @@
// COMMON_COROUTINES_TEST
// WITH_RUNTIME
suspend fun empty() {}
suspend fun withoutReturn() {
empty()
+4 -2
View File
@@ -1,10 +1,12 @@
// LANGUAGE_VERSION: 1.2
// !LANGUAGE: -ReleaseCoroutines
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
// TREAT_AS_ONE_FILE
import helpers.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
suspend fun suspendHere() = ""
fun builder(c: suspend () -> Unit) {
@@ -1,7 +1,6 @@
// WITH_RUNTIME
// LANGUAGE_VERSION: 1.2
// IGNORE_BACKEND: JVM
// !LANGUAGE: -ReleaseCoroutines
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
@@ -29,4 +28,4 @@ fun box(): String {
// 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
// 0 TABLESWITCH
@@ -1,6 +1,5 @@
// WITH_RUNTIME
// LANGUAGE_VERSION: 1.3
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
@@ -28,4 +27,4 @@ fun box(): String {
// Test for continuation of 'run' transformation.
// Since continuation is not suspend lambda, it should not have state-machine
// @CrossinlineSuspendContinuation_1_3Kt$box$1$invokeSuspend$$inlined$inlineMe$1$1.class:
// 0 TABLESWITCH
// 0 TABLESWITCH
@@ -1,5 +1,3 @@
// LANGUAGE_VERSION: 1.3
suspend fun dummy() {}
suspend fun tailCall() {
@@ -1,5 +1,3 @@
// LANGUAGE_VERSION: 1.3
import kotlin.sequences.*
import kotlin.experimental.*
@@ -17,4 +15,4 @@ fun main(args: Array<String>) {
suspend fun SequenceScope<Int>.awaitSeq(): Int = 42
// 1 LOCALVARIABLE a I L19 L23 3
// 1 LINENUMBER 10 L19
// 1 LINENUMBER 8 L19
@@ -1,5 +1,3 @@
// LANGUAGE_VERSION: 1.3
// WITH_RUNTIME
// TREAT_AS_ONE_FILE
import kotlin.coroutines.intrinsics.*
@@ -14,4 +12,4 @@ suspend fun simpleReturn() = suspendCoroutineUninterceptedOrReturn<Int> { cont -
cont.resume(0)
}
// 2 INVOKESTATIC kotlin/coroutines/jvm/internal/DebugProbesKt.probeCoroutineSuspended
// 2 INVOKESTATIC kotlin/coroutines/jvm/internal/DebugProbesKt.probeCoroutineSuspended
@@ -1,5 +1,3 @@
// LANGUAGE_VERSION: 1.3
suspend fun dummy() {}
val c: suspend () -> Unit = {
@@ -21,4 +19,4 @@ class A {
// 1 LOCALVARIABLE a LA; L0 L21 1
// 1 LOCALVARIABLE s Ljava/lang/String; L0 L21 2
// 1 LOCALVARIABLE block Lkotlin/jvm/functions/Function2; L0 L21 3
// 1 LOCALVARIABLE \$continuation Lkotlin/coroutines/Continuation; L2 L7 6
// 1 LOCALVARIABLE \$continuation Lkotlin/coroutines/Continuation; L2 L7 6
@@ -1,6 +1,5 @@
// LANGUAGE_VERSION: 1.3
// WITH_RUNTIME
// TREAT_AS_ONE_FILE
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
@@ -1,6 +1,6 @@
// LANGUAGE_VERSION: 1.2
// WITH_RUNTIME
// !LANGUAGE: -ReleaseCoroutines
// WITH_COROUTINES
import helpers.*
// TREAT_AS_ONE_FILE
import kotlin.coroutines.experimental.*
@@ -1,6 +1,5 @@
// LANGUAGE_VERSION: 1.3
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
// TREAT_AS_ONE_FILE
import kotlin.coroutines.*
@@ -1,6 +1,5 @@
// LANGUAGE_VERSION: 1.3
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
// TREAT_AS_ONE_FILE
import kotlin.coroutines.*
@@ -1,6 +1,6 @@
// LANGUAGE_VERSION: 1.2
// WITH_RUNTIME
// !LANGUAGE: -ReleaseCoroutines
// WITH_COROUTINES
import helpers.*
// TREAT_AS_ONE_FILE
import kotlin.coroutines.experimental.*
@@ -1,6 +1,6 @@
// LANGUAGE_VERSION: 1.2
// WITH_RUNTIME
// !LANGUAGE: -ReleaseCoroutines
// WITH_COROUTINES
import helpers.*
// TREAT_AS_ONE_FILE
import kotlin.coroutines.experimental.*
@@ -18,8 +18,8 @@ import kotlin.script.experimental.dependencies.ScriptDependencies;
import kotlin.text.Charsets;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.TestsCompiletimeError;
import org.jetbrains.kotlin.TestsCompilerError;
import org.jetbrains.kotlin.TestsCompiletimeError;
import org.jetbrains.kotlin.backend.common.output.OutputFile;
import org.jetbrains.kotlin.backend.common.output.SimpleOutputFileCollection;
import org.jetbrains.kotlin.checkers.CheckerTestUtil;
@@ -70,7 +70,6 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettingsKt.API_VERSION_DIRECTIVE;
import static org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettingsKt.parseLanguageVersionSettings;
import static org.jetbrains.kotlin.cli.common.output.OutputUtilsKt.writeAllTo;
import static org.jetbrains.kotlin.codegen.CodegenTestUtil.*;
@@ -724,13 +723,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
protected ConfigurationKind extractConfigurationKind(@NotNull List<TestFile> files) {
boolean addRuntime = false;
boolean addReflect = false;
boolean addCoroutines = false;
for (TestFile file : files) {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "COMMON_COROUTINES_TEST") ||
InTextDirectivesUtils.isDirectiveDefined(file.content, "!LANGUAGE: +ReleaseCoroutines") ||
InTextDirectivesUtils.isDirectiveDefined(file.content, "LANGUAGE_VERSION: 1.3")) {
addCoroutines = true;
}
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_RUNTIME")) {
addRuntime = true;
}
@@ -740,7 +733,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
}
return addReflect ? ConfigurationKind.ALL :
(addRuntime || addCoroutines) ? ConfigurationKind.NO_KOTLIN_REFLECT :
addRuntime ? ConfigurationKind.NO_KOTLIN_REFLECT :
ConfigurationKind.JDK_ONLY;
}
@@ -798,14 +798,10 @@ public class KotlinTestUtils {
if (isDirectiveDefined(expectedText, "WITH_COROUTINES")) {
M supportModule = hasModules ? factory.createModule("support", Collections.emptyList(), Collections.emptyList()) : null;
if (coroutinesPackage.isEmpty()) {
coroutinesPackage = "kotlin.coroutines.experimental";
}
boolean isReleaseCoroutines =
!coroutinesPackage.contains("experimental") ||
isDirectiveDefined(expectedText, "LANGUAGE_VERSION: 1.3") ||
isDirectiveDefined(expectedText, "!LANGUAGE: +ReleaseCoroutines");
!coroutinesPackage.contains("experimental") &&
!isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines");
testFiles.add(factory.createFile(supportModule,
"CoroutineUtil.kt",
@@ -36,6 +36,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.kotlin.CoroutineTestUtilKt;
import org.jetbrains.kotlin.analyzer.AnalysisResult;
import org.jetbrains.kotlin.builtins.DefaultBuiltIns;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
@@ -793,36 +794,14 @@ public class KotlinTestUtils {
if (isDirectiveDefined(expectedText, "WITH_COROUTINES")) {
M supportModule = hasModules ? factory.createModule("support", Collections.emptyList(), Collections.emptyList()) : null;
if (coroutinesPackage.isEmpty()) {
coroutinesPackage = "kotlin.coroutines.experimental";
}
boolean isReleaseCoroutines =
!coroutinesPackage.contains("experimental") &&
!isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines");
testFiles.add(factory.createFile(supportModule,
"CoroutineUtil.kt",
"package helpers\n" +
"import " + coroutinesPackage + ".*\n" +
"fun <T> handleResultContinuation(x: (T) -> Unit): Continuation<T> = object: Continuation<T> {\n" +
" override val context = EmptyCoroutineContext\n" +
" override fun resumeWithException(exception: Throwable) {\n" +
" throw exception\n" +
" }\n" +
"\n" +
" override fun resume(data: T) = x(data)\n" +
"}\n" +
"\n" +
"fun handleExceptionContinuation(x: (Throwable) -> Unit): Continuation<Any?> = object: Continuation<Any?> {\n" +
" override val context = EmptyCoroutineContext\n" +
" override fun resumeWithException(exception: Throwable) {\n" +
" x(exception)\n" +
" }\n" +
"\n" +
" override fun resume(data: Any?) { }\n" +
"}\n" +
"\n" +
"open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation<Any?> {\n" +
" companion object : EmptyContinuation()\n" +
" override fun resume(data: Any?) {}\n" +
" override fun resumeWithException(exception: Throwable) { throw exception }\n" +
"}",
CoroutineTestUtilKt.createTextForHelpers(isReleaseCoroutines),
directives
));
}
@@ -35,6 +35,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.kotlin.CoroutineTestUtilKt;
import org.jetbrains.kotlin.analyzer.AnalysisResult;
import org.jetbrains.kotlin.builtins.DefaultBuiltIns;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
@@ -793,36 +794,14 @@ public class KotlinTestUtils {
if (isDirectiveDefined(expectedText, "WITH_COROUTINES")) {
M supportModule = hasModules ? factory.createModule("support", Collections.emptyList(), Collections.emptyList()) : null;
if (coroutinesPackage.isEmpty()) {
coroutinesPackage = "kotlin.coroutines.experimental";
}
boolean isReleaseCoroutines =
!coroutinesPackage.contains("experimental") &&
!isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines");
testFiles.add(factory.createFile(supportModule,
"CoroutineUtil.kt",
"package helpers\n" +
"import " + coroutinesPackage + ".*\n" +
"fun <T> handleResultContinuation(x: (T) -> Unit): Continuation<T> = object: Continuation<T> {\n" +
" override val context = EmptyCoroutineContext\n" +
" override fun resumeWithException(exception: Throwable) {\n" +
" throw exception\n" +
" }\n" +
"\n" +
" override fun resume(data: T) = x(data)\n" +
"}\n" +
"\n" +
"fun handleExceptionContinuation(x: (Throwable) -> Unit): Continuation<Any?> = object: Continuation<Any?> {\n" +
" override val context = EmptyCoroutineContext\n" +
" override fun resumeWithException(exception: Throwable) {\n" +
" x(exception)\n" +
" }\n" +
"\n" +
" override fun resume(data: Any?) { }\n" +
"}\n" +
"\n" +
"open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation<Any?> {\n" +
" companion object : EmptyContinuation()\n" +
" override fun resume(data: Any?) {}\n" +
" override fun resumeWithException(exception: Throwable) { throw exception }\n" +
"}",
CoroutineTestUtilKt.createTextForHelpers(isReleaseCoroutines),
directives
));
}
@@ -35,6 +35,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.kotlin.CoroutineTestUtilKt;
import org.jetbrains.kotlin.analyzer.AnalysisResult;
import org.jetbrains.kotlin.builtins.DefaultBuiltIns;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
@@ -793,36 +794,14 @@ public class KotlinTestUtils {
if (isDirectiveDefined(expectedText, "WITH_COROUTINES")) {
M supportModule = hasModules ? factory.createModule("support", Collections.emptyList(), Collections.emptyList()) : null;
if (coroutinesPackage.isEmpty()) {
coroutinesPackage = "kotlin.coroutines.experimental";
}
boolean isReleaseCoroutines =
!coroutinesPackage.contains("experimental") &&
!isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines");
testFiles.add(factory.createFile(supportModule,
"CoroutineUtil.kt",
"package helpers\n" +
"import " + coroutinesPackage + ".*\n" +
"fun <T> handleResultContinuation(x: (T) -> Unit): Continuation<T> = object: Continuation<T> {\n" +
" override val context = EmptyCoroutineContext\n" +
" override fun resumeWithException(exception: Throwable) {\n" +
" throw exception\n" +
" }\n" +
"\n" +
" override fun resume(data: T) = x(data)\n" +
"}\n" +
"\n" +
"fun handleExceptionContinuation(x: (Throwable) -> Unit): Continuation<Any?> = object: Continuation<Any?> {\n" +
" override val context = EmptyCoroutineContext\n" +
" override fun resumeWithException(exception: Throwable) {\n" +
" x(exception)\n" +
" }\n" +
"\n" +
" override fun resume(data: Any?) { }\n" +
"}\n" +
"\n" +
"open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation<Any?> {\n" +
" companion object : EmptyContinuation()\n" +
" override fun resume(data: Any?) {}\n" +
" override fun resumeWithException(exception: Throwable) { throw exception }\n" +
"}",
CoroutineTestUtilKt.createTextForHelpers(isReleaseCoroutines),
directives
));
}
@@ -7489,6 +7489,66 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class NoStdLib extends AbstractLightAnalysisModeTest {
@TestMetadata("breakFinally.kt")
public void ignoreBreakFinally_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakFinally.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("breakFinally.kt")
public void ignoreBreakFinally_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakFinally.kt", "kotlin.coroutines");
}
@TestMetadata("breakStatement.kt")
public void ignoreBreakStatement_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakStatement.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("breakStatement.kt")
public void ignoreBreakStatement_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakStatement.kt", "kotlin.coroutines");
}
@TestMetadata("crossinline.kt")
public void ignoreCrossinline_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/crossinline.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("crossinline.kt")
public void ignoreCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/crossinline.kt", "kotlin.coroutines");
}
@TestMetadata("ifStatement.kt")
public void ignoreIfStatement_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/ifStatement.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("ifStatement.kt")
public void ignoreIfStatement_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/ifStatement.kt", "kotlin.coroutines");
}
@TestMetadata("stateMachine.kt")
public void ignoreStateMachine_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/stateMachine.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("stateMachine.kt")
public void ignoreStateMachine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/stateMachine.kt", "kotlin.coroutines");
}
@TestMetadata("switchLikeWhen.kt")
public void ignoreSwitchLikeWhen_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/switchLikeWhen.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("switchLikeWhen.kt")
public void ignoreSwitchLikeWhen_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/switchLikeWhen.kt", "kotlin.coroutines");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@@ -7500,66 +7560,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
public void testAllFilesPresentInNoStdLib() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/noStdLib"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("breakFinally.kt")
public void testBreakFinally_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakFinally.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("breakFinally.kt")
public void testBreakFinally_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakFinally.kt", "kotlin.coroutines");
}
@TestMetadata("breakStatement.kt")
public void testBreakStatement_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakStatement.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("breakStatement.kt")
public void testBreakStatement_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/breakStatement.kt", "kotlin.coroutines");
}
@TestMetadata("crossinline.kt")
public void testCrossinline_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/crossinline.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("crossinline.kt")
public void testCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/crossinline.kt", "kotlin.coroutines");
}
@TestMetadata("ifStatement.kt")
public void testIfStatement_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/ifStatement.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("ifStatement.kt")
public void testIfStatement_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/ifStatement.kt", "kotlin.coroutines");
}
@TestMetadata("stateMachine.kt")
public void testStateMachine_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/stateMachine.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("stateMachine.kt")
public void testStateMachine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/stateMachine.kt", "kotlin.coroutines");
}
@TestMetadata("switchLikeWhen.kt")
public void testSwitchLikeWhen_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/switchLikeWhen.kt", "kotlin.coroutines.experimental");
}
@TestMetadata("switchLikeWhen.kt")
public void testSwitchLikeWhen_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/noStdLib/switchLikeWhen.kt", "kotlin.coroutines");
}
}
@TestMetadata("compiler/testData/codegen/box/coroutines/redundantLocalsElimination")
@@ -5846,11 +5846,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/genericCallableReferencesWithNullableTypes.kt");
}
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/getArityViaFunctionImpl.kt");
}
@TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/local")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -6341,16 +6336,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/reflect"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("callSuspend.kt")
public void testCallSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt");
}
@TestMetadata("callSuspendBy.kt")
public void testCallSuspendBy() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt");
}
@TestMetadata("isSuspend12.kt")
public void testIsSuspend12() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/reflect/isSuspend12.kt");
@@ -6411,11 +6411,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/genericCallableReferencesWithNullableTypes.kt");
}
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/getArityViaFunctionImpl.kt");
}
@TestMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/local")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -7186,16 +7181,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/coroutines/reflect"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("callSuspend.kt")
public void testCallSuspend() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt");
}
@TestMetadata("callSuspendBy.kt")
public void testCallSuspendBy() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt");
}
@TestMetadata("isSuspend12.kt")
public void testIsSuspend12() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/reflect/isSuspend12.kt");