diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index 24c505c4c9e..2bd6a2b4b87 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -453,6 +453,7 @@ class GenerationState private constructor( this[KOTLIN_1_7] = JvmMetadataVersion(1, 7, 0) this[KOTLIN_1_8] = JvmMetadataVersion.INSTANCE this[KOTLIN_1_9] = JvmMetadataVersion(1, 9, 0) + this[KOTLIN_2_0] = JvmMetadataVersion(2, 0, 0) check(size == LanguageVersion.values().size) { "Please add mappings from the missing LanguageVersion instances to the corresponding JvmMetadataVersion " + diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index eb08b369039..f363422b2b2 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -643,7 +643,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() { } } - private fun checkLanguageVersionIsStable(languageVersion: LanguageVersion, collector: MessageCollector) { + fun checkLanguageVersionIsStable(languageVersion: LanguageVersion, collector: MessageCollector) { if (!languageVersion.isStable && !suppressVersionWarnings) { collector.report( CompilerMessageSeverity.STRONG_WARNING, diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index 21980670d24..7c1a737e532 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -573,7 +573,7 @@ Also sets `-jvm-target` value equal to the selected JDK version""" result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview - result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useK2 + result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useK2 || languageVersion.usesK2 result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses result[JvmAnalysisFlags.useIR] = !useOldBackend return result 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 87ae56253f4..aa1c7314f12 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 @@ -175,14 +175,15 @@ public class K2JSCompiler extends CLICompiler { ExitCode exitCode = OK; - if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments)) { + LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration); + LanguageVersion languageVersion = languageVersionSettings.getLanguageVersion(); + if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments) || languageVersion.getUsesK2()) { exitCode = getIrCompiler().doExecute(arguments, configuration.copy(), rootDisposable, paths); } - if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments)) { + if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments) || languageVersion.getUsesK2()) { return exitCode; } - LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration); if (CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.getValue() != "true" && 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); diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt index 7de3c5ba05b..5020664bfb5 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt @@ -287,11 +287,7 @@ class K2JsIrCompiler : CLICompiler() { val outputKlibPath = if (arguments.irProduceKlibFile) outputDir.resolve("$outputName.klib").normalize().absolutePath else outputDirPath - if (arguments.useK2) { - messageCollector.report( - STRONG_WARNING, - "ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2" - ) + if (configuration.get(CommonConfigurationKeys.USE_FIR) == true) { sourceModule = processSourceModuleWithK2(environmentForJS, libraries, friendLibraries, arguments, outputKlibPath) } else { sourceModule = processSourceModule(environmentForJS, libraries, friendLibraries, arguments, outputKlibPath) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt index c42450326cb..112faf29c79 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt @@ -31,8 +31,7 @@ import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser import org.jetbrains.kotlin.cli.plugins.processCompilerPluginsOptions import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar -import org.jetbrains.kotlin.config.CompilerConfiguration -import org.jetbrains.kotlin.config.Services +import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.ir.util.IrMessageLogger import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion import org.jetbrains.kotlin.progress.CompilationCanceledException @@ -77,7 +76,7 @@ abstract class CLICompiler : CLITool() { configuration.put(CLIConfigurationKeys.ORIGINAL_MESSAGE_COLLECTOR_KEY, messageCollector) val collector = GroupingMessageCollector(messageCollector, arguments.allWarningsAsErrors).also { - configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, it) + configuration.put(MESSAGE_COLLECTOR_KEY, it) } configuration.put(IrMessageLogger.IR_MESSAGE_LOGGER, IrMessageCollector(collector)) @@ -88,7 +87,7 @@ abstract class CLICompiler : CLITool() { setupPlatformSpecificArgumentsAndServices(configuration, arguments, services) val paths = computeKotlinPaths(collector, arguments) if (collector.hasErrors()) { - return ExitCode.COMPILATION_ERROR + return COMPILATION_ERROR } val canceledStatus = services[CompilationCanceledStatus::class.java] @@ -98,6 +97,36 @@ abstract class CLICompiler : CLITool() { try { setIdeaIoUseFallback() + val useK2FromFlag = arguments.useK2 + val languageVersion = configuration.languageVersionSettings.languageVersion + if (useK2FromFlag) { + when { + arguments.languageVersion == null -> { + messageCollector.report( + STRONG_WARNING, + "Compiler flag -Xuse-k2 is deprecated, please use -language-version 2.0 instead" + ) + } + languageVersion.usesK2 -> { + messageCollector.report( + STRONG_WARNING, + "Compiler flag -Xuse-k2 is redundant" + ) + } + else -> { + messageCollector.report( + STRONG_WARNING, + "With -Xuse-k2 compiler flag -language-version $languageVersion has no effect, please remove -Xuse-k2 flag or use -language-version 2.0 instead" + ) + } + } + if (!languageVersion.usesK2) { + val languageVersionSettings = configuration.languageVersionSettings + configuration.languageVersionSettings = languageVersionSettings.copy(LanguageVersion.KOTLIN_2_0) + arguments.checkLanguageVersionIsStable(LanguageVersion.KOTLIN_2_0, messageCollector) + } + } + val code = doExecute(arguments, configuration, rootDisposable, paths) performanceManager.notifyCompilationFinished() @@ -115,12 +144,12 @@ abstract class CLICompiler : CLITool() { return if (collector.hasErrors()) COMPILATION_ERROR else code } catch (e: CompilationCanceledException) { collector.reportCompilationCancelled(e) - return ExitCode.OK + return OK } catch (e: RuntimeException) { val cause = e.cause if (cause is CompilationCanceledException) { collector.reportCompilationCancelled(cause) - return ExitCode.OK + return OK } else { throw e } 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 c3b1c54ccb8..f7f44e5dbbc 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt @@ -22,8 +22,6 @@ fun CompilerConfiguration.setupCommonArguments( createMetadataVersion: ((IntArray) -> BinaryVersion)? = null ) { put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline) - put(CommonConfigurationKeys.USE_FIR, arguments.useK2) - put(CommonConfigurationKeys.USE_LIGHT_TREE, arguments.useFirLT) put(CommonConfigurationKeys.USE_FIR_EXTENDED_CHECKERS, arguments.useFirExtendedCheckers) put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker) putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot) @@ -45,6 +43,10 @@ fun CompilerConfiguration.setupCommonArguments( } setupLanguageVersionSettings(arguments) + + val usesK2 = arguments.useK2 || languageVersionSettings.languageVersion.usesK2 + put(CommonConfigurationKeys.USE_FIR, usesK2) + put(CommonConfigurationKeys.USE_LIGHT_TREE, usesK2) } fun CompilerConfiguration.setupLanguageVersionSettings(arguments: A) { diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt index 44cb59fe103..d325d38a6eb 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt @@ -75,11 +75,6 @@ object FirKotlinToJvmBytecodeCompiler { ): Boolean { val performanceManager = projectConfiguration.get(CLIConfigurationKeys.PERF_MANAGER) - messageCollector.report( - STRONG_WARNING, - "ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2" - ) - val notSupportedPlugins = mutableListOf().apply { projectConfiguration.get(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS).collectIncompatiblePluginNamesTo(this, ComponentRegistrar::supportsK2) projectConfiguration.get(CompilerPluginRegistrar.COMPILER_PLUGIN_REGISTRARS).collectIncompatiblePluginNamesTo(this, CompilerPluginRegistrar::supportsK2) @@ -89,9 +84,9 @@ object FirKotlinToJvmBytecodeCompiler { messageCollector.report( CompilerMessageSeverity.ERROR, """ - |There are some plugins incompatible with K2 compiler: + |There are some plugins incompatible with language version 2.0: |${notSupportedPlugins.joinToString(separator = "\n|") { " $it" }} - |Please remove -Xuse-k2 + |Please use language version 1.* (e.g. 1.9) """.trimMargin() ) return false diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt index dc40bee41c8..4cf2544ac86 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt @@ -99,11 +99,6 @@ fun compileModulesUsingFrontendIrAndLightTree( performanceManager?.notifyCompilerInitialized(0, 0, targetDescription) - messageCollector.report( - CompilerMessageSeverity.STRONG_WARNING, - "ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2" - ) - val outputs = mutableListOf() var mainClassFqName: FqName? = null 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 b79aef1c93d..791e6fcac10 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -260,7 +260,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr // TODO: ignore previous configuration value when we do not need old backend in scripting by default val useOldBackend = arguments.useOldBackend || (!arguments.useIR && get(JVMConfigurationKeys.IR) == false) - val useIR = arguments.useK2 || + val useIR = arguments.useK2 || languageVersionSettings.languageVersion.usesK2 || if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) { !useOldBackend } else { diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt index c8c3440f42e..c3ce86f1ab6 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt @@ -59,7 +59,7 @@ class K2MetadataCompiler : CLICompiler() { ): ExitCode { val collector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) { - collector.report(ERROR, "K2 does not support compilation to metadata right now") + collector.report(ERROR, "Compilation to metadata is not supported in language version 2.0 right now") return ExitCode.COMPILATION_ERROR } val performanceManager = configuration.getNotNull(CLIConfigurationKeys.PERF_MANAGER) diff --git a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/FirSessionFactoryHelper.kt b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/FirSessionFactoryHelper.kt index 801ecd2b4e1..359c103165f 100644 --- a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/FirSessionFactoryHelper.kt +++ b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/FirSessionFactoryHelper.kt @@ -108,6 +108,8 @@ object FirSessionFactoryHelper { override fun getFlag(flag: AnalysisFlag): T = stub() + override fun copy(languageVersion: LanguageVersion): LanguageVersionSettings = this + override val apiVersion: ApiVersion get() = stub() override val languageVersion: LanguageVersion diff --git a/compiler/testData/cli/js/fir.args b/compiler/testData/cli/js/fir.args index f5e479f27e3..4d1e8697624 100644 --- a/compiler/testData/cli/js/fir.args +++ b/compiler/testData/cli/js/fir.args @@ -1,5 +1,6 @@ $TESTDATA_DIR$/fir.kt --Xuse-k2 +-language-version +2.0 -ir-output-dir $TEMP_DIR$ -ir-output-name diff --git a/compiler/testData/cli/js/fir.out b/compiler/testData/cli/js/fir.out index ffcff5c3b33..86ca0241885 100644 --- a/compiler/testData/cli/js/fir.out +++ b/compiler/testData/cli/js/fir.out @@ -1,4 +1,2 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features OK diff --git a/compiler/testData/cli/jvm/apiVersionInvalid.out b/compiler/testData/cli/jvm/apiVersionInvalid.out index 15ae5270bdb..f76bc57a335 100644 --- a/compiler/testData/cli/jvm/apiVersionInvalid.out +++ b/compiler/testData/cli/jvm/apiVersionInvalid.out @@ -1,3 +1,3 @@ error: unknown API version: 239.42 -Supported API versions: 1.3 (deprecated), 1.4 (deprecated), 1.5, 1.6, 1.7, 1.8, 1.9 (experimental) +Supported API versions: 1.3 (deprecated), 1.4 (deprecated), 1.5, 1.6, 1.7, 1.8, 1.9 (experimental), 2.0 (experimental) COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.args b/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.args index 1179d27ff26..8ca728a4e50 100644 --- a/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.args +++ b/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.args @@ -1,4 +1,5 @@ $TESTDATA_DIR$/conflictingJvmDeclarations.kt --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ \ No newline at end of file diff --git a/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.out b/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.out index 04477b8c572..5ad9917f9e8 100644 --- a/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.out +++ b/compiler/testData/cli/jvm/conflictingJvmDeclarationsK2.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/conflictingJvmDeclarations.kt:2:5: error: platform declaration clash: The following declarations have the same JVM signature (getX()I): fun ``(): Int defined in Foo fun getX(): Int defined in Foo diff --git a/compiler/testData/cli/jvm/conflictingProjection.args b/compiler/testData/cli/jvm/conflictingProjection.args index 029be42cd1d..3dfb047cc7a 100644 --- a/compiler/testData/cli/jvm/conflictingProjection.args +++ b/compiler/testData/cli/jvm/conflictingProjection.args @@ -1,4 +1,5 @@ $TESTDATA_DIR$/conflictingProjection.kt --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/conflictingProjection.out b/compiler/testData/cli/jvm/conflictingProjection.out index 705f3c6201c..17d8c90974f 100644 --- a/compiler/testData/cli/jvm/conflictingProjection.out +++ b/compiler/testData/cli/jvm/conflictingProjection.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/conflictingProjection.kt:10:19: error: projection is conflicting with variance of the corresponding type parameter of Out. Remove the projection or replace it with '*' fun a8(value: Out) {} ^ diff --git a/compiler/testData/cli/jvm/extendedCheckers.args b/compiler/testData/cli/jvm/extendedCheckers.args index 88effb435ae..592fd5caa1d 100644 --- a/compiler/testData/cli/jvm/extendedCheckers.args +++ b/compiler/testData/cli/jvm/extendedCheckers.args @@ -1,5 +1,6 @@ $TESTDATA_DIR$/extendedCheckers.kt --Xuse-k2 +-language-version +2.0 -Xuse-fir-extended-checkers -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/extendedCheckers.out b/compiler/testData/cli/jvm/extendedCheckers.out index 97b723fbf72..4deba7b9f0a 100644 --- a/compiler/testData/cli/jvm/extendedCheckers.out +++ b/compiler/testData/cli/jvm/extendedCheckers.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/extendedCheckers.kt:2:12: warning: redundant explicit type val i: Int = 1 ^ diff --git a/compiler/testData/cli/jvm/extendedCheckersNoWarning.args b/compiler/testData/cli/jvm/extendedCheckersNoWarning.args index f815eee846a..5d58a74ca1a 100644 --- a/compiler/testData/cli/jvm/extendedCheckersNoWarning.args +++ b/compiler/testData/cli/jvm/extendedCheckersNoWarning.args @@ -1,5 +1,6 @@ $TESTDATA_DIR$/extendedCheckersNoWarning.kt --Xuse-k2 +-language-version +2.0 -Xuse-fir-extended-checkers -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/extendedCheckersNoWarning.out b/compiler/testData/cli/jvm/extendedCheckersNoWarning.out index ffcff5c3b33..86ca0241885 100644 --- a/compiler/testData/cli/jvm/extendedCheckersNoWarning.out +++ b/compiler/testData/cli/jvm/extendedCheckersNoWarning.out @@ -1,4 +1,2 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features OK diff --git a/compiler/testData/cli/jvm/firDeprecationJava.args b/compiler/testData/cli/jvm/firDeprecationJava.args index 1173c7c0664..5c796d10716 100644 --- a/compiler/testData/cli/jvm/firDeprecationJava.args +++ b/compiler/testData/cli/jvm/firDeprecationJava.args @@ -1,5 +1,6 @@ $TESTDATA_DIR$/firDeprecationJava.kt $TESTDATA_DIR$/firDeprecationJava --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firDeprecationJava.out b/compiler/testData/cli/jvm/firDeprecationJava.out index 31e71154540..0ccd7af6cf0 100644 --- a/compiler/testData/cli/jvm/firDeprecationJava.out +++ b/compiler/testData/cli/jvm/firDeprecationJava.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/firDeprecationJava.kt:3:12: warning: '@Deprecated(...) fun stop(): Unit ' is deprecated. Deprecated in Java thread.stop() diff --git a/compiler/testData/cli/jvm/firDfa.args b/compiler/testData/cli/jvm/firDfa.args index 876d1339bf6..504160acc7f 100644 --- a/compiler/testData/cli/jvm/firDfa.args +++ b/compiler/testData/cli/jvm/firDfa.args @@ -1,4 +1,5 @@ $TESTDATA_DIR$/firDfa.kt --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firDfa.out b/compiler/testData/cli/jvm/firDfa.out index ffcff5c3b33..75389a1ac06 100644 --- a/compiler/testData/cli/jvm/firDfa.out +++ b/compiler/testData/cli/jvm/firDfa.out @@ -1,4 +1,5 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features +compiler/testData/cli/jvm/firDfa.kt:3:10: warning: unnecessary non-null assertion (!!) on a non-null receiver of type kotlin/String + x!!.length + ^ OK diff --git a/compiler/testData/cli/jvm/firError.args b/compiler/testData/cli/jvm/firError.args index 8291989e7f1..fd1ea52538e 100644 --- a/compiler/testData/cli/jvm/firError.args +++ b/compiler/testData/cli/jvm/firError.args @@ -1,4 +1,5 @@ $TESTDATA_DIR$/firError.kt --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firError.out b/compiler/testData/cli/jvm/firError.out index fa215da43fa..6833fa95cd7 100644 --- a/compiler/testData/cli/jvm/firError.out +++ b/compiler/testData/cli/jvm/firError.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/firError.kt:1:13: error: 'val' on function parameter is not allowed fun println(val x: Int) {} ^ diff --git a/compiler/testData/cli/jvm/firHello.out b/compiler/testData/cli/jvm/firHello.out index ffcff5c3b33..b9afd3e03f8 100644 --- a/compiler/testData/cli/jvm/firHello.out +++ b/compiler/testData/cli/jvm/firHello.out @@ -1,4 +1,3 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: compiler flag -Xuse-k2 is deprecated, please use -language-version 2.0 instead +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features OK diff --git a/compiler/testData/cli/jvm/firHello20.args b/compiler/testData/cli/jvm/firHello20.args new file mode 100644 index 00000000000..cb7244f1b40 --- /dev/null +++ b/compiler/testData/cli/jvm/firHello20.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/firHello20.kt +-language-version +2.0 +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firHello20.kt b/compiler/testData/cli/jvm/firHello20.kt new file mode 100644 index 00000000000..78e3db2779f --- /dev/null +++ b/compiler/testData/cli/jvm/firHello20.kt @@ -0,0 +1 @@ +fun main() {} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/firHello20.out b/compiler/testData/cli/jvm/firHello20.out new file mode 100644 index 00000000000..86ca0241885 --- /dev/null +++ b/compiler/testData/cli/jvm/firHello20.out @@ -0,0 +1,2 @@ +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features +OK diff --git a/compiler/testData/cli/jvm/firHello20WithFlag.args b/compiler/testData/cli/jvm/firHello20WithFlag.args new file mode 100644 index 00000000000..2397c94c5d3 --- /dev/null +++ b/compiler/testData/cli/jvm/firHello20WithFlag.args @@ -0,0 +1,6 @@ +$TESTDATA_DIR$/firHello20.kt +-Xuse-k2 +-language-version +2.0 +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firHello20WithFlag.out b/compiler/testData/cli/jvm/firHello20WithFlag.out new file mode 100644 index 00000000000..42f0672c715 --- /dev/null +++ b/compiler/testData/cli/jvm/firHello20WithFlag.out @@ -0,0 +1,3 @@ +warning: compiler flag -Xuse-k2 is redundant +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features +OK diff --git a/compiler/testData/cli/jvm/firHello20WithOldLV.args b/compiler/testData/cli/jvm/firHello20WithOldLV.args new file mode 100644 index 00000000000..8188e0bcdd3 --- /dev/null +++ b/compiler/testData/cli/jvm/firHello20WithOldLV.args @@ -0,0 +1,6 @@ +$TESTDATA_DIR$/firHello20.kt +-Xuse-k2 +-language-version +1.5 +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firHello20WithOldLV.out b/compiler/testData/cli/jvm/firHello20WithOldLV.out new file mode 100644 index 00000000000..9929407d72b --- /dev/null +++ b/compiler/testData/cli/jvm/firHello20WithOldLV.out @@ -0,0 +1,3 @@ +warning: with -Xuse-k2 compiler flag -language-version 1.5 has no effect, please remove -Xuse-k2 flag or use -language-version 2.0 instead +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features +OK diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.args b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.args index fc82e67224f..226cfaf1a7d 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.args +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.args @@ -2,7 +2,8 @@ $TESTDATA_DIR$/firMultiplatformCompilationWithError/common.kt $TESTDATA_DIR$/firMultiplatformCompilationWithError/jvm.kt -Xcommon-sources $TESTDATA_DIR$/firMultiplatformCompilationWithError/common.kt --Xuse-k2 +-language-version +2.0 -cp . -d diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out index dc56f448423..9cbf946b19d 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out @@ -8,9 +8,7 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt:1:18: error: actual class 'actual interface A : Any' has no corresponding members for expected class members: expect fun foo(): Unit diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithLightTreeWithoutErrors.out b/compiler/testData/cli/jvm/firMultiplatformCompilationWithLightTreeWithoutErrors.out index 12cc44ccf11..004fadf74cd 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithLightTreeWithoutErrors.out +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithLightTreeWithoutErrors.out @@ -8,7 +8,6 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: compiler flag -Xuse-k2 is deprecated, please use "-language-version 2.0" instead +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features OK diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.args b/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.args index d4a26478359..d7d0ba239f2 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.args +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.args @@ -2,7 +2,8 @@ $TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/common.kt $TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/jvm.kt -Xcommon-sources $TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/common.kt --Xuse-k2 +-language-version +2.0 -cp . -d diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.out b/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.out index 12cc44ccf11..165fe4ed0bd 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.out +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors.out @@ -8,7 +8,5 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features OK diff --git a/compiler/testData/cli/jvm/firStdlibDependency.args b/compiler/testData/cli/jvm/firStdlibDependency.args index 76032f4ff50..e9566bf61cc 100644 --- a/compiler/testData/cli/jvm/firStdlibDependency.args +++ b/compiler/testData/cli/jvm/firStdlibDependency.args @@ -1,5 +1,6 @@ $TESTDATA_DIR$/firStdlibDependency.kt --Xuse-k2 +-language-version +2.0 -cp . -d diff --git a/compiler/testData/cli/jvm/firStdlibDependency.out b/compiler/testData/cli/jvm/firStdlibDependency.out index ffcff5c3b33..86ca0241885 100644 --- a/compiler/testData/cli/jvm/firStdlibDependency.out +++ b/compiler/testData/cli/jvm/firStdlibDependency.out @@ -1,4 +1,2 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features OK diff --git a/compiler/testData/cli/jvm/firVsClassicAnnotation.args b/compiler/testData/cli/jvm/firVsClassicAnnotation.args index 29b65855a41..61988c228c5 100644 --- a/compiler/testData/cli/jvm/firVsClassicAnnotation.args +++ b/compiler/testData/cli/jvm/firVsClassicAnnotation.args @@ -1,6 +1,7 @@ $TESTDATA_DIR$/firVsClassicAnnotation.kt -classpath $TESTDATA_DIR$/firVsClassicAnnotation --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firVsClassicAnnotation.out b/compiler/testData/cli/jvm/firVsClassicAnnotation.out index ffcff5c3b33..86ca0241885 100644 --- a/compiler/testData/cli/jvm/firVsClassicAnnotation.out +++ b/compiler/testData/cli/jvm/firVsClassicAnnotation.out @@ -1,4 +1,2 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features OK diff --git a/compiler/testData/cli/jvm/inapplicableLateinitModifier.args b/compiler/testData/cli/jvm/inapplicableLateinitModifier.args index e58653d69b7..96d926ef69c 100644 --- a/compiler/testData/cli/jvm/inapplicableLateinitModifier.args +++ b/compiler/testData/cli/jvm/inapplicableLateinitModifier.args @@ -1,4 +1,5 @@ $TESTDATA_DIR$/inapplicableLateinitModifier.kt --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/inapplicableLateinitModifier.out b/compiler/testData/cli/jvm/inapplicableLateinitModifier.out index 604dc3853eb..f8c64a84d45 100644 --- a/compiler/testData/cli/jvm/inapplicableLateinitModifier.out +++ b/compiler/testData/cli/jvm/inapplicableLateinitModifier.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/inapplicableLateinitModifier.kt:6:1: error: 'lateinit' modifier is not allowed on delegated properties lateinit var kest by Delegate ^ diff --git a/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.args b/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.args index 1a04a495a39..60d588a5238 100644 --- a/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.args +++ b/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.args @@ -1,4 +1,5 @@ $TESTDATA_DIR$/instanceAccessBeforeSuperCall.kt --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ \ No newline at end of file diff --git a/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out b/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out index 9750e0ee284..e0ffa7f5d1d 100644 --- a/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out +++ b/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:26: error: unresolved reference: getSomeInt constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {} ^ diff --git a/compiler/testData/cli/jvm/languageVersionInvalid.out b/compiler/testData/cli/jvm/languageVersionInvalid.out index ea87111ca1c..32edb21559f 100644 --- a/compiler/testData/cli/jvm/languageVersionInvalid.out +++ b/compiler/testData/cli/jvm/languageVersionInvalid.out @@ -1,3 +1,3 @@ error: unknown language version: 239.42 -Supported language versions: 1.3 (deprecated), 1.4 (deprecated), 1.5, 1.6, 1.7, 1.8, 1.9 (experimental) +Supported language versions: 1.3 (deprecated), 1.4 (deprecated), 1.5, 1.6, 1.7, 1.8, 1.9 (experimental), 2.0 (experimental) COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/optInEmptyMessageFir.args b/compiler/testData/cli/jvm/optInEmptyMessageFir.args index ff73545342b..b6bbefee29b 100644 --- a/compiler/testData/cli/jvm/optInEmptyMessageFir.args +++ b/compiler/testData/cli/jvm/optInEmptyMessageFir.args @@ -2,5 +2,6 @@ $TESTDATA_DIR$/optInEmptyMessageFir.kt -d $TEMP_DIR$ -opt-in=kotlin.RequiresOptIn --Xuse-k2 +-language-version +2.0 diff --git a/compiler/testData/cli/jvm/optInEmptyMessageFir.out b/compiler/testData/cli/jvm/optInEmptyMessageFir.out index 6bfd51ba14b..8ee8a5ab253 100644 --- a/compiler/testData/cli/jvm/optInEmptyMessageFir.out +++ b/compiler/testData/cli/jvm/optInEmptyMessageFir.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/optInEmptyMessageFir.kt:8:5: error: this declaration needs opt-in. Its usage must be marked with '@EmptyMarker' or '@OptIn(EmptyMarker::class)' foo() ^ diff --git a/compiler/testData/cli/jvm/optInOverrideMessageFir.args b/compiler/testData/cli/jvm/optInOverrideMessageFir.args index 5bebce861f1..3aac499cad3 100644 --- a/compiler/testData/cli/jvm/optInOverrideMessageFir.args +++ b/compiler/testData/cli/jvm/optInOverrideMessageFir.args @@ -2,4 +2,5 @@ $TESTDATA_DIR$/optInOverrideMessageFir.kt -d $TEMP_DIR$ -opt-in=kotlin.RequiresOptIn --Xuse-k2 +-language-version +2.0 diff --git a/compiler/testData/cli/jvm/optInOverrideMessageFir.out b/compiler/testData/cli/jvm/optInOverrideMessageFir.out index 6dc08d9cb6e..28850d8e4eb 100644 --- a/compiler/testData/cli/jvm/optInOverrideMessageFir.out +++ b/compiler/testData/cli/jvm/optInOverrideMessageFir.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/optInOverrideMessageFir.kt:16:18: error: base declaration of supertype 'Base' needs opt-in. This API is experimental and can change at any time, please use with care. The declaration override must be annotated with '@Marker' or '@OptIn(Marker::class)' override fun foo() {} ^ diff --git a/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.args b/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.args index dfbb0b8aafc..c8d613c9f23 100644 --- a/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.args +++ b/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.args @@ -1,5 +1,6 @@ -d $TEMP_DIR$ --Xuse-k2 +-language-version +2.0 -Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar=annotation=foo.AllOpen $TESTDATA_DIR$/firAllOpenPlugin.kt diff --git a/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.out b/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.out index f4b5c860a5b..da6976fde70 100644 --- a/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.out +++ b/compiler/testData/cli/jvm/plugins/firAllOpenPlugin_modern.out @@ -1,5 +1,3 @@ +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features warning: argument -Xcompiler-plugin is experimental -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 OK diff --git a/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.args b/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.args index 543642899dd..c72991d14eb 100644 --- a/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.args +++ b/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.args @@ -1,8 +1,8 @@ -d $TEMP_DIR$ -Xcompiler-plugin=dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.NoArg --Xuse-k2 - +-language-version +2.0 -Xplugin=dist/kotlinc/lib/allopen-compiler-plugin.jar -P plugin\:org.jetbrains.kotlin.allopen\:annotation=foo.AllOpen diff --git a/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.out b/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.out index efbebc110cb..63260576829 100644 --- a/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.out +++ b/compiler/testData/cli/jvm/plugins/mixingModernAndLegacyArgs.out @@ -1,3 +1,4 @@ +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features error: mixing legacy and modern plugin arguments is prohibited. Please use only one syntax Legacy arguments: -Xplugin=dist/kotlinc/lib/allopen-compiler-plugin.jar diff --git a/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.args b/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.args index c0e9149c866..9ba0bfd63fb 100644 --- a/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.args +++ b/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.args @@ -1,5 +1,6 @@ -d $TEMP_DIR$ --Xuse-k2 +-language-version +2.0 -Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar=annotation=foo.AllOpen1,annotation=foo.AllOpen2 $TESTDATA_DIR$/multipleOptionsForOnePlugin.kt diff --git a/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.out b/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.out index f4b5c860a5b..da6976fde70 100644 --- a/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.out +++ b/compiler/testData/cli/jvm/plugins/multipleOptionsForOnePlugin.out @@ -1,5 +1,3 @@ +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features warning: argument -Xcompiler-plugin is experimental -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 OK diff --git a/compiler/testData/cli/jvm/plugins/multiplePlugins.args b/compiler/testData/cli/jvm/plugins/multiplePlugins.args index dfcb30800fe..fa5e8917a58 100644 --- a/compiler/testData/cli/jvm/plugins/multiplePlugins.args +++ b/compiler/testData/cli/jvm/plugins/multiplePlugins.args @@ -1,6 +1,7 @@ -d $TEMP_DIR$ --Xuse-k2 +-language-version +2.0 -Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar=annotation=foo.AllOpen -Xcompiler-plugin=dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.NoArg $TESTDATA_DIR$/multiplePlugins.kt diff --git a/compiler/testData/cli/jvm/plugins/multiplePlugins.out b/compiler/testData/cli/jvm/plugins/multiplePlugins.out index 1ec5c3c01b7..d8468799bc2 100644 --- a/compiler/testData/cli/jvm/plugins/multiplePlugins.out +++ b/compiler/testData/cli/jvm/plugins/multiplePlugins.out @@ -1,6 +1,4 @@ -warning: ATTENTION! - This build uses experimental K2 compiler: - -Xuse-k2 +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features compiler/testData/cli/jvm/plugins/multiplePlugins.kt:11:17: error: inner class Inner(val s: String) ^ diff --git a/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.args b/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.args index a4cdba77296..2010d19da7b 100644 --- a/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.args +++ b/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.args @@ -1,5 +1,6 @@ -d $TEMP_DIR$ --Xuse-k2 +-language-version +2.0 -Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar,dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.AllOpen $TESTDATA_DIR$/multiplePluginsInSameArg.kt diff --git a/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.out b/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.out index 5bcca76f71e..a6c63c43dfb 100644 --- a/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.out +++ b/compiler/testData/cli/jvm/plugins/multiplePluginsInSameArg.out @@ -1,3 +1,4 @@ +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features error: multiple plugins found in given classpath: org.jetbrains.kotlin.allopen.AllOpenComponentRegistrar, org.jetbrains.kotlin.noarg.NoArgComponentRegistrar Plugin configuration is: dist/kotlinc/lib/allopen-compiler-plugin.jar,dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.AllOpen COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/plugins/noPluginInClasspath.args b/compiler/testData/cli/jvm/plugins/noPluginInClasspath.args index 71a93787fd3..6cba23bd731 100644 --- a/compiler/testData/cli/jvm/plugins/noPluginInClasspath.args +++ b/compiler/testData/cli/jvm/plugins/noPluginInClasspath.args @@ -1,5 +1,6 @@ -d $TEMP_DIR$ --Xuse-k2 +-language-version +2.0 -Xcompiler-plugin=dist/kotlinc/lib/kotlin-reflect.jar $TESTDATA_DIR$/noPluginInClasspath.kt diff --git a/compiler/testData/cli/jvm/plugins/noPluginInClasspath.out b/compiler/testData/cli/jvm/plugins/noPluginInClasspath.out index 20625348796..10e04ec9f6d 100644 --- a/compiler/testData/cli/jvm/plugins/noPluginInClasspath.out +++ b/compiler/testData/cli/jvm/plugins/noPluginInClasspath.out @@ -1,2 +1,3 @@ +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features error: no plugins found in given classpath: dist/kotlinc/lib/kotlin-reflect.jar COMPILATION_ERROR diff --git a/compiler/testData/cli/metadata/fir.args b/compiler/testData/cli/metadata/fir.args index 4c95db9e856..4be050d48ab 100644 --- a/compiler/testData/cli/metadata/fir.args +++ b/compiler/testData/cli/metadata/fir.args @@ -1,4 +1,5 @@ $TESTDATA_DIR$/fir.kt --Xuse-k2 +-language-version +2.0 -d $TEMP_DIR$ diff --git a/compiler/testData/cli/metadata/fir.out b/compiler/testData/cli/metadata/fir.out index d3f786619d3..fe413a1beb5 100644 --- a/compiler/testData/cli/metadata/fir.out +++ b/compiler/testData/cli/metadata/fir.out @@ -1,2 +1,3 @@ -error: k2 does not support compilation to metadata right now +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features +error: compilation to metadata is not supported in language version 2.0 right now COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/output.txt index 6fc8c06126f..7a5353abb58 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/output.txt @@ -1,8 +1,10 @@ -error: classes compiled by the new Kotlin compiler frontend were found in dependencies. Remove them from the classpath or use '-Xallow-unstable-dependencies' to suppress errors -compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:5: error: class 'lib.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler +error: incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors +$TMP_DIR$/library.jar!/META-INF/main.kotlin_module: error: module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.0.0, expected version is $ABI_VERSION$. +compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:5: error: unresolved reference: get get { Box("OK").value } ^ -compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:11: error: class 'lib.Box' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler +compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:11: error: class 'lib.Box' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.0.0, expected version is $ABI_VERSION$. +The class is loaded from $TMP_DIR$/library.jar!/lib/Box.class get { Box("OK").value } ^ COMPILATION_ERROR diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt index c420549f6aa..add33ac01e7 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/CompilerTestLanguageVersionSettings.kt @@ -26,19 +26,23 @@ const val SANITIZE_PARENTHESES = "SANITIZE_PARENTHESES" const val ENABLE_JVM_PREVIEW = "ENABLE_JVM_PREVIEW" data class CompilerTestLanguageVersionSettings( - private val initialLanguageFeatures: Map, - override val apiVersion: ApiVersion, - override val languageVersion: LanguageVersion, - val analysisFlags: Map, Any?> = emptyMap() + private val initialLanguageFeatures: Map, + override val apiVersion: ApiVersion, + override val languageVersion: LanguageVersion, + val analysisFlags: Map, Any?> = emptyMap() ) : LanguageVersionSettings { val extraLanguageFeatures = specificFeaturesForTests() + initialLanguageFeatures private val delegate = LanguageVersionSettingsImpl(languageVersion, apiVersion, emptyMap(), extraLanguageFeatures) override fun getFeatureSupport(feature: LanguageFeature): LanguageFeature.State = - extraLanguageFeatures[feature] ?: delegate.getFeatureSupport(feature) + extraLanguageFeatures[feature] ?: delegate.getFeatureSupport(feature) override fun isPreRelease(): Boolean = false + override fun copy(languageVersion: LanguageVersion): LanguageVersionSettings { + return CompilerTestLanguageVersionSettings(initialLanguageFeatures, apiVersion, languageVersion, analysisFlags) + } + @Suppress("UNCHECKED_CAST") override fun getFlag(flag: AnalysisFlag): T = analysisFlags[flag] as T? ?: flag.defaultValue } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt index 0876a49e7ec..3af75c525ac 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt @@ -138,7 +138,7 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() { private fun String.removeFirWarning(): String { return this.replace( - "warning: ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2\n", "" + "warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features\n", "" ) } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 9e2f584a511..0ab426f8c50 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -447,6 +447,21 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/firHello.args"); } + @TestMetadata("firHello20.args") + public void testFirHello20() throws Exception { + runTest("compiler/testData/cli/jvm/firHello20.args"); + } + + @TestMetadata("firHello20WithFlag.args") + public void testFirHello20WithFlag() throws Exception { + runTest("compiler/testData/cli/jvm/firHello20WithFlag.args"); + } + + @TestMetadata("firHello20WithOldLV.args") + public void testFirHello20WithOldLV() throws Exception { + runTest("compiler/testData/cli/jvm/firHello20WithOldLV.args"); + } + @TestMetadata("firMultiplatformCompilationWithError.args") public void testFirMultiplatformCompilationWithError() throws Exception { runTest("compiler/testData/cli/jvm/firMultiplatformCompilationWithError.args"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index 45db46c35ef..e7828794652 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -406,7 +406,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration // Starting from Kotlin 1.4, major.minor version of JVM metadata must be equal to the language version. // From Kotlin 1.0 to 1.4, we used JVM metadata version 1.1.*. - val expectedMajor = 1 + val expectedMajor = if (languageVersion.usesK2) 2 else 1 val expectedMinor = if (languageVersion < LanguageVersion.KOTLIN_1_4) 1 else languageVersion.minor val topLevelClass = LocalFileKotlinClass.create(File(tmpdir.absolutePath, "Foo.class"))!! @@ -563,7 +563,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration fun testInternalFromFriendModuleFir() { val library = compileLibrary("library") - compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xfriend-paths=${library.path}", "-Xuse-k2")) + compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xfriend-paths=${library.path}", "-language-version", "2.0")) } fun testJvmDefaultClashWithOld() { @@ -642,20 +642,20 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration } fun testFirAgainstFir() { - val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2")) - compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-k2")) + val library = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0")) + compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-language-version", "2.0")) } fun testFirAgainstOldJvm() { val library = compileLibrary("library") - compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-k2")) + compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-language-version", "2.0")) } fun testFirIncorrectJavaSignature() { compileKotlin( "source.kt", tmpdir, listOf(), - additionalOptions = listOf("-Xuse-k2"), + additionalOptions = listOf("-language-version", "2.0"), additionalSources = listOf("A.java", "B.java"), ) } @@ -664,7 +664,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration compileKotlin( "source.kt", tmpdir, listOf(), - additionalOptions = listOf("-Xuse-k2"), + additionalOptions = listOf("-language-version", "2.0"), additionalSources = listOf("A.java", "B.java"), ) } @@ -678,10 +678,10 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration } fun testOldJvmAgainstFir() { - val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2")) + val library = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0")) compileKotlin("source.kt", tmpdir, listOf(library)) - val library2 = compileLibrary("library", additionalOptions = listOf("-Xuse-k2", "-Xabi-stability=unstable")) + val library2 = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0", "-Xabi-stability=unstable")) compileKotlin("source.kt", tmpdir, listOf(library2)) } @@ -691,13 +691,13 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration } fun testOldJvmAgainstFirWithStableAbi() { - val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2", "-Xabi-stability=stable")) + val library = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0", "-Xabi-stability=stable")) compileKotlin("source.kt", tmpdir, listOf(library)) } fun testOldJvmAgainstFirWithAllowUnstableDependencies() { - val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2")) - compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xallow-unstable-dependencies")) + val library = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0")) + compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xallow-unstable-dependencies", "-Xskip-metadata-version-check")) } fun testSealedClassesAndInterfaces() { diff --git a/compiler/util/src/org/jetbrains/kotlin/config/ApiVersion.kt b/compiler/util/src/org/jetbrains/kotlin/config/ApiVersion.kt index 2a1fceb6011..1e87e103932 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/ApiVersion.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/ApiVersion.kt @@ -63,6 +63,9 @@ class ApiVersion private constructor( @JvmField val KOTLIN_1_9 = createByLanguageVersion(LanguageVersion.KOTLIN_1_9) + @JvmField + val KOTLIN_2_0 = createByLanguageVersion(LanguageVersion.KOTLIN_2_0) + @JvmField val LATEST: ApiVersion = createByLanguageVersion(LanguageVersion.values().last()) diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 7b85e26aca1..53f3e4324ef 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -282,6 +282,11 @@ enum class LanguageFeature( ValueClassesSecondaryConstructorWithBody(sinceVersion = KOTLIN_1_9, kind = UNSTABLE_FEATURE), // KT-55333 NativeJsProhibitLateinitIsInitalizedIntrinsicWithoutPrivateAccess(KOTLIN_1_9, kind = BUG_FIX), // KT-27002 + // End of 1.* language features -------------------------------------------------- + + // 2.0 + + // End of 2.* language features -------------------------------------------------- // This feature effectively might be removed because we decided to disable it until K2 and there it will be unconditionally enabled. // But we leave it here just to minimize the changes in K1 and also to allow use the feature once somebody needs it. @@ -414,11 +419,16 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware, L KOTLIN_1_7(1, 7), KOTLIN_1_8(1, 8), KOTLIN_1_9(1, 9), + + KOTLIN_2_0(2, 0), ; override val isStable: Boolean get() = this <= LATEST_STABLE + val usesK2: Boolean + get() = this >= KOTLIN_2_0 + override val isDeprecated: Boolean get() = FIRST_SUPPORTED <= this && this < FIRST_NON_DEPRECATED @@ -498,6 +508,8 @@ interface LanguageVersionSettings { // Please do not use this to enable/disable specific features/checks. Instead add a new LanguageFeature entry and call supportsFeature val languageVersion: LanguageVersion + fun copy(languageVersion: LanguageVersion): LanguageVersionSettings = this + companion object { const val RESOURCE_NAME_TO_ALLOW_READING_FROM_ENVIRONMENT = "META-INF/allow-configuring-from-environment" } @@ -546,6 +558,9 @@ class LanguageVersionSettingsImpl @JvmOverloads constructor( state == LanguageFeature.State.ENABLED && feature.forcesPreReleaseBinariesIfEnabled() } + override fun copy(languageVersion: LanguageVersion): LanguageVersionSettings = + LanguageVersionSettingsImpl(languageVersion, apiVersion, analysisFlags, specificFeatures) + companion object { @JvmField val DEFAULT = LanguageVersionSettingsImpl(LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE) diff --git a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt index b0357f6cb47..fb61d31e15f 100644 --- a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt +++ b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt @@ -21,7 +21,11 @@ class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean) isCompatibleTo(INSTANCE) } else { // Kotlin 1.N is able to read metadata of versions up to Kotlin 1.{N+1} (unless the version has strict semantics). - major == INSTANCE.major && minor <= INSTANCE.minor + 1 + // Kotlin 1.9 is able to read Kotlin 2.0 + // Kotlin K.* is able to read Kotlin M.* if K > M + major == INSTANCE.major && minor <= INSTANCE.minor + 1 || + major == 2 && INSTANCE.major == 1 && minor == 9 || + major < INSTANCE.major } companion object { diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt index f4f8f06ee7c..1369b470ee0 100644 --- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt @@ -146,7 +146,7 @@ class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() { // Try to set Language version to Stable+2 (there is no promises that metadata will be supported) val experimentalLevelVersion: LanguageVersion try { - experimentalLevelVersion = LanguageVersion.values()[LanguageVersion.LATEST_STABLE.ordinal+2] + experimentalLevelVersion = LanguageVersion.values()[LanguageVersion.LATEST_STABLE.ordinal + 2] } catch (e: ArrayIndexOutOfBoundsException) { // there is no Stable+2 version for now, skiping test return diff --git a/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinVersion.kt b/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinVersion.kt index a4028ad6663..c23093ef35d 100644 --- a/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinVersion.kt +++ b/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinVersion.kt @@ -16,6 +16,7 @@ enum class KotlinVersion(val version: String) { KOTLIN_1_7("1.7"), KOTLIN_1_8("1.8"), KOTLIN_1_9("1.9"), + KOTLIN_2_0("2.0"), ; companion object { diff --git a/libraries/tools/kotlin-gradle-plugin-api/api/kotlin-gradle-plugin-api.api b/libraries/tools/kotlin-gradle-plugin-api/api/kotlin-gradle-plugin-api.api index db26240b14c..3e4fae5b9ef 100644 --- a/libraries/tools/kotlin-gradle-plugin-api/api/kotlin-gradle-plugin-api.api +++ b/libraries/tools/kotlin-gradle-plugin-api/api/kotlin-gradle-plugin-api.api @@ -538,6 +538,7 @@ public final class org/jetbrains/kotlin/gradle/dsl/KotlinVersion : java/lang/Enu public static final field KOTLIN_1_7 Lorg/jetbrains/kotlin/gradle/dsl/KotlinVersion; public static final field KOTLIN_1_8 Lorg/jetbrains/kotlin/gradle/dsl/KotlinVersion; public static final field KOTLIN_1_9 Lorg/jetbrains/kotlin/gradle/dsl/KotlinVersion; + public static final field KOTLIN_2_0 Lorg/jetbrains/kotlin/gradle/dsl/KotlinVersion; public final fun getVersion ()Ljava/lang/String; public static fun valueOf (Ljava/lang/String;)Lorg/jetbrains/kotlin/gradle/dsl/KotlinVersion; public static fun values ()[Lorg/jetbrains/kotlin/gradle/dsl/KotlinVersion; diff --git a/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonCompilerOptions.kt b/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonCompilerOptions.kt index e1bf6ca3e5e..d8248e4c40d 100644 --- a/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonCompilerOptions.kt +++ b/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonCompilerOptions.kt @@ -9,7 +9,7 @@ interface KotlinCommonCompilerOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCo /** * Allow using declarations only from the specified version of bundled libraries - * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)" + * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)", "2.0 (experimental)" * Default value: null */ @get:org.gradle.api.tasks.Optional @@ -18,7 +18,7 @@ interface KotlinCommonCompilerOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCo /** * Provide source compatibility with the specified version of Kotlin - * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)" + * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)", "2.0 (experimental)" * Default value: null */ @get:org.gradle.api.tasks.Optional diff --git a/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonOptions.kt b/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonOptions.kt index fda8e227e61..66fa621f6c3 100644 --- a/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonOptions.kt +++ b/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinCommonOptions.kt @@ -14,7 +14,7 @@ interface KotlinCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonTool /** * Allow using declarations only from the specified version of bundled libraries - * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)" + * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)", "2.0 (experimental)" * Default value: null */ var apiVersion: kotlin.String? @@ -27,7 +27,7 @@ interface KotlinCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonTool /** * Provide source compatibility with the specified version of Kotlin - * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)" + * Possible values: "1.3 (deprecated)", "1.4 (deprecated)", "1.5", "1.6", "1.7", "1.8", "1.9 (experimental)", "2.0 (experimental)" * Default value: null */ var languageVersion: kotlin.String? diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/DefaultLanguageSettingsBuilder.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/DefaultLanguageSettingsBuilder.kt index 0a262ddac05..cb0a6a5b732 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/DefaultLanguageSettingsBuilder.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/sources/DefaultLanguageSettingsBuilder.kt @@ -145,7 +145,8 @@ private val apiVersionValues = ApiVersion.run { KOTLIN_1_6, KOTLIN_1_7, KOTLIN_1_8, - KOTLIN_1_9 + KOTLIN_1_9, + KOTLIN_2_0 ) } diff --git a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/Kapt3Plugin.kt b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/Kapt3Plugin.kt index 5b51c3f5be6..50d1be27ac3 100644 --- a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/Kapt3Plugin.kt +++ b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/Kapt3Plugin.kt @@ -71,7 +71,7 @@ class Kapt3CommandLineProcessor : CommandLineProcessor { if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) { configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]?.report( CompilerMessageSeverity.ERROR, - "kapt currently doesn't support experimental K2 compiler\nDisable K2 compiler by removing -Xuse-k2 flag" + "kapt currently doesn't support language version 2.0\nPlease use language version 1.* (e.g. 1.9) instead" ) }