From f962618bee4fdd3261a45fc29b27a55451c45ffe Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 14 Jun 2022 12:45:46 +0100 Subject: [PATCH] Fix compiler warnings --- .../src/wizard/MiraiModuleBuilder.kt | 2 +- .../src/commonMain/kotlin/ByteArrayOp.kt | 6 +++--- .../src/mingwX64Test/kotlin/MiraiFileImplTest.kt | 1 + .../src/unixTest/kotlin/UnixMiraiFileImplTest.kt | 1 + .../kotlin/message/data/FileMessageImpl.kt | 1 + .../kotlin/message/data/MessageRefineTest.kt | 13 ------------- .../src/jvmBaseMain/kotlin/contact/GroupImpl.kt | 3 +-- .../nativeTest/kotlin/testFramework/DebugProbes.kt | 7 ++++--- 8 files changed, 12 insertions(+), 22 deletions(-) diff --git a/mirai-console/tools/intellij-plugin/src/wizard/MiraiModuleBuilder.kt b/mirai-console/tools/intellij-plugin/src/wizard/MiraiModuleBuilder.kt index 8df9d3cec..dd0aaef5d 100644 --- a/mirai-console/tools/intellij-plugin/src/wizard/MiraiModuleBuilder.kt +++ b/mirai-console/tools/intellij-plugin/src/wizard/MiraiModuleBuilder.kt @@ -55,7 +55,7 @@ class MiraiModuleBuilder : StarterModuleBuilder() { override fun createWizardSteps( - wizardContext: WizardContext, + context: WizardContext, modulesProvider: ModulesProvider ): Array = emptyArray() diff --git a/mirai-core-utils/src/commonMain/kotlin/ByteArrayOp.kt b/mirai-core-utils/src/commonMain/kotlin/ByteArrayOp.kt index 848e2bde8..8ae8a476c 100644 --- a/mirai-core-utils/src/commonMain/kotlin/ByteArrayOp.kt +++ b/mirai-core-utils/src/commonMain/kotlin/ByteArrayOp.kt @@ -90,7 +90,7 @@ public expect fun GzipDecompressionInput(source: Input): Input /** * @see GzipDecompressionInput */ -public inline fun Input.gzipDecompressionInput(): Input = GzipDecompressionInput(this) +public fun Input.gzipDecompressionInput(): Input = GzipDecompressionInput(this) /** * [source] will be closed on returned [Input.close] @@ -101,7 +101,7 @@ public expect fun InflateInput(source: Input): Input /** * @see InflateInput */ -public inline fun Input.inflateInput(): Input = InflateInput(this) +public fun Input.inflateInput(): Input = InflateInput(this) /** * [source] will be closed on returned [Input.close] @@ -112,4 +112,4 @@ public expect fun DeflateInput(source: Input): Input /** * @see DeflateInput */ -public inline fun Input.deflateInput(): Input = DeflateInput(this) +public fun Input.deflateInput(): Input = DeflateInput(this) diff --git a/mirai-core-utils/src/mingwX64Test/kotlin/MiraiFileImplTest.kt b/mirai-core-utils/src/mingwX64Test/kotlin/MiraiFileImplTest.kt index 9562dee6a..60db9642a 100644 --- a/mirai-core-utils/src/mingwX64Test/kotlin/MiraiFileImplTest.kt +++ b/mirai-core-utils/src/mingwX64Test/kotlin/MiraiFileImplTest.kt @@ -25,6 +25,7 @@ internal class WindowsMiraiFileImplTest : AbstractNativeMiraiFileImplTest() { super.parent() } + @Test override fun `canonical paths for non-canonical input`() { super.`canonical paths for non-canonical input`() diff --git a/mirai-core-utils/src/unixTest/kotlin/UnixMiraiFileImplTest.kt b/mirai-core-utils/src/unixTest/kotlin/UnixMiraiFileImplTest.kt index 05d17c5e0..41e0ed03e 100644 --- a/mirai-core-utils/src/unixTest/kotlin/UnixMiraiFileImplTest.kt +++ b/mirai-core-utils/src/unixTest/kotlin/UnixMiraiFileImplTest.kt @@ -28,6 +28,7 @@ internal class UnixMiraiFileImplTest : AbstractNativeMiraiFileImplTest() { super.parent() } + @Test override fun `canonical paths for non-canonical input`() { super.`canonical paths for non-canonical input`() diff --git a/mirai-core/src/commonMain/kotlin/message/data/FileMessageImpl.kt b/mirai-core/src/commonMain/kotlin/message/data/FileMessageImpl.kt index ee1ed9115..a42003324 100644 --- a/mirai-core/src/commonMain/kotlin/message/data/FileMessageImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/FileMessageImpl.kt @@ -35,6 +35,7 @@ internal fun FileMessage.checkIsImpl(): FileMessageImpl { } @Serializable +@Suppress("ANNOTATION_ARGUMENT_MUST_BE_CONST") // bug @SerialName(FileMessage.SERIAL_NAME) internal data class FileMessageImpl( override val id: String, diff --git a/mirai-core/src/commonTest/kotlin/message/data/MessageRefineTest.kt b/mirai-core/src/commonTest/kotlin/message/data/MessageRefineTest.kt index 8db22b2c4..72106cdc7 100644 --- a/mirai-core/src/commonTest/kotlin/message/data/MessageRefineTest.kt +++ b/mirai-core/src/commonTest/kotlin/message/data/MessageRefineTest.kt @@ -43,8 +43,6 @@ open class TM(private val name: String = Random.nextInt().toString()) : SingleMe if (this === other) return true if (!isSameType(this, other)) return false - other as TM - if (name != other.name) return false return true @@ -74,17 +72,6 @@ private fun testRefineLight( ) = assertEquals(after.toMessageChain(), before.toMessageChain().refineLight(bot)) -@Suppress("TestFunctionName") -private fun RefinableMessage( - refine: (bot: Bot, context: MessageChain) -> Message? -): RefinableMessage { - return object : RefinableMessage, TM() { - override fun tryRefine(bot: Bot, context: MessageChain, refineContext: RefineContext): Message? { - return refine(bot, context) - } - } -} - @Suppress("TestFunctionName") private fun RefinableMessage0( refine: () -> Message? diff --git a/mirai-core/src/jvmBaseMain/kotlin/contact/GroupImpl.kt b/mirai-core/src/jvmBaseMain/kotlin/contact/GroupImpl.kt index e8b70b389..f9207c87d 100644 --- a/mirai-core/src/jvmBaseMain/kotlin/contact/GroupImpl.kt +++ b/mirai-core/src/jvmBaseMain/kotlin/contact/GroupImpl.kt @@ -15,7 +15,6 @@ import net.mamoe.mirai.data.GroupInfo import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.utils.RemoteFileImpl import net.mamoe.mirai.utils.DeprecatedSinceMirai -import net.mamoe.mirai.utils.RemoteFile import kotlin.coroutines.CoroutineContext internal actual class GroupImpl actual constructor( @@ -30,5 +29,5 @@ internal actual class GroupImpl actual constructor( @Suppress("DEPRECATION") @Deprecated("Please use files instead.", replaceWith = ReplaceWith("files.root"), level = DeprecationLevel.WARNING) @DeprecatedSinceMirai(warningSince = "2.8") - override val filesRoot: RemoteFile by lazy { RemoteFileImpl(this, "/") } + override val filesRoot: net.mamoe.mirai.utils.RemoteFile by lazy { RemoteFileImpl(this, "/") } } \ No newline at end of file diff --git a/mirai-core/src/nativeTest/kotlin/testFramework/DebugProbes.kt b/mirai-core/src/nativeTest/kotlin/testFramework/DebugProbes.kt index 5bed4554c..bfbbc870f 100644 --- a/mirai-core/src/nativeTest/kotlin/testFramework/DebugProbes.kt +++ b/mirai-core/src/nativeTest/kotlin/testFramework/DebugProbes.kt @@ -12,15 +12,16 @@ package net.mamoe.mirai.internal.testFramework import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job +@Suppress("UNUSED_PARAMETER", "unused") internal actual object DebugProbes { /** - * Prints [job] hierarchy representation from [jobToString] to the given [out]. + * Prints hierarchy representation from [jobToString] to the given . */ // public fun printJob(job: Job, out: PrintStream = System.out): Unit /** - * Prints all coroutines launched within the given [scope]. + * Prints all coroutines launched within the given . * Throws [IllegalStateException] if the scope has no a job in it. */ // public fun printScope(scope: CoroutineScope, out: PrintStream = System.out): Unit @@ -113,7 +114,7 @@ internal actual object DebugProbes { } /** - * Prints [job] hierarchy representation from [jobToString] to the given [out]. + * Prints [job] hierarchy representation from [jobToString] to the given . */ actual fun printJob(job: Job) { }