mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-05 08:30:11 +08:00
Fix Method.registerEvent for Kotlin functions (#495)
* Fix test error * correct error message * using none to instead exclamation mark
This commit is contained in:
parent
236cf2540d
commit
f8eed41d62
@ -363,7 +363,7 @@ internal class GroupImpl(
|
|||||||
source = it
|
source = it
|
||||||
}.sendAndExpect<MessageSvcPbSendMsg.Response>().let {
|
}.sendAndExpect<MessageSvcPbSendMsg.Response>().let {
|
||||||
check(it is MessageSvcPbSendMsg.Response.SUCCESS) {
|
check(it is MessageSvcPbSendMsg.Response.SUCCESS) {
|
||||||
"Send temp message failed: $it"
|
"Send group message failed: $it"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ internal suspend fun <T : User> Friend.sendMessageImpl(
|
|||||||
source = it
|
source = it
|
||||||
}.sendAndExpect<MessageSvcPbSendMsg.Response>().let {
|
}.sendAndExpect<MessageSvcPbSendMsg.Response>().let {
|
||||||
check(it is MessageSvcPbSendMsg.Response.SUCCESS) {
|
check(it is MessageSvcPbSendMsg.Response.SUCCESS) {
|
||||||
"Send temp message failed: $it"
|
"Send friend message failed: $it"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
friendReceiptConstructor(source)
|
friendReceiptConstructor(source)
|
||||||
|
@ -109,7 +109,7 @@ internal fun Method.registerEvent(
|
|||||||
require(!kotlinFunction.returnType.isMarkedNullable) {
|
require(!kotlinFunction.returnType.isMarkedNullable) {
|
||||||
"Kotlin event handlers cannot have nullable return type."
|
"Kotlin event handlers cannot have nullable return type."
|
||||||
}
|
}
|
||||||
require(kotlinFunction.parameters.any { it.type.isMarkedNullable }) {
|
require(kotlinFunction.parameters.none { it.type.isMarkedNullable }) {
|
||||||
"Kotlin event handlers cannot have nullable parameter type."
|
"Kotlin event handlers cannot have nullable parameter type."
|
||||||
}
|
}
|
||||||
when (kotlinFunction.returnType.classifier) {
|
when (kotlinFunction.returnType.classifier) {
|
||||||
|
Loading…
Reference in New Issue
Block a user