Do not set api version to language version when language version is null

#KT-21852 fixed
    #KT-21574 fixed
This commit is contained in:
Alexey Tsvetkov
2017-12-15 23:18:32 +03:00
parent 17b4d4a973
commit 3f082346ae
13 changed files with 105 additions and 7 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.cli.common.arguments
import com.intellij.util.text.VersionComparatorUtil
import java.util.*
import kotlin.reflect.KClass
import kotlin.reflect.KMutableProperty1
@@ -98,4 +99,10 @@ fun <T : Any> collectProperties(kClass: KClass<T>, inheritedOnly: Boolean): List
return properties.filter {
it.visibility == KVisibility.PUBLIC && it.findAnnotation<Transient>() == null
}
}
fun CommonCompilerArguments.setApiVersionToLanguageVersionIfNeeded() {
if (languageVersion != null && VersionComparatorUtil.compare(languageVersion, apiVersion) < 0) {
apiVersion = languageVersion
}
}