From a66c358cdbf6586e083cc03684e95a054430810a Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Wed, 30 Aug 2023 13:57:30 +0200 Subject: [PATCH 1/2] Get rid of ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS to reduce the tension between develop and K2 branches --- kotlinx-coroutines-core/common/test/AsyncTest.kt | 1 - kotlinx-coroutines-core/js/test/TestBase.kt | 3 +-- kotlinx-coroutines-core/jvm/test/TestBase.kt | 5 ++--- kotlinx-coroutines-core/native/test/TestBase.kt | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/kotlinx-coroutines-core/common/test/AsyncTest.kt b/kotlinx-coroutines-core/common/test/AsyncTest.kt index 2096a4d69e..3fff252318 100644 --- a/kotlinx-coroutines-core/common/test/AsyncTest.kt +++ b/kotlinx-coroutines-core/common/test/AsyncTest.kt @@ -8,7 +8,6 @@ package kotlinx.coroutines import kotlin.test.* -@Suppress("DEPRECATION") // cancel(cause) class AsyncTest : TestBase() { @Test diff --git a/kotlinx-coroutines-core/js/test/TestBase.kt b/kotlinx-coroutines-core/js/test/TestBase.kt index 6979b677c8..f851e8bf14 100644 --- a/kotlinx-coroutines-core/js/test/TestBase.kt +++ b/kotlinx-coroutines-core/js/test/TestBase.kt @@ -27,8 +27,7 @@ public actual open class TestBase actual constructor() { * Throws [IllegalStateException] like `error` in stdlib, but also ensures that the test will not * complete successfully even if this exception is consumed somewhere in the test. */ - @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") - public actual fun error(message: Any, cause: Throwable? = null): Nothing { + public actual fun error(message: Any, cause: Throwable?): Nothing { if (cause != null) console.log(cause) val exception = IllegalStateException( if (cause == null) message.toString() else "$message; caused by $cause") diff --git a/kotlinx-coroutines-core/jvm/test/TestBase.kt b/kotlinx-coroutines-core/jvm/test/TestBase.kt index 3098138663..be2a900f00 100644 --- a/kotlinx-coroutines-core/jvm/test/TestBase.kt +++ b/kotlinx-coroutines-core/jvm/test/TestBase.kt @@ -81,13 +81,12 @@ public actual open class TestBase(private var disableOutCheck: Boolean) { */ private lateinit var previousOut: PrintStream - /** + /** * Throws [IllegalStateException] like `error` in stdlib, but also ensures that the test will not * complete successfully even if this exception is consumed somewhere in the test. */ // fixme replace the suppress with AllowDifferentMembersInActual once stdlib is updated to 1.9.20 https://github.com/Kotlin/kotlinx.coroutines/issues/3846 - @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") - public actual fun error(message: Any, cause: Throwable? = null): Nothing { + public actual fun error(message: Any, cause: Throwable?): Nothing { throw makeError(message, cause) } diff --git a/kotlinx-coroutines-core/native/test/TestBase.kt b/kotlinx-coroutines-core/native/test/TestBase.kt index 1fe5625622..4d17dc330e 100644 --- a/kotlinx-coroutines-core/native/test/TestBase.kt +++ b/kotlinx-coroutines-core/native/test/TestBase.kt @@ -26,8 +26,7 @@ public actual open class TestBase actual constructor() { * Throws [IllegalStateException] like `error` in stdlib, but also ensures that the test will not * complete successfully even if this exception is consumed somewhere in the test. */ - @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") - public actual fun error(message: Any, cause: Throwable? = null): Nothing { + public actual fun error(message: Any, cause: Throwable?): Nothing { val exception = IllegalStateException(message.toString(), cause) if (error == null) error = exception throw exception From bc6e63f867277c3818257f2a797efb74db31be06 Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Thu, 31 Aug 2023 17:35:18 +0200 Subject: [PATCH 2/2] Remove obsolete workaround --- kotlinx-coroutines-core/js/test/TestBase.kt | 1 - kotlinx-coroutines-core/jvm/test/TestBase.kt | 2 -- kotlinx-coroutines-core/native/test/TestBase.kt | 1 - 3 files changed, 4 deletions(-) diff --git a/kotlinx-coroutines-core/js/test/TestBase.kt b/kotlinx-coroutines-core/js/test/TestBase.kt index f851e8bf14..d50d93da9e 100644 --- a/kotlinx-coroutines-core/js/test/TestBase.kt +++ b/kotlinx-coroutines-core/js/test/TestBase.kt @@ -15,7 +15,6 @@ public actual typealias TestResult = Promise public actual val isNative = false -@Suppress("NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS") // Counterpart for @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") public actual open class TestBase actual constructor() { public actual val isBoundByJsTestTimeout = true private var actionIndex = 0 diff --git a/kotlinx-coroutines-core/jvm/test/TestBase.kt b/kotlinx-coroutines-core/jvm/test/TestBase.kt index be2a900f00..af1e2ac1ab 100644 --- a/kotlinx-coroutines-core/jvm/test/TestBase.kt +++ b/kotlinx-coroutines-core/jvm/test/TestBase.kt @@ -55,8 +55,6 @@ public actual typealias TestResult = Unit * ``` */ @Suppress( - // Counterpart for @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") - "NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS", // fixme replace the suppress with AllowDifferentMembersInActual once stdlib is updated to 1.9.20 https://github.com/Kotlin/kotlinx.coroutines/issues/3846 "ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER" ) diff --git a/kotlinx-coroutines-core/native/test/TestBase.kt b/kotlinx-coroutines-core/native/test/TestBase.kt index 4d17dc330e..173bcc30ae 100644 --- a/kotlinx-coroutines-core/native/test/TestBase.kt +++ b/kotlinx-coroutines-core/native/test/TestBase.kt @@ -15,7 +15,6 @@ public actual val isNative = true @Suppress("ACTUAL_WITHOUT_EXPECT") public actual typealias TestResult = Unit -@Suppress("NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS") // Counterpart for @Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS") public actual open class TestBase actual constructor() { public actual val isBoundByJsTestTimeout = false private var actionIndex = atomic(0)