Infer API version from older runtime in compiler's classpath

For example, if you invoke kotlinc 1.1 with kotlin-stdlib 1.0 in the classpath,
we now infer -api-version 1.0 automatically
This commit is contained in:
Alexander Udalov
2017-02-15 19:19:46 +03:00
parent b56639a775
commit 71fcb07fad
5 changed files with 77 additions and 18 deletions
@@ -99,14 +99,21 @@ interface LanguageVersionSettings {
// Please do not use this to enable/disable specific features/checks. Instead add a new LanguageFeature entry and call supportsFeature
val languageVersion: LanguageVersion
// TODO: refactor arguments related to coroutines so that this list is empty by default
val additionalFeatures: Collection<LanguageFeature>
@Deprecated("This is a temporary solution, please do not use.")
val isApiVersionExplicit: Boolean
}
class LanguageVersionSettingsImpl @JvmOverloads constructor(
override val languageVersion: LanguageVersion,
override val apiVersion: ApiVersion,
additionalFeatures: Collection<LanguageFeature> = emptySet()
additionalFeatures: Collection<LanguageFeature> = emptySet(),
override val isApiVersionExplicit: Boolean = false
) : LanguageVersionSettings {
private val additionalFeatures = additionalFeatures.toSet()
override val additionalFeatures = additionalFeatures.toSet()
override fun supportsFeature(feature: LanguageFeature): Boolean {
val since = feature.sinceVersion