From 704674698f41b2aaf87fbcf007b9ac6b1f0fc658 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sun, 20 Sep 2020 19:05:45 +0800 Subject: [PATCH] Add ResolveContext --- .../main/kotlin/net/mamoe/mirai/console/util/SemVersion.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/SemVersion.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/SemVersion.kt index e4940f1be..095280b90 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/SemVersion.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/SemVersion.kt @@ -124,11 +124,12 @@ internal constructor( */ @Throws(IllegalArgumentException::class) @JvmStatic - public fun parseRangeRequirement(requirement: String): Requirement = SemVersionInternal.parseRangeRequirement(requirement) + public fun parseRangeRequirement(requirement: String): Requirement = + SemVersionInternal.parseRangeRequirement(requirement) /** @see [Requirement.test] */ @JvmStatic - public fun Requirement.test(version: String): Boolean = test(invoke(version)) + public fun Requirement.test(@ResolveContext(PLUGIN_VERSION) version: String): Boolean = test(invoke(version)) /** * 当满足 [requirement] 时返回 true, 否则返回 false @@ -144,7 +145,7 @@ internal constructor( /** for Kotlin only */ @JvmStatic @JvmSynthetic - public operator fun Requirement.contains(version: String): Boolean = test(version) + public operator fun Requirement.contains(@ResolveContext(PLUGIN_VERSION) version: String): Boolean = test(version) } @Transient