Enable JVM IR by default if language version is >= 1.5
#KT-44021 Fixed
This commit is contained in:
@@ -165,7 +165,12 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
|
||||
put(JVMConfigurationKeys.PARAMETERS_METADATA, arguments.javaParameters)
|
||||
|
||||
val useIR = (arguments.useIR && !arguments.useOldBackend) || arguments.useFir
|
||||
val useIR = arguments.useFir ||
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) {
|
||||
!arguments.useOldBackend
|
||||
} else {
|
||||
arguments.useIR && !arguments.useOldBackend
|
||||
}
|
||||
put(JVMConfigurationKeys.IR, useIR)
|
||||
|
||||
val abiStability = JvmAbiStability.fromStringOrNull(arguments.abiStability)
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// 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() {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/jvmIrByDefault.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.4
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1 @@
|
||||
// EXISTS: C$test$1.class
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/jvmIrByDefault.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.5
|
||||
@@ -0,0 +1,2 @@
|
||||
warning: language version 1.5 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||
OK
|
||||
@@ -0,0 +1 @@
|
||||
// ABSENT: C$test$1.class
|
||||
@@ -541,6 +541,16 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
runTest("compiler/testData/cli/jvm/jvmDefaultAll.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");
|
||||
|
||||
@@ -144,6 +144,7 @@ enum class LanguageFeature(
|
||||
|
||||
AllowSealedInheritorsInDifferentFilesOfSamePackage(KOTLIN_1_5),
|
||||
SealedInterfaces(KOTLIN_1_5),
|
||||
JvmIrEnabledByDefault(KOTLIN_1_5),
|
||||
|
||||
/*
|
||||
* Improvements include the following:
|
||||
|
||||
Reference in New Issue
Block a user