From 5d9348eea10a9160a3004d2a72f30008a872c52c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 26 Mar 2018 16:56:25 +0200 Subject: [PATCH] Sanitize compiler version for version requirement checks Strip everything after (and including) the first '-' character. The previous approach of skipping the checks if "SNAPSHOT" is in the version, is subsumed by the new one because "1.2-SNAPSHOT" now becomes "1.2" with regards to the version requirement checks, which allows the compiler to use the 1.2-only API --- .../src/org/jetbrains/kotlin/resolve/deprecationUtil.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt index 91bd1925c85..5415ba23655 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt @@ -345,7 +345,7 @@ class DeprecationResolver( ProtoBuf.VersionRequirement.VersionKind.API_VERSION -> languageVersionSettings.apiVersion.version ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION -> - KotlinCompilerVersion.getVersion()?.takeIf { "SNAPSHOT" !in it }?.let(::createVersion) + KotlinCompilerVersion.getVersion()?.substringBefore('-')?.let(::createVersion) else -> null } if (currentVersion != null && currentVersion < requiredVersion) {