Allow pre-release compiler reading pre-release binaries in tests

Pre-release compiler should be able to read pre-release binaries in tests
even if a stable language version is used, otherwise no stdlib API can be read.
This commit is contained in:
Ilya Gorbunov
2018-06-26 20:28:05 +03:00
parent f423403167
commit c667340261
2 changed files with 3 additions and 2 deletions
@@ -34,7 +34,7 @@ data class CompilerTestLanguageVersionSettings(
override fun getFeatureSupport(feature: LanguageFeature): LanguageFeature.State =
languageFeatures[feature] ?: delegate.getFeatureSupport(feature)
override fun isPreRelease(): Boolean = languageVersion.isPreRelease()
override fun isPreRelease(): Boolean = KotlinCompilerVersion.isPreRelease()
@Suppress("UNCHECKED_CAST")
override fun <T> getFlag(flag: AnalysisFlag<T>): T = analysisFlags[flag] as T? ?: flag.defaultValue
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
import org.jetbrains.kotlin.load.kotlin.loadModuleMapping
@@ -44,7 +45,7 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
"-d", tmpdir.path,
"-module-name", moduleName,
"-language-version", compileWith.versionString
) + extraOptions)
) + extraOptions + listOfNotNull("-Xskip-metadata-version-check".takeIf { KotlinCompilerVersion.isPreRelease() }))
val mapping = ModuleMapping.loadModuleMapping(
File(tmpdir, "META-INF/$moduleName.${ModuleMapping.MAPPING_FILE_EXT}").readBytes(), "test",