diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt index 60267840fd7..c904fce6bf4 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -171,6 +171,16 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr } else { arguments.useIR && !arguments.useOldBackend } + + if (arguments.useIR && arguments.useOldBackend) { + messageCollector.report( + STRONG_WARNING, + "Both -Xuse-ir and -Xuse-old-backend are passed. This is an inconsistent configuration. " + + "The compiler will use the ${if (useIR) "JVM IR" else "old JVM"} backend" + ) + } + messageCollector.report(LOGGING, "Using ${if (useIR) "JVM IR" else "old JVM"} backend") + put(JVMConfigurationKeys.IR, useIR) val abiStability = JvmAbiStability.fromStringOrNull(arguments.abiStability) diff --git a/compiler/testData/cli/jvm/bothJvmIrAndOldBackend.args b/compiler/testData/cli/jvm/bothJvmIrAndOldBackend.args new file mode 100644 index 00000000000..aaa2e4e226f --- /dev/null +++ b/compiler/testData/cli/jvm/bothJvmIrAndOldBackend.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/simple.kt +-d +$TEMP_DIR$ +-Xuse-ir +-Xuse-old-backend diff --git a/compiler/testData/cli/jvm/bothJvmIrAndOldBackend.out b/compiler/testData/cli/jvm/bothJvmIrAndOldBackend.out new file mode 100644 index 00000000000..c0cc8259fe5 --- /dev/null +++ b/compiler/testData/cli/jvm/bothJvmIrAndOldBackend.out @@ -0,0 +1,2 @@ +warning: both -Xuse-ir and -Xuse-old-backend are passed. This is an inconsistent configuration. The compiler will use the old JVM backend +OK diff --git a/compiler/testData/integration/ant/jvm/verbose/build.log.expected b/compiler/testData/integration/ant/jvm/verbose/build.log.expected index 9591d3091af..663032953a2 100644 --- a/compiler/testData/integration/ant/jvm/verbose/build.log.expected +++ b/compiler/testData/integration/ant/jvm/verbose/build.log.expected @@ -4,6 +4,7 @@ Buildfile: [TestData]/build.xml build: [kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar] [kotlinc] logging: using Kotlin home directory [KotlinProjectHome]/dist/kotlinc + [kotlinc] logging: using old JVM backend [kotlinc] logging: configuring the compilation environment [kotlinc] logging: configure scripting: Added template org.jetbrains.kotlin.mainKts.MainKtsScript from [[CompilerLib]/kotlin-main-kts.jar, [CompilerLib]/kotlin-reflect.jar, [CompilerLib]/kotlin-script-runtime.jar, [CompilerLib]/kotlin-stdlib.jar] diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 4966fb383e0..0890254a7d2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -101,6 +101,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/argumentPassedMultipleTimes.args"); } + @TestMetadata("bothJvmIrAndOldBackend.args") + public void testBothJvmIrAndOldBackend() throws Exception { + runTest("compiler/testData/cli/jvm/bothJvmIrAndOldBackend.args"); + } + @TestMetadata("classAndFileClassClash.args") public void testClassAndFileClassClash() throws Exception { runTest("compiler/testData/cli/jvm/classAndFileClassClash.args");