Skip to content

Get rid of ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS to reduce the tensi… #3869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kotlinx-coroutines-core/common/test/AsyncTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package kotlinx.coroutines

import kotlin.test.*

@Suppress("DEPRECATION") // cancel(cause)
class AsyncTest : TestBase() {

@Test
Expand Down
4 changes: 1 addition & 3 deletions kotlinx-coroutines-core/js/test/TestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public actual typealias TestResult = Promise<Unit>

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
Expand All @@ -27,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 {
if (cause != null) console.log(cause)
val exception = IllegalStateException(
if (cause == null) message.toString() else "$message; caused by $cause")
Expand Down
7 changes: 2 additions & 5 deletions kotlinx-coroutines-core/jvm/test/TestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -81,13 +79,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)
}

Expand Down
4 changes: 1 addition & 3 deletions kotlinx-coroutines-core/native/test/TestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -26,8 +25,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
Expand Down