From 7ace541597bf896710b9ccb22be880d46d0df3b7 Mon Sep 17 00:00:00 2001 From: hundun Date: Mon, 1 Aug 2022 10:40:06 +0800 Subject: [PATCH] fix compile error from pr-changes --- .../src/command/AbstractSubCommandGroup.kt | 2 +- .../src/internal/command/CommandReflector.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mirai-console/backend/mirai-console/src/command/AbstractSubCommandGroup.kt b/mirai-console/backend/mirai-console/src/command/AbstractSubCommandGroup.kt index bffbf99084f..a1d791eddb7 100644 --- a/mirai-console/backend/mirai-console/src/command/AbstractSubCommandGroup.kt +++ b/mirai-console/backend/mirai-console/src/command/AbstractSubCommandGroup.kt @@ -27,7 +27,7 @@ public abstract class AbstractSubCommandGroup( private val reflector by lazy { SubCommandReflector(this, GroupedCommandSubCommandAnnotationResolver) } @ExperimentalCommandDescriptors - public final override val provideOverloads: List by lazy { + public final override val overloads: List by lazy { reflector.findSubCommands().also { reflector.validate(it) } diff --git a/mirai-console/backend/mirai-console/src/internal/command/CommandReflector.kt b/mirai-console/backend/mirai-console/src/internal/command/CommandReflector.kt index 75c03593f93..6e77d693750 100644 --- a/mirai-console/backend/mirai-console/src/internal/command/CommandReflector.kt +++ b/mirai-console/backend/mirai-console/src/internal/command/CommandReflector.kt @@ -105,7 +105,7 @@ internal object GroupedCommandSubCommandAnnotationResolver : override fun getDescription(ownerCommand: Any, function: KFunction<*>): String? = function.findAnnotation()?.value - override fun hasPropertyAnnotation(command: Any, kProperty: KProperty<*>): Boolean = + override fun isCombinedCommand(command: Any, kProperty: KProperty<*>): Boolean = kProperty.hasAnnotation() } @@ -125,7 +125,7 @@ internal object SimpleCommandSubCommandAnnotationResolver : override fun getDescription(ownerCommand: Command, function: KFunction<*>): String = ownerCommand.description - override fun hasPropertyAnnotation(command: Command, kProperty: KProperty<*>): Boolean = false + override fun isCombinedCommand(command: Command, kProperty: KProperty<*>): Boolean = false } internal interface SubCommandAnnotationResolver { @@ -133,7 +133,7 @@ internal interface SubCommandAnnotationResolver { fun getSubCommandNames(ownerCommand: T, function: KFunction<*>): Array fun getAnnotatedName(ownerCommand: T, parameter: KParameter): String? fun getDescription(ownerCommand: T, function: KFunction<*>): String? - fun hasPropertyAnnotation(command: T, kProperty: KProperty<*>): Boolean + fun isCombinedCommand(command: T, kProperty: KProperty<*>): Boolean } @ConsoleExperimentalApi @@ -232,7 +232,7 @@ internal class SubCommandReflector( throw IllegalCommandDeclarationException(owner, this, message) } - private fun KProperty<*>.isSubCommandProviderProperty(): Boolean = annotationResolver.hasPropertyAnnotation(owner, this) + private fun KProperty<*>.isSubCommandProviderProperty(): Boolean = annotationResolver.isCombinedCommand(owner, this) private fun KFunction<*>.isSubCommandFunction(): Boolean = annotationResolver.hasAnnotation(owner, this) private fun KFunction<*>.checkExtensionReceiver() { this.extensionReceiverParameter?.let { receiver -> @@ -396,7 +396,7 @@ internal class SubCommandReflector( .filter { it is SubCommandGroup } .flatMap { property -> property as SubCommandGroup - property.provideOverloads + property.overloads }.toList() val list: MutableList = ArrayList()