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 com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.config.ApiVersion
|
import org.jetbrains.kotlin.config.ApiVersion
|
||||||
|
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||||
@@ -301,7 +302,7 @@ class DeprecationResolver(
|
|||||||
ProtoBuf.VersionRequirement.VersionKind.API_VERSION ->
|
ProtoBuf.VersionRequirement.VersionKind.API_VERSION ->
|
||||||
languageVersionSettings.apiVersion
|
languageVersionSettings.apiVersion
|
||||||
ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION ->
|
ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION ->
|
||||||
ApiVersion.LATEST_STABLE
|
KotlinCompilerVersion.getVersion()?.let((ApiVersion)::parse)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
if (currentVersion != null && currentVersion < requiredVersion) {
|
if (currentVersion != null && currentVersion < requiredVersion) {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.config;
|
package org.jetbrains.kotlin.config;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class KotlinCompilerVersion {
|
public class KotlinCompilerVersion {
|
||||||
// The value of this constant is generated by the build script
|
// The value of this constant is generated by the build script
|
||||||
// DON'T MODIFY IT
|
// DON'T MODIFY IT
|
||||||
@@ -38,6 +40,15 @@ public class KotlinCompilerVersion {
|
|||||||
return IS_PRE_RELEASE;
|
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 {
|
static {
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
if (!VERSION.equals("@snapshot@") && !VERSION.contains("-") && IS_PRE_RELEASE) {
|
if (!VERSION.equals("@snapshot@") && !VERSION.contains("-") && IS_PRE_RELEASE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user