Remove tests on -Xuse-ir compiler flag

This flag is going to be removed because old backend is not supported
anymore, therefore there's no need to test it.
This commit is contained in:
Alexander Udalov
2023-05-19 16:54:29 +02:00
committed by Space Team
parent 22096cec3c
commit bb4bb58453
61 changed files with 24 additions and 429 deletions
-2
View File
@@ -699,11 +699,9 @@ tasks {
register("scriptingJvmTest") {
dependsOn("dist")
dependsOn(":kotlin-scripting-compiler:test")
dependsOn(":kotlin-scripting-compiler:testWithIr")
dependsOn(":kotlin-scripting-common:test")
dependsOn(":kotlin-scripting-jvm:test")
dependsOn(":kotlin-scripting-jvm-host-test:test")
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
dependsOn(":kotlin-scripting-dependencies:test")
dependsOn(":kotlin-scripting-dependencies-maven:test")
dependsOn(":kotlin-scripting-jsr223-test:test")
@@ -1,5 +1,4 @@
$TESTDATA_DIR$/simple.kt
-d
$TEMP_DIR$
-Xuse-ir
-Xabi-stability=unknown
-4
View File
@@ -1,4 +0,0 @@
$TESTDATA_DIR$/inlineCycle.kt
-d
$TEMP_DIR$
-Xuse-ir
-7
View File
@@ -1,7 +0,0 @@
compiler/testData/cli/jvm/inlineCycle.kt:2:5: error: the 'b' invocation is a part of inline cycle
b(q)
^
compiler/testData/cli/jvm/inlineCycle.kt:18:5: error: the 'a' invocation is a part of inline cycle
a(p)
^
COMPILATION_ERROR
-8
View File
@@ -1,8 +0,0 @@
$TESTDATA_DIR$/simple.kt
-d
$TEMP_DIR$
-language-version
1.4
-api-version
1.4
-Xuse-ir
-2
View File
@@ -1,2 +0,0 @@
warning: language version 1.4 is deprecated and its support will be removed in a future version of Kotlin
OK
-13
View File
@@ -1,13 +0,0 @@
// This test checks that with -language-version 1.4 we're using the old JVM backend,
// and with -language-version 1.5 -- the new JVM IR backend.
// JVM IR doesn't produce classes for local functions, so the test checks which backend
// is used by asserting that the file for the anonymous class does or doesn't exist.
// Feel free to remove both _1_4 and _1_5 tests as soon as either the old JVM backend
// or LV 1.4 is removed, whichever happens earlier.
class C {
fun test() {
fun local() {}
}
}
-5
View File
@@ -1,5 +0,0 @@
$TESTDATA_DIR$/jvmIrByDefault.kt
-d
$TEMP_DIR$
-language-version
1.4
-2
View File
@@ -1,2 +0,0 @@
warning: language version 1.4 is deprecated and its support will be removed in a future version of Kotlin
OK
-1
View File
@@ -1 +0,0 @@
// EXISTS: C$test$1.class
-5
View File
@@ -1,5 +0,0 @@
$TESTDATA_DIR$/jvmIrByDefault.kt
-d
$TEMP_DIR$
-language-version
1.5
-2
View File
@@ -1,2 +0,0 @@
warning: language version 1.5 is deprecated and its support will be removed in a future version of Kotlin
OK
-1
View File
@@ -1 +0,0 @@
// ABSENT: C$test$1.class
-1
View File
@@ -1,5 +1,4 @@
-d
$TEMP_DIR$
-Xuse-ir
-Xverbose-phases=qz,qq
$TESTDATA_DIR$/simple.kt
-5
View File
@@ -1,5 +0,0 @@
$TESTDATA_DIR$/nonLocalDisabled.kt
-Xno-inline
-d
$TEMP_DIR$
-Xuse-ir
-7
View File
@@ -1,7 +0,0 @@
compiler/testData/cli/jvm/nonLocalDisabled.kt:3:9: error: non-local returns are not allowed with inlining disabled
return
^
compiler/testData/cli/jvm/nonLocalDisabled.kt:7:9: error: non-local returns are not allowed with inlining disabled
return@a
^
COMPILATION_ERROR
@@ -1,10 +0,0 @@
package a
import kotlin.reflect.KClass
interface A {
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE_PARAMETER)
annotation class Anno(val value: String)
}
annotation class K(val klass: KClass<*>)
@@ -1,10 +0,0 @@
package b
import a.*
@A.Anno("B")
interface B {
@A.Anno("foo")
@K(A.Anno::class)
fun <@A.Anno("T") T> foo(t: T) = t
}
@@ -1,8 +0,0 @@
package c
import b.B
// There should be _no_ error despite the fact that B and B#foo are annotated with an annotation which cannot be resolved
fun bar(b: B) {
b.foo("")
}
@@ -1,7 +0,0 @@
package test
enum class E { ENTRY }
annotation class Anno(val e: E)
@Anno(E.ENTRY) open class Class
@@ -1,14 +0,0 @@
package test
public final annotation class Anno : kotlin.Annotation {
public constructor Anno(/*0*/ e: test.E)
public final val e: test.E
}
@test.Anno(e = E.ENTRY) public open class Class {
public constructor Class()
}
public final class Subclass : test.Class {
public constructor Subclass()
}
@@ -1 +0,0 @@
Return code: 0
@@ -1,6 +0,0 @@
package Hello
fun main(args: kotlin.Array<kotlin.String>) {
args.size
System.out.println("Hello from fully qualified main!")
}
@@ -1,4 +0,0 @@
OUT:
Hello from fully qualified main!
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,5 +0,0 @@
package Hello
fun main() {
System.out.println("Hello!")
}
@@ -1,4 +0,0 @@
OUT:
Hello!
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,10 +0,0 @@
package Hello
fun main(args: Array<String>) {
args.size
System.out.println("Hello!")
}
fun main() {
System.out.println("Fail")
}
@@ -1,4 +0,0 @@
OUT:
Hello!
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,5 +0,0 @@
package Hello
fun main() {
System.out.println("Hello!")
}
@@ -1,4 +0,0 @@
OUT:
Hello!
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,35 +0,0 @@
package Hello
import kotlin.concurrent.thread
import kotlin.coroutines.suspendCoroutine
import kotlin.coroutines.resume
@kotlin.jvm.Volatile
private var result = ""
@kotlin.jvm.Volatile
private var callback: Function0<Unit>? = null
suspend fun appendAndSuspend(s: String) {
result += s
suspendCoroutine<Unit> { continuation ->
callback = {
continuation.resume(Unit)
}
}
}
suspend fun main(args: Array<String>) {
thread(isDaemon = true) {
while (true) {
val c = callback
c?.invoke()
Thread.sleep(500)
}
}
appendAndSuspend(args[0])
appendAndSuspend(args[1])
println(result)
callback = null
}
@@ -1,4 +0,0 @@
OUT:
OK
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,37 +0,0 @@
@file:JvmMultifileClass
@file:JvmName("Foo")
package Hello
import kotlin.concurrent.thread
import kotlin.coroutines.suspendCoroutine
import kotlin.coroutines.resume
@kotlin.jvm.Volatile
private var result = ""
@kotlin.jvm.Volatile
private var callback: Function0<Unit>? = null
suspend fun appendAndSuspend(s: String) {
result += s
suspendCoroutine<Unit> { continuation ->
callback = {
continuation.resume(Unit)
}
}
}
suspend fun main(args: Array<String>) {
thread(isDaemon = true) {
while (true) {
val c = callback
c?.invoke()
Thread.sleep(500)
}
}
appendAndSuspend(args[0])
appendAndSuspend(args[1])
println(result)
callback = null
}
@@ -1,4 +0,0 @@
OUT:
OK
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,36 +0,0 @@
package Hello
import kotlin.concurrent.thread
import kotlin.coroutines.suspendCoroutine
import kotlin.coroutines.resume
import kotlin.reflect.jvm.javaMethod
@kotlin.jvm.Volatile
private var result = ""
@kotlin.jvm.Volatile
private var callback: Function0<Unit>? = null
suspend fun appendAndSuspend(s: String) {
result += s
suspendCoroutine<Unit> { continuation ->
callback = {
continuation.resume(Unit)
}
}
}
suspend fun main() {
thread(isDaemon = true) {
while (true) {
val c = callback
c?.invoke()
Thread.sleep(500)
}
}
appendAndSuspend("O")
appendAndSuspend("K")
println(result)
callback = null
}
@@ -1,4 +0,0 @@
OUT:
OK
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,6 +0,0 @@
package Hello
fun main(vararg args: kotlin.String) {
args.size
System.out.println("Hello from vararg main!")
}
@@ -1,4 +0,0 @@
OUT:
Hello from vararg main!
Return code: 0
@@ -1 +0,0 @@
Return code: 0
@@ -1,10 +0,0 @@
package Hello
suspend fun f(o: String, k: String): String {
return o + k
}
suspend fun main(args: Array<String>) {
val result = f(args[0], args[1])
println(result)
}
@@ -1,4 +0,0 @@
OUT:
OK
Return code: 0
@@ -840,16 +840,6 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/jvmDefaultIncorrectValue.args");
}
@TestMetadata("jvmIrByDefault1_4.args")
public void testJvmIrByDefault1_4() throws Exception {
runTest("compiler/testData/cli/jvm/jvmIrByDefault1_4.args");
}
@TestMetadata("jvmIrByDefault1_5.args")
public void testJvmIrByDefault1_5() throws Exception {
runTest("compiler/testData/cli/jvm/jvmIrByDefault1_5.args");
}
@TestMetadata("jvmRecordOk.args")
public void testJvmRecordOk() throws Exception {
runTest("compiler/testData/cli/jvm/jvmRecordOk.args");
@@ -24,7 +24,10 @@ import org.jetbrains.kotlin.utils.StringsKt;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@SuppressWarnings("ResultOfMethodCallIgnored")
public class CompilerSmokeTest extends CompilerSmokeTestBase {
@@ -36,13 +39,6 @@ public class CompilerSmokeTest extends CompilerSmokeTestBase {
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppFQMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
@@ -50,13 +46,6 @@ public class CompilerSmokeTest extends CompilerSmokeTestBase {
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppFQMainIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppVarargMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
@@ -64,13 +53,6 @@ public class CompilerSmokeTest extends CompilerSmokeTestBase {
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppVarargMainIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppSuspendMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
@@ -85,13 +67,6 @@ public class CompilerSmokeTest extends CompilerSmokeTestBase {
run("hello.run", "-cp", jar, "Hello.Foo", "O", "K");
}
public void testHelloAppSuspendMainInMultifileIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.Foo", "O", "K");
}
public void testHelloAppParameterlessMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
@@ -99,13 +74,6 @@ public class CompilerSmokeTest extends CompilerSmokeTestBase {
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppParameterlessMainIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppOldAndParameterlessMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
@@ -113,13 +81,6 @@ public class CompilerSmokeTest extends CompilerSmokeTestBase {
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppOldAndParameterlessMainIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloKt");
}
public void testHelloAppSuspendParameterlessMain() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
@@ -127,20 +88,6 @@ public class CompilerSmokeTest extends CompilerSmokeTestBase {
run("hello.run", "-cp", jar, "Hello.HelloKt", "O", "K");
}
public void testHelloAppSuspendParameterlessMainIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloKt", "O", "K");
}
public void testSimplestSuspendMainIR() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "hello.jar";
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-include-runtime", "-Xuse-ir", "hello.kt", "-d", jar));
run("hello.run", "-cp", jar, "Hello.HelloKt", "O", "K");
}
public void testCompilationFailed() throws Exception {
String jar = tmpdir.getAbsolutePath() + File.separator + "smoke.jar";
@@ -179,11 +179,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
}
fun testMissingEnumReferencedInAnnotationArgument() {
doTestWithTxt(copyJarFileWithoutEntry(compileLibrary("library"), "test/E.class"))
}
fun testMissingEnumReferencedInAnnotationArgumentIr() {
doTestBrokenLibrary("library", "a/E.class", additionalOptions = listOf("-Xuse-ir"))
doTestBrokenLibrary("library", "a/E.class")
}
fun testNoWarningsOnJavaKotlinInheritance() {
@@ -266,10 +262,6 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
doTestBrokenLibrary("library", "a/A\$Anno.class")
}
fun testMissingDependencyNestedAnnotationIr() {
doTestBrokenLibrary("library", "a/A\$Anno.class", additionalOptions = listOf("-Xuse-ir"))
}
fun testMissingDependencyConflictingLibraries() {
val library1 = copyJarFileWithoutEntry(
compileLibrary("library1"),
@@ -680,10 +672,10 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
}
fun testOldJvmAgainstJvmIr() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-ir"))
val library = compileLibrary("library")
compileKotlin("source.kt", tmpdir, listOf(library))
val library2 = compileLibrary("library", additionalOptions = listOf("-Xuse-ir", "-Xabi-stability=stable"))
val library2 = compileLibrary("library", additionalOptions = listOf("-Xabi-stability=stable"))
compileKotlin("source.kt", tmpdir, listOf(library2))
}
@@ -696,7 +688,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
}
fun testOldJvmAgainstJvmIrWithUnstableAbi() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-ir", "-Xabi-stability=unstable"))
val library = compileLibrary("library", additionalOptions = listOf("-Xabi-stability=unstable"))
compileKotlin("source.kt", tmpdir, listOf(library))
}
@@ -43,7 +43,6 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
projectTest(parallel = true) {
dependsOn(":dist")
workingDir = rootDir
systemProperty("kotlin.script.test.base.compiler.arguments", "-Xuse-old-backend")
}
// This doesn;t work now due to conflicts between embeddable compiler contents and intellij sdk modules
@@ -54,12 +53,6 @@ projectTest(parallel = true) {
// classpath = embeddableTestRuntime
//}
projectTest(taskName = "testWithIr", parallel = true) {
dependsOn(":dist")
workingDir = rootDir
systemProperty("kotlin.script.base.compiler.arguments", "-Xuse-ir")
}
projectTest(taskName = "testWithK2", parallel = true) {
dependsOn(":dist")
workingDir = rootDir
@@ -35,24 +35,19 @@ import kotlin.script.experimental.jvmhost.JvmScriptCompiler
*/
class ImplicitsFromScriptResultTest : TestCase() {
fun testImplicits() {
if (System.getProperty("kotlin.script.base.compiler.arguments")?.let {
!it.contains("-Xuse-ir") || it.contains("-Xuse-old-backend")
} == true
) {
// the implementation of the Compiler Host doesn't work with IR - the inter-script symbol table
// should be maintained to make it run (see latest REPL compiler implementations for details
// TODO: consider either fix it or rewrite to the REPL compiler
val host = CompilerHost()
// the implementation of the Compiler Host doesn't work with IR - the inter-script symbol table
// should be maintained to make it run (see latest REPL compiler implementations for details
// TODO: consider either fix it or rewrite to the REPL compiler
val host = CompilerHost()
val snippets = listOf(
"val xyz0 = 42",
"fun f() = xyz0",
"val finalRes = xyz0 + f()",
)
for (snippet in snippets) {
val res = host.compile(snippet)
assertTrue(res is ResultWithDiagnostics.Success)
}
val snippets = listOf(
"val xyz0 = 42",
"fun f() = xyz0",
"val finalRes = xyz0 + f()",
)
for (snippet in snippets) {
val res = host.compile(snippet)
assertTrue(res is ResultWithDiagnostics.Success)
}
}
}
@@ -74,7 +74,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
| apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
| progressiveMode = true
| optIn.add("my.custom.OptInAnnotation")
| freeCompilerArgs.add("-Xuse-ir")
| freeCompilerArgs.add("-Xdebug")
| }
|}
""".trimMargin()
@@ -105,9 +105,9 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
"Compiler arguments does not contain '-opt-in my.custom.OptInAnnotation': $compilationArgs"
}
assert(compilationArgs.contains("-Xuse-ir")) {
assert(compilationArgs.contains("-Xdebug")) {
printBuildOutput()
"Compiler arguments does not contain '-Xuse-ir': $compilationArgs"
"Compiler arguments does not contain '-Xdebug': $compilationArgs"
}
}
}
@@ -132,7 +132,7 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
| apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
| progressiveMode = true
| optIn.add("my.custom.OptInAnnotation")
| freeCompilerArgs.add("-Xuse-ir")
| freeCompilerArgs.add("-Xdebug")
| }
|
| sourceSets.all {
@@ -63,14 +63,6 @@ projectTest(parallel = true) {
dependsOn(":dist")
workingDir = rootDir
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
systemProperty("kotlin.script.test.base.compiler.arguments", "-Xuse-old-backend")
}
projectTest(taskName = "testWithIr", parallel = true) {
dependsOn(":dist")
workingDir = rootDir
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
systemProperty("kotlin.script.test.base.compiler.arguments", "-Xuse-ir")
}
projectTest(taskName = "testWithK2", parallel = true) {