From f6571effcc03a3c1b45c85a470d5b5ab36413f5b Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 20 Aug 2018 18:05:45 +0200 Subject: [PATCH] Do not report pre-release errors if release LV is used in pre-release compiler This commit effectively reverts d386712903e7d583bb74eb13cc00671733bb1d48. The reason is that when using a release language version, you can only "see" the subset of a pre-release library which consists of released and supported features, so reporting an error is not helpful there. Also, it presents a problem currently when using kotlinc 1.3 (which is pre-release) with language version 1.2 (stable) against the bundled stdlib of version 1.3 (pre-release) #KT-21267 Declined --- .../output.txt | 9 +-------- .../source.kt | 3 ++- .../jetbrains/kotlin/config/LanguageVersionSettings.kt | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/output.txt index 44ec8ddab78..d86bac9de59 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/output.txt @@ -1,8 +1 @@ -error: incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors -compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/source.kt:5:16: error: class 'a.A' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler -fun baz(param: A) { - ^ -compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/source.kt:6:5: error: class 'a.AKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler - foo() - ^ -COMPILATION_ERROR +OK diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/source.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/source.kt index 28999b2eadb..f21b3de444d 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/source.kt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/preReleaseCompilerAgainstPreReleaseLibraryStableLanguageVersion/source.kt @@ -2,6 +2,7 @@ package usage import a.* -fun baz(param: A) { +fun baz(param: A): A { foo() + return param } diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index d6e8406703b..1cdf1189cc6 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -271,7 +271,7 @@ class LanguageVersionSettingsImpl @JvmOverloads constructor( } } - override fun isPreRelease(): Boolean = languageVersion.isPreRelease() || + override fun isPreRelease(): Boolean = KotlinCompilerVersion.isPreRelease() || specificFeatures.any { (feature, state) -> state == LanguageFeature.State.ENABLED && feature.forcesPreReleaseBinariesIfEnabled() }