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 e5a95b1408a..0949d930993 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 @@ -21,7 +21,6 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.WARNING import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.config.* -import java.util.* @SuppressWarnings("WeakerAccess") abstract class CommonCompilerArguments : CommonToolArguments() { @@ -563,8 +562,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() { checkLanguageVersionIsStable(languageVersion, collector) checkOutdatedVersions(languageVersion, apiVersion, collector) checkProgressiveMode(languageVersion, collector) - - checkIrSupport(languageVersionSettings, collector) } return languageVersionSettings @@ -635,10 +632,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() { } } - protected open fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) { - // backend-specific - } - private enum class VersionKind(val text: String) { LANGUAGE("Language"), API("API") } 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 37b2fffb6db..aa70ecaa5f1 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 @@ -6,12 +6,8 @@ package org.jetbrains.kotlin.cli.common.arguments import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.* -import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector -import org.jetbrains.kotlin.config.ApiVersion import org.jetbrains.kotlin.config.LanguageFeature -import org.jetbrains.kotlin.config.LanguageVersion -import org.jetbrains.kotlin.config.LanguageVersionSettings class K2JSCompilerArguments : CommonCompilerArguments() { companion object { @@ -236,19 +232,6 @@ class K2JSCompilerArguments : CommonCompilerArguments() { @Argument(value = "-Xwasm", description = "Use experimental WebAssembly compiler backend") var wasm: Boolean by FreezableVar(false) - override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) { - if (!isIrBackendEnabled()) return - - if (languageVersionSettings.languageVersion < LanguageVersion.KOTLIN_1_4 - || languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_4 - ) { - collector.report( - CompilerMessageSeverity.ERROR, - "IR backend cannot be used with language or API version below 1.4" - ) - } - } - override fun configureLanguageFeatures(collector: MessageCollector): MutableMap { return super.configureLanguageFeatures(collector).apply { if (extensionFunctionsInExternals) { @@ -262,4 +245,4 @@ fun K2JSCompilerArguments.isPreIrBackendDisabled(): Boolean = irOnly || irProduceJs || irProduceKlibFile || irBuildCache fun K2JSCompilerArguments.isIrBackendEnabled(): Boolean = - irProduceKlibDir || irProduceJs || irProduceKlibFile || wasm || irBuildCache \ No newline at end of file + irProduceKlibDir || irProduceJs || irProduceKlibFile || wasm || irBuildCache 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 434b1f08738..ed8858aee9c 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 @@ -557,18 +557,4 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise"" } return result } - - override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) { - if (!useIR || useOldBackend) return - - if (languageVersionSettings.languageVersion < LanguageVersion.KOTLIN_1_3 - || languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_3 - ) { - collector.report( - CompilerMessageSeverity.STRONG_WARNING, - "IR backend does not support language or API version lower than 1.3. " + - "This can lead to unexpected behavior or compilation failures" - ) - } - } } diff --git a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt b/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt index a17693a6b9d..a93fd48a7c6 100644 --- a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt +++ b/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt @@ -358,17 +358,6 @@ class K2NativeCompilerArguments : CommonCompilerArguments() { if (printIr) phasesToDumpAfter = arrayOf("ALL") } - - override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) { - if (languageVersionSettings.languageVersion < LanguageVersion.KOTLIN_1_4 - || languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_4 - ) { - collector.report( - severity = CompilerMessageSeverity.ERROR, - message = "Native backend cannot be used with language or API version below 1.4" - ) - } - } } const val EMBED_BITCODE_FLAG = "-Xembed-bitcode"