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 573d6f62a1d..b675b5d682f 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 @@ -304,6 +304,18 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) } + val deprecatedVersion = when { + languageVersion < LanguageVersion.FIRST_SUPPORTED -> "Language version ${languageVersion.versionString}" + apiVersion < LanguageVersion.FIRST_SUPPORTED -> "API version ${apiVersion.versionString}" + else -> null + } + if (deprecatedVersion != null) { + collector.report( + CompilerMessageSeverity.STRONG_WARNING, + "$deprecatedVersion is deprecated and its support will be removed in a future version of Kotlin" + ) + } + if (progressiveMode && languageVersion < LanguageVersion.LATEST_STABLE) { collector.report( CompilerMessageSeverity.STRONG_WARNING, diff --git a/compiler/testData/cli/js/languageVersion.args b/compiler/testData/cli/js/languageVersion.args index 377825bbeeb..a960064400e 100644 --- a/compiler/testData/cli/js/languageVersion.args +++ b/compiler/testData/cli/js/languageVersion.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt -output $TEMP_DIR$/out.js -language-version -1.0 +1.2 diff --git a/compiler/testData/cli/js/languageVersion.kt b/compiler/testData/cli/js/languageVersion.kt index 73d94ad88be..de7d853c6df 100644 --- a/compiler/testData/cli/js/languageVersion.kt +++ b/compiler/testData/cli/js/languageVersion.kt @@ -1,5 +1,5 @@ package test -sealed class Base - -class Derived : Base() +annotation class Outer { + class Nested +} diff --git a/compiler/testData/cli/js/languageVersion.out b/compiler/testData/cli/js/languageVersion.out index d0066724501..a96063e15cb 100644 --- a/compiler/testData/cli/js/languageVersion.out +++ b/compiler/testData/cli/js/languageVersion.out @@ -1,4 +1,4 @@ -compiler/testData/cli/js/languageVersion.kt:5:17: error: this type is sealed, so it can be inherited by only its own nested classes or objects -class Derived : Base() - ^ +compiler/testData/cli/js/languageVersion.kt:4:5: error: members are not allowed in annotation class + class Nested + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersion.args b/compiler/testData/cli/jvm/apiVersion.args index e6a17467052..be2fe08ada2 100644 --- a/compiler/testData/cli/jvm/apiVersion.args +++ b/compiler/testData/cli/jvm/apiVersion.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version -1.0 +1.2 diff --git a/compiler/testData/cli/jvm/apiVersion.kt b/compiler/testData/cli/jvm/apiVersion.kt index 8d4661d72c0..bf60469fd3b 100644 --- a/compiler/testData/cli/jvm/apiVersion.kt +++ b/compiler/testData/cli/jvm/apiVersion.kt @@ -1,3 +1,3 @@ fun test() { - ""::class.isInstance(42) + ""::class.sealedSubclasses } diff --git a/compiler/testData/cli/jvm/apiVersion.out b/compiler/testData/cli/jvm/apiVersion.out index 95f1f2de777..ecb959d06b0 100644 --- a/compiler/testData/cli/jvm/apiVersion.out +++ b/compiler/testData/cli/jvm/apiVersion.out @@ -1,7 +1,4 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1 - ""::class.isInstance(42) - ^ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance - ""::class.isInstance(42) +compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses + ""::class.sealedSubclasses ^ -COMPILATION_ERROR \ No newline at end of file +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersion1.0.out b/compiler/testData/cli/jvm/apiVersion1.0.out index 191a35e0b83..be6597df353 100644 --- a/compiler/testData/cli/jvm/apiVersion1.0.out +++ b/compiler/testData/cli/jvm/apiVersion1.0.out @@ -1,3 +1,4 @@ +warning: language version 1.1 is deprecated and its support will be removed in a future version of Kotlin compiler/testData/cli/jvm/apiVersion1.0.kt:8:1: error: the feature "coroutines" is only available since API version 1.1 (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines) suspend fun test() { ^ @@ -10,4 +11,4 @@ compiler/testData/cli/jvm/apiVersion1.0.kt:10:5: error: the feature "bound calla compiler/testData/cli/jvm/apiVersion1.0.kt:15:11: error: the feature "local delegated properties" is only available since API version 1.1 val b by lazy { "" } ^ -COMPILATION_ERROR \ No newline at end of file +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.args b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.args index 6454e01784a..230810fe312 100644 --- a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.args +++ b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/apiVersionAndSinceNewerKotlin.kt -d $TEMP_DIR$ -api-version -1.0 +1.2 diff --git a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt index dc1db006384..f5186d4e0f1 100644 --- a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt +++ b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt @@ -1,5 +1,5 @@ -@SinceKotlin("1.0") +@SinceKotlin("1.2") fun old() {} -@SinceKotlin("1.1") +@SinceKotlin("1.3") fun new() {} diff --git a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out index 785c4cc8b61..1e0da98317a 100644 --- a/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out +++ b/compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.out @@ -1,4 +1,4 @@ -compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt:4:1: warning: the version is greater than the specified API version 1.0 -@SinceKotlin("1.1") +compiler/testData/cli/jvm/apiVersionAndSinceNewerKotlin.kt:4:1: warning: the version is greater than the specified API version 1.2 +@SinceKotlin("1.3") ^ OK diff --git a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args index 70d1ba13868..a026e3ef354 100644 --- a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args +++ b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.args @@ -2,6 +2,6 @@ $TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version -1.1 +1.3 -language-version -1.0 +1.2 diff --git a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out index 47a8f88e3a8..e77af240675 100644 --- a/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out +++ b/compiler/testData/cli/jvm/apiVersionGreaterThanLanguage.out @@ -1,2 +1,2 @@ -error: -api-version (1.1) cannot be greater than -language-version (1.0) +error: -api-version (1.3) cannot be greater than -language-version (1.2) COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.argfile b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.argfile index 4b325f26068..93af1fd5987 100644 --- a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.argfile +++ b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.argfile @@ -1 +1 @@ -$TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version 1.0 -language-version 1.1 +$TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version 1.2 -language-version 1.3 diff --git a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.args b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.args index 6ac842f7e60..29ebce58cea 100644 --- a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.args +++ b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.args @@ -2,6 +2,6 @@ $TESTDATA_DIR$/apiVersion.kt -d $TEMP_DIR$ -api-version -1.0 +1.2 -language-version -1.1 +1.3 diff --git a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out index 95f1f2de777..ecb959d06b0 100644 --- a/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out +++ b/compiler/testData/cli/jvm/apiVersionLessThanLanguage.out @@ -1,7 +1,4 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1 - ""::class.isInstance(42) - ^ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance - ""::class.isInstance(42) +compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses + ""::class.sealedSubclasses ^ -COMPILATION_ERROR \ No newline at end of file +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out b/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out index 47411cd0929..ecb959d06b0 100644 --- a/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out +++ b/compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.out @@ -1,7 +1,4 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1 - ""::class.isInstance(42) - ^ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance - ""::class.isInstance(42) +compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses + ""::class.sealedSubclasses ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/argfileWithEscaping.argfile b/compiler/testData/cli/jvm/argfileWithEscaping.argfile index bf23c67b7eb..50e95193f2c 100644 --- a/compiler/testData/cli/jvm/argfileWithEscaping.argfile +++ b/compiler/testData/cli/jvm/argfileWithEscaping.argfile @@ -1,4 +1,4 @@ -X"some escaped \" sequence \\" $TESTDATA_DIR$/apiVersion.kt -d -$TEMP_DIR$ -api-version 1.0 -language-version 1.1 \ No newline at end of file +$TEMP_DIR$ -api-version 1.2 -language-version 1.3 diff --git a/compiler/testData/cli/jvm/argfileWithEscaping.out b/compiler/testData/cli/jvm/argfileWithEscaping.out index 45f6983f79d..d0ea85b44de 100644 --- a/compiler/testData/cli/jvm/argfileWithEscaping.out +++ b/compiler/testData/cli/jvm/argfileWithEscaping.out @@ -1,8 +1,5 @@ warning: flag is not supported by this version of the compiler: -Xsome escaped " sequence / -compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1 - ""::class.isInstance(42) - ^ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance - ""::class.isInstance(42) +compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses + ""::class.sealedSubclasses ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/deprecatedApiVersion.args b/compiler/testData/cli/jvm/deprecatedApiVersion.args new file mode 100644 index 00000000000..ad63ad898b9 --- /dev/null +++ b/compiler/testData/cli/jvm/deprecatedApiVersion.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/simple.kt +-d +$TEMP_DIR$ +-api-version +1.1 diff --git a/compiler/testData/cli/jvm/deprecatedApiVersion.out b/compiler/testData/cli/jvm/deprecatedApiVersion.out new file mode 100644 index 00000000000..ae2cd12e9f9 --- /dev/null +++ b/compiler/testData/cli/jvm/deprecatedApiVersion.out @@ -0,0 +1,2 @@ +warning: API version 1.1 is deprecated and its support will be removed in a future version of Kotlin +OK diff --git a/compiler/testData/cli/jvm/deprecatedLanguageVersion.args b/compiler/testData/cli/jvm/deprecatedLanguageVersion.args new file mode 100644 index 00000000000..e14acd20ae9 --- /dev/null +++ b/compiler/testData/cli/jvm/deprecatedLanguageVersion.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/simple.kt +-d +$TEMP_DIR$ +-language-version +1.1 diff --git a/compiler/testData/cli/jvm/deprecatedLanguageVersion.out b/compiler/testData/cli/jvm/deprecatedLanguageVersion.out new file mode 100644 index 00000000000..c0bcb9208cf --- /dev/null +++ b/compiler/testData/cli/jvm/deprecatedLanguageVersion.out @@ -0,0 +1,2 @@ +warning: language version 1.1 is deprecated and its support will be removed in a future version of Kotlin +OK diff --git a/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out b/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out index 7eeb0db523f..8fc0b31902d 100644 --- a/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out +++ b/compiler/testData/cli/jvm/internalArgEnableLanguageFeature.out @@ -7,6 +7,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: language version 1.1 is deprecated and its support will be removed in a future version of Kotlin compiler/testData/cli/jvm/legacySmartCastsAfterTry.kt:8:9: error: only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? some.length ^ diff --git a/compiler/testData/cli/jvm/languageVersion.args b/compiler/testData/cli/jvm/languageVersion.args index 2b0e3d5e862..54699e92aca 100644 --- a/compiler/testData/cli/jvm/languageVersion.args +++ b/compiler/testData/cli/jvm/languageVersion.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/languageVersion.kt -d $TEMP_DIR$ -language-version -1.0 +1.2 diff --git a/compiler/testData/cli/jvm/languageVersion.kt b/compiler/testData/cli/jvm/languageVersion.kt index 1eb94bd3466..de7d853c6df 100644 --- a/compiler/testData/cli/jvm/languageVersion.kt +++ b/compiler/testData/cli/jvm/languageVersion.kt @@ -1,9 +1,5 @@ package test -sealed class Base - -class Derived : Base() - -fun test() { - ""::class.isInstance(42) +annotation class Outer { + class Nested } diff --git a/compiler/testData/cli/jvm/languageVersion.out b/compiler/testData/cli/jvm/languageVersion.out index 7179b172f54..4cede899bca 100644 --- a/compiler/testData/cli/jvm/languageVersion.out +++ b/compiler/testData/cli/jvm/languageVersion.out @@ -1,10 +1,4 @@ -compiler/testData/cli/jvm/languageVersion.kt:5:17: error: this type is sealed, so it can be inherited by only its own nested classes or objects -class Derived : Base() - ^ -compiler/testData/cli/jvm/languageVersion.kt:8:5: error: the feature "bound callable references" is only available since language version 1.1 - ""::class.isInstance(42) +compiler/testData/cli/jvm/languageVersion.kt:4:5: error: members are not allowed in annotation class + class Nested ^ -compiler/testData/cli/jvm/languageVersion.kt:8:15: error: unresolved reference: isInstance - ""::class.isInstance(42) - ^ -COMPILATION_ERROR \ No newline at end of file +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.argfile b/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.argfile index 324174ac029..e83861dd435 100644 --- a/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.argfile +++ b/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.argfile @@ -1 +1 @@ -$TEMP_DIR$ -api-version 1.0 -language-version 1.1 \ No newline at end of file +$TEMP_DIR$ -api-version 1.2 -language-version 1.3 \ No newline at end of file diff --git a/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out b/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out index 47411cd0929..ecb959d06b0 100644 --- a/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out +++ b/compiler/testData/cli/jvm/mixingArgfilesAndUsualArgs.out @@ -1,7 +1,4 @@ -compiler/testData/cli/jvm/apiVersion.kt:2:5: error: the feature "bound callable references" is only available since API version 1.1 - ""::class.isInstance(42) - ^ -compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: isInstance - ""::class.isInstance(42) +compiler/testData/cli/jvm/apiVersion.kt:2:15: error: unresolved reference: sealedSubclasses + ""::class.sealedSubclasses ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/unsupportedTypeAlias.out b/compiler/testData/cli/jvm/unsupportedTypeAlias.out index 67a5ca56461..2dae0042104 100644 --- a/compiler/testData/cli/jvm/unsupportedTypeAlias.out +++ b/compiler/testData/cli/jvm/unsupportedTypeAlias.out @@ -1,4 +1,5 @@ +warning: language version 1.0 is deprecated and its support will be removed in a future version of Kotlin compiler/testData/cli/jvm/unsupportedTypeAlias.kt:3:1: error: the feature "type aliases" is only available since language version 1.1 typealias Unused = String ^ -COMPILATION_ERROR \ No newline at end of file +COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt index 220511ed980..c5a2ddfbee5 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/output.txt @@ -1,3 +1,4 @@ +warning: language version 1.0 is deprecated and its support will be removed in a future version of Kotlin compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:2:13: error: unresolved reference: Str import test.Str ^ @@ -13,4 +14,4 @@ compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCo compiler/testData/compileKotlinAgainstCustomBinaries/typeAliasesAreInvisibleInCompatibilityMode/main.kt:7:23: error: unresolved reference: Nested nested: Klass.Nested ^ -COMPILATION_ERROR \ No newline at end of file +COMPILATION_ERROR diff --git a/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected b/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected index 5c07676d562..6f40c3f5ef6 100644 --- a/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected +++ b/compiler/testData/integration/ant/jvm/languageVersion/build.log.expected @@ -3,9 +3,9 @@ Buildfile: [TestData]/build.xml build: [kotlinc] Compiling [[TestData]/main.kt] => [[Temp]/hello.jar] - [kotlinc] [TestData]/main.kt:3:17: error: this type is sealed, so it can be inherited by only its own nested classes or objects - [kotlinc] class Derived : Base() - [kotlinc] ^ + [kotlinc] [TestData]/main.kt:2:5: error: members are not allowed in annotation class + [kotlinc] class Nested + [kotlinc] ^ ERR: diff --git a/compiler/testData/integration/ant/jvm/languageVersion/build.xml b/compiler/testData/integration/ant/jvm/languageVersion/build.xml index 7f8229c02e5..83261e872c7 100644 --- a/compiler/testData/integration/ant/jvm/languageVersion/build.xml +++ b/compiler/testData/integration/ant/jvm/languageVersion/build.xml @@ -3,7 +3,7 @@ - + diff --git a/compiler/testData/integration/ant/jvm/languageVersion/main.kt b/compiler/testData/integration/ant/jvm/languageVersion/main.kt index a4c2f854f25..e8b6308fec6 100644 --- a/compiler/testData/integration/ant/jvm/languageVersion/main.kt +++ b/compiler/testData/integration/ant/jvm/languageVersion/main.kt @@ -1,3 +1,3 @@ -sealed class Base - -class Derived : Base() +annotation class Outer { + class Nested +} diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java index 67e2b5af661..f131c1b6d5e 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -151,6 +151,16 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/coroutinesWarn.args"); } + @TestMetadata("deprecatedApiVersion.args") + public void testDeprecatedApiVersion() throws Exception { + runTest("compiler/testData/cli/jvm/deprecatedApiVersion.args"); + } + + @TestMetadata("deprecatedLanguageVersion.args") + public void testDeprecatedLanguageVersion() throws Exception { + runTest("compiler/testData/cli/jvm/deprecatedLanguageVersion.args"); + } + @TestMetadata("diagnosticsOrder.args") public void testDiagnosticsOrder() throws Exception { runTest("compiler/testData/cli/jvm/diagnosticsOrder.args"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index eb80e5a0c13..01e1afa8601 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -251,7 +251,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration fun testPreReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion() { withPreRelease(true) { val library = compileLibrary("library") - val someStableReleasedVersion = LanguageVersion.values().first().also { assert(it.isStable) } + val someStableReleasedVersion = LanguageVersion.values().first { it.isStable && it >= LanguageVersion.FIRST_SUPPORTED } compileKotlin( "source.kt", tmpdir, listOf(library), K2JVMCompiler(), listOf("-language-version", someStableReleasedVersion.versionString) diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 0458e3fe08a..f5ac791d74e 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -213,6 +213,9 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware { fun fromFullVersionString(str: String) = str.split(".", "-").let { if (it.size >= 2) fromVersionString("${it[0]}.${it[1]}") else null } + @JvmField + val FIRST_SUPPORTED = KOTLIN_1_2 + @JvmField val LATEST_STABLE = KOTLIN_1_3 }