Don't break the "API <= LV" rule in compiler tests

Stability of the language version is used for example to determine
whether the PRE_RELEASE_CLASS diagnostic should be reported. Now that
there are pre-release classes in the standard library (Experimental et
al.), we'd like to avoid this error on their usages in diagnostic tests
which are using the "!API_VERSION: 1.3" directive
This commit is contained in:
Alexander Udalov
2018-02-13 17:14:16 +01:00
parent 31e762c679
commit 4a370e9dba
@@ -63,10 +63,12 @@ fun parseLanguageVersionSettings(directiveMap: Map<String, String>): LanguageVer
val apiVersion = (if (apiVersionString != null) ApiVersion.parse(apiVersionString) else ApiVersion.LATEST_STABLE)
?: error("Unknown API version: $apiVersionString")
val languageVersion = maxOf(LanguageVersion.LATEST_STABLE, LanguageVersion.fromVersionString(apiVersion.versionString)!!)
val languageFeatures = languageFeaturesString?.let(::collectLanguageFeatureMap).orEmpty()
return CompilerTestLanguageVersionSettings(
languageFeatures, apiVersion, LanguageVersion.LATEST_STABLE,
languageFeatures, apiVersion, languageVersion,
mapOf(*listOfNotNull(experimental, useExperimental).toTypedArray())
)
}