Support Kotlin 1.5 / 1.6 language versions come from external sources

#KTIJ-15743 Fixed

Original commit: 784f77a2b98b0c9719f4919e45a193f35d7d9875
This commit is contained in:
Vladimir Dolzhenko
2021-06-10 13:12:36 +00:00
committed by Space
parent 1a0516e2c8
commit 1eb04d5440
2 changed files with 21 additions and 0 deletions
@@ -67,6 +67,8 @@ fun getDefaultLanguageLevel(
fun String?.toLanguageVersion(): LanguageVersion = when {
this == null -> VersionView.RELEASED_VERSION
startsWith("1.6") -> LanguageVersion.KOTLIN_1_6
startsWith("1.5") -> LanguageVersion.KOTLIN_1_5
startsWith("1.4") -> LanguageVersion.KOTLIN_1_4
startsWith("1.3") -> LanguageVersion.KOTLIN_1_3
startsWith("1.2") -> LanguageVersion.KOTLIN_1_2
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.facet
import org.jetbrains.kotlin.config.LanguageVersion
import org.junit.Test
import kotlin.test.assertSame
class KotlinVersionInfoProviderTest {
@Test
fun supportedLanguageVersionConsistency() {
LanguageVersion.values().forEach { languageVersion ->
assertSame(languageVersion, languageVersion.toString().toLanguageVersion())
}
}
}