Do not report pre-release errors if release LV is used in pre-release compiler

This commit effectively reverts
d386712903.

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
This commit is contained in:
Alexander Udalov
2018-08-20 18:05:45 +02:00
parent 4e496cf2b2
commit f6571effcc
3 changed files with 4 additions and 10 deletions
@@ -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
@@ -2,6 +2,7 @@ package usage
import a.*
fun baz(param: A) {
fun baz(param: A): A {
foo()
return param
}
@@ -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()
}