[K/N] Fix K2 detection in native tests
This updates how the requested language version is detected in native
tests, after language version 2 has become the default.
diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt
index 5848009..6cf57bc 100644
--- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt
+++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt
@@ -53,12 +53,9 @@
@JvmStatic
fun isK2(project: Project): Boolean {
- return project.globalTestArgs.contains("-language-version") &&
- // Enough future versions are specified until K1 will be stopped to test
- (project.globalTestArgs.contains("2.0")
- || project.globalTestArgs.contains("2.1")
- || project.globalTestArgs.contains("2.2")
- )
+ val idx = project.globalTestArgs.indexOf("-language-version")
+ if (idx == -1) return true
+ return project.globalTestArgs[idx + 1].toDouble() >= 2.0
}
@JvmStatic