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 497470153e6..d56f5fc657c 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 @@ -351,6 +351,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) var inferenceCompatibility: Boolean by FreezableVar(false) + @Argument( + value = "-Xsuppress-version-warnings", + description = "Suppress warnings about outdated, inconsistent or experimental language or API versions" + ) + var suppressVersionWarnings: Boolean by FreezableVar(false) + open fun configureAnalysisFlags(collector: MessageCollector): MutableMap, Any> { return HashMap, Any>().apply { put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck) @@ -496,9 +502,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() { val apiVersion = parseVersion(collector, apiVersion, "API") ?: languageVersion checkApiVersionIsNotGreaterThenLanguageVersion(languageVersion, apiVersion, collector) - checkLanguageVersionIsStable(languageVersion, collector) - checkOutdatedVersions(languageVersion, apiVersion, collector) - checkProgressiveMode(languageVersion, collector) val languageVersionSettings = LanguageVersionSettingsImpl( languageVersion, @@ -507,7 +510,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() { configureLanguageFeatures(collector) ) - checkIrSupport(languageVersionSettings, collector) + if (!suppressVersionWarnings) { + checkLanguageVersionIsStable(languageVersion, collector) + checkOutdatedVersions(languageVersion, apiVersion, collector) + checkProgressiveMode(languageVersion, collector) + + checkIrSupport(languageVersionSettings, collector) + } return languageVersionSettings } diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index e53c25cb0d9..766636dd930 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -71,6 +71,7 @@ where advanced options include: -Xreport-perf Report detailed performance statistics -Xskip-metadata-version-check Allow to load classes with bad metadata version and pre-release classes -Xskip-prerelease-check Allow to load pre-release classes + -Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions -Xuse-experimental= Enable, but don't propagate usages of experimental API for marker annotation with the given fully qualified name -Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready -Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 6512353dce0..8c5061724e1 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -179,6 +179,7 @@ where advanced options include: -Xreport-perf Report detailed performance statistics -Xskip-metadata-version-check Allow to load classes with bad metadata version and pre-release classes -Xskip-prerelease-check Allow to load pre-release classes + -Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions -Xuse-experimental= Enable, but don't propagate usages of experimental API for marker annotation with the given fully qualified name -Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready -Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready