From 3556533d955a8fb561c4fb8d6b37b04b8b48f205 Mon Sep 17 00:00:00 2001 From: Troels Bjerre Lund Date: Tue, 24 Oct 2023 10:55:26 +0200 Subject: [PATCH] [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. --- .../src/main/kotlin/org/jetbrains/kotlin/PlatformInfo.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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 5848009f811..6cf57bc9fec 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 @@ object PlatformInfo { @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