Support patch versions in RequireKotlin with kind=COMPILER_VERSION
This commit is contained in:
committed by
Denis Zharkov
parent
72222c718a
commit
b6a55f74f4
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
@@ -301,7 +302,7 @@ class DeprecationResolver(
|
||||
ProtoBuf.VersionRequirement.VersionKind.API_VERSION ->
|
||||
languageVersionSettings.apiVersion
|
||||
ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION ->
|
||||
ApiVersion.LATEST_STABLE
|
||||
KotlinCompilerVersion.getVersion()?.let((ApiVersion)::parse)
|
||||
else -> null
|
||||
}
|
||||
if (currentVersion != null && currentVersion < requiredVersion) {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.config;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class KotlinCompilerVersion {
|
||||
// The value of this constant is generated by the build script
|
||||
// DON'T MODIFY IT
|
||||
@@ -38,6 +40,15 @@ public class KotlinCompilerVersion {
|
||||
return IS_PRE_RELEASE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return version of this compiler, or `null` if it isn't known (if VERSION is "@snapshot@")
|
||||
*/
|
||||
@Nullable
|
||||
public static String getVersion() {
|
||||
//noinspection ConstantConditions
|
||||
return VERSION.equals("@snapshot@") ? null : VERSION;
|
||||
}
|
||||
|
||||
static {
|
||||
//noinspection ConstantConditions
|
||||
if (!VERSION.equals("@snapshot@") && !VERSION.contains("-") && IS_PRE_RELEASE) {
|
||||
|
||||
Reference in New Issue
Block a user