diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt
index f7f44e5dbbc..dffee8d4eaa 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt
@@ -46,7 +46,7 @@ fun CompilerConfiguration.setupCommonArguments(
val usesK2 = arguments.useK2 || languageVersionSettings.languageVersion.usesK2
put(CommonConfigurationKeys.USE_FIR, usesK2)
- put(CommonConfigurationKeys.USE_LIGHT_TREE, usesK2)
+ put(CommonConfigurationKeys.USE_LIGHT_TREE, arguments.useFirLT)
}
fun CompilerConfiguration.setupLanguageVersionSettings(arguments: A) {
diff --git a/compiler/testData/cli/jvm/firLightTree.kt b/compiler/testData/cli/jvm/firLightTree.kt
new file mode 100644
index 00000000000..0b151211ec7
--- /dev/null
+++ b/compiler/testData/cli/jvm/firLightTree.kt
@@ -0,0 +1,4 @@
+fun List.test() {
+ this += "Alpha"
+ java.lang.System = null
+}
diff --git a/compiler/testData/cli/jvm/firLightTreeOff.args b/compiler/testData/cli/jvm/firLightTreeOff.args
new file mode 100644
index 00000000000..868158ce1d8
--- /dev/null
+++ b/compiler/testData/cli/jvm/firLightTreeOff.args
@@ -0,0 +1,6 @@
+$TESTDATA_DIR$/firLightTree.kt
+-language-version
+2.0
+-Xuse-fir-lt=false
+-d
+$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/firLightTreeOff.out b/compiler/testData/cli/jvm/firLightTreeOff.out
new file mode 100644
index 00000000000..a3ad11a2ed7
--- /dev/null
+++ b/compiler/testData/cli/jvm/firLightTreeOff.out
@@ -0,0 +1,8 @@
+warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
+compiler/testData/cli/jvm/firLightTree.kt:2:5: error: variable expected
+ this += "Alpha"
+ ^
+compiler/testData/cli/jvm/firLightTree.kt:3:15: error: classifier 'class System : Any' does not have a companion object, and thus must be initialized here
+ java.lang.System = null
+ ^
+COMPILATION_ERROR
diff --git a/compiler/testData/cli/jvm/firLightTreeOn.args b/compiler/testData/cli/jvm/firLightTreeOn.args
new file mode 100644
index 00000000000..f32613d9ea9
--- /dev/null
+++ b/compiler/testData/cli/jvm/firLightTreeOn.args
@@ -0,0 +1,6 @@
+$TESTDATA_DIR$/firLightTree.kt
+-language-version
+2.0
+-Xuse-fir-lt=true
+-d
+$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/firLightTreeOn.out b/compiler/testData/cli/jvm/firLightTreeOn.out
new file mode 100644
index 00000000000..59523eeb47b
--- /dev/null
+++ b/compiler/testData/cli/jvm/firLightTreeOn.out
@@ -0,0 +1,5 @@
+warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
+compiler/testData/cli/jvm/firLightTree.kt:3:5: error: classifier 'class System : Any' does not have a companion object, and thus must be initialized here
+ java.lang.System = null
+ ^
+COMPILATION_ERROR
diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java
index 0ab426f8c50..6b57f696488 100644
--- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java
+++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java
@@ -462,6 +462,16 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/firHello20WithOldLV.args");
}
+ @TestMetadata("firLightTreeOff.args")
+ public void testFirLightTreeOff() throws Exception {
+ runTest("compiler/testData/cli/jvm/firLightTreeOff.args");
+ }
+
+ @TestMetadata("firLightTreeOn.args")
+ public void testFirLightTreeOn() throws Exception {
+ runTest("compiler/testData/cli/jvm/firLightTreeOn.args");
+ }
+
@TestMetadata("firMultiplatformCompilationWithError.args")
public void testFirMultiplatformCompilationWithError() throws Exception {
runTest("compiler/testData/cli/jvm/firMultiplatformCompilationWithError.args");