diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt index 49de6db63a0..4a09169f0ba 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt @@ -362,6 +362,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() { collector.deprecationWarn(irBaseClassInMetadata, false, "-Xir-base-class-in-metadata") collector.deprecationWarn(irNewIr2Js, true, "-Xir-new-ir2js") + if (languageVersion >= LanguageVersion.KOTLIN_1_9) { + collector.deprecationWarn(legacyDeprecatedNoWarn, false, "-Xlegacy-deprecated-no-warn") + collector.deprecationWarn(useDeprecatedLegacyCompiler, false, "-Xuse-deprecated-legacy-compiler") + } + return super.configureAnalysisFlags(collector, languageVersion).also { it[allowFullyQualifiedNameInKClass] = wasm && wasmKClassFqn //Only enabled WASM BE supports this flag } diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java index 162df537c5e..ccb680af87f 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java @@ -182,6 +182,13 @@ public class K2JSCompiler extends CLICompiler { return exitCode; } + LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration); + + if (languageVersionSettings.getLanguageVersion().compareTo(LanguageVersion.KOTLIN_1_9) >= 0) { + messageCollector.report(ERROR, "Old Kotlin/JS compiler is no longer supported. Please migrate to the new JS IR backend", null); + return COMPILATION_ERROR; + } + String deprecatedMessage = "==========\n" + "This project currently uses the Kotlin/JS Legacy compiler backend, which has been deprecated and will be removed in a future release.\n" + "\n" + diff --git a/compiler/testData/cli/js/jsOldBackend.args b/compiler/testData/cli/js/jsOldBackend.args new file mode 100644 index 00000000000..1c142de9aaf --- /dev/null +++ b/compiler/testData/cli/js/jsOldBackend.args @@ -0,0 +1,7 @@ +$TESTDATA_DIR$/languageVersion.kt +-Xlegacy-deprecated-no-warn +-Xuse-deprecated-legacy-compiler +-output +$TEMP_DIR$/out.js +-language-version +1.9 \ No newline at end of file diff --git a/compiler/testData/cli/js/jsOldBackend.out b/compiler/testData/cli/js/jsOldBackend.out new file mode 100644 index 00000000000..f02e8d6ce06 --- /dev/null +++ b/compiler/testData/cli/js/jsOldBackend.out @@ -0,0 +1,3 @@ +warning: language version 1.9 is experimental, there are no backwards compatibility guarantees for new language and library features +error: old Kotlin/JS compiler is no longer supported. Please migrate to the new JS IR backend +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 e2df40d4c41..8be68e2b86d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -1205,6 +1205,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/js/jsHelp.args"); } + @TestMetadata("jsOldBackend.args") + public void testJsOldBackend() throws Exception { + runTest("compiler/testData/cli/js/jsOldBackend.args"); + } + @TestMetadata("kotlinHomeWithoutStdlib.args") public void testKotlinHomeWithoutStdlib() throws Exception { runTest("compiler/testData/cli/js/kotlinHomeWithoutStdlib.args"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index 29d3ea1d63e..49bc063f192 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -294,17 +294,19 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir) } - fun testReleaseCompilerAgainstPreReleaseLibraryJs() { - doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js")) - } +// https://youtrack.jetbrains.com/issue/KT-54905 +// fun testReleaseCompilerAgainstPreReleaseLibraryJs() { +// doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js")) +// } fun testReleaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck() { doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir, "-Xskip-prerelease-check") } - fun testReleaseCompilerAgainstPreReleaseLibraryJsSkipPrereleaseCheck() { - doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js"), "-Xskip-prerelease-check") - } +// https://youtrack.jetbrains.com/issue/KT-54905 +// fun testReleaseCompilerAgainstPreReleaseLibraryJsSkipPrereleaseCheck() { +// doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js"), "-Xskip-prerelease-check") +// } fun testReleaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck() { doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir, "-Xskip-metadata-version-check")