diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/BuiltInCommandCallResolver.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/BuiltInCommandCallResolver.kt index d1cdf647e..58d420c56 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/BuiltInCommandCallResolver.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/BuiltInCommandCallResolver.kt @@ -12,6 +12,9 @@ import net.mamoe.mirai.console.util.cast import net.mamoe.mirai.console.util.safeCast import java.util.* +/** + * Builtin implementation of [CommandCallResolver] + */ @ConsoleExperimentalApi @ExperimentalCommandDescriptors public object BuiltInCommandCallResolver : CommandCallResolver { diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/CommandCallResolver.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/CommandCallResolver.kt index 6e8eda94e..b4671412f 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/CommandCallResolver.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/resolve/CommandCallResolver.kt @@ -11,9 +11,13 @@ package net.mamoe.mirai.console.command.resolve import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors import net.mamoe.mirai.console.command.parse.CommandCall +import net.mamoe.mirai.console.extensions.CommandCallResolverProvider /** * The resolver converting a [CommandCall] into [ResolvedCommandCall] based on registered [] + * + * @see CommandCallResolverProvider The provider to instances of this class + * @see BuiltInCommandCallResolver The builtin implementation */ @ExperimentalCommandDescriptors public interface CommandCallResolver { diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/StandardUtils.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/StandardUtils.kt index c2eb22a0c..0d7dc8630 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/StandardUtils.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/util/StandardUtils.kt @@ -11,6 +11,10 @@ package net.mamoe.mirai.console.util import kotlin.contracts.contract +/** + * Perform `this as? T`. + */ +@JvmSynthetic public inline fun Any?.safeCast(): T? { contract { returnsNotNull() implies (this@safeCast is T) @@ -18,6 +22,10 @@ public inline fun Any?.safeCast(): T? { return this as? T } +/** + * Perform `this as T`. + */ +@JvmSynthetic public inline fun Any?.cast(): T { contract { returns() implies (this@cast is T)