diff --git a/kotlinx-coroutines-core/common/src/internal/LockFreeLinkedList.common.kt b/kotlinx-coroutines-core/common/src/internal/LockFreeLinkedList.common.kt index 0e1d1b473a..8b20ade1f0 100644 --- a/kotlinx-coroutines-core/common/src/internal/LockFreeLinkedList.common.kt +++ b/kotlinx-coroutines-core/common/src/internal/LockFreeLinkedList.common.kt @@ -43,7 +43,7 @@ public expect open class LockFreeLinkedListNode() { public expect open class LockFreeLinkedListHead() : LockFreeLinkedListNode { public val isEmpty: Boolean public inline fun forEach(block: (T) -> Unit) - public final override fun remove(): Boolean // Actual return type is Nothing, KT-27534 + public final override fun remove(): Nothing } /** @suppress **This is unstable API and it is subject to change.** */ diff --git a/kotlinx-coroutines-core/common/test/flow/operators/DropTest.kt b/kotlinx-coroutines-core/common/test/flow/operators/DropTest.kt index 1c5a305352..dfa2827447 100644 --- a/kotlinx-coroutines-core/common/test/flow/operators/DropTest.kt +++ b/kotlinx-coroutines-core/common/test/flow/operators/DropTest.kt @@ -48,10 +48,9 @@ class DropTest : TestBase() { expectUnreached() } }.drop(1) - .map { + .map { expect(4) throw TestException() - 42 }.catch { emit(42) } expect(1) diff --git a/kotlinx-coroutines-core/common/test/flow/operators/FilterTest.kt b/kotlinx-coroutines-core/common/test/flow/operators/FilterTest.kt index 3de5d54a6d..f52416d823 100644 --- a/kotlinx-coroutines-core/common/test/flow/operators/FilterTest.kt +++ b/kotlinx-coroutines-core/common/test/flow/operators/FilterTest.kt @@ -38,7 +38,6 @@ class FilterTest : TestBase() { }.filter { latch.receive() throw TestException() - true }.catch { emit(42) } assertEquals(42, flow.single()) @@ -74,7 +73,6 @@ class FilterTest : TestBase() { }.filterNot { latch.receive() throw TestException() - true }.catch { emit(42) } assertEquals(42, flow.single()) diff --git a/kotlinx-coroutines-core/common/test/flow/operators/FlatMapMergeBaseTest.kt b/kotlinx-coroutines-core/common/test/flow/operators/FlatMapMergeBaseTest.kt index 4095172dab..f09db120a8 100644 --- a/kotlinx-coroutines-core/common/test/flow/operators/FlatMapMergeBaseTest.kt +++ b/kotlinx-coroutines-core/common/test/flow/operators/FlatMapMergeBaseTest.kt @@ -72,7 +72,7 @@ abstract class FlatMapMergeBaseTest : FlatMapBaseTest() { emit(2) expectUnreached() }.flatMap { - if (it == 1) flow { + if (it == 1) flow { expect(5) latch.send(Unit) hang { expect(7) } diff --git a/kotlinx-coroutines-core/common/test/flow/operators/FlowOnTest.kt b/kotlinx-coroutines-core/common/test/flow/operators/FlowOnTest.kt index 68653281cc..8fba8456e8 100644 --- a/kotlinx-coroutines-core/common/test/flow/operators/FlowOnTest.kt +++ b/kotlinx-coroutines-core/common/test/flow/operators/FlowOnTest.kt @@ -83,7 +83,7 @@ class FlowOnTest : TestBase() { }.map { expect(2) assertEquals("throwing", it) - throw TestException(); it + throw TestException() }.flowOn(NamedDispatchers("throwing")) assertFailsWith(flow) diff --git a/kotlinx-coroutines-core/common/test/flow/operators/MapNotNullTest.kt b/kotlinx-coroutines-core/common/test/flow/operators/MapNotNullTest.kt index 893811df15..d8bb480054 100644 --- a/kotlinx-coroutines-core/common/test/flow/operators/MapNotNullTest.kt +++ b/kotlinx-coroutines-core/common/test/flow/operators/MapNotNullTest.kt @@ -39,10 +39,9 @@ class MapNotNullTest : TestBase() { } emit(1) } - }.mapNotNull { + }.mapNotNull { latch.receive() throw TestException() - it + 1 }.catch { emit(42) } assertEquals(42, flow.single()) diff --git a/kotlinx-coroutines-core/common/test/flow/operators/SampleTest.kt b/kotlinx-coroutines-core/common/test/flow/operators/SampleTest.kt index 87bee56f1d..f7741fbd59 100644 --- a/kotlinx-coroutines-core/common/test/flow/operators/SampleTest.kt +++ b/kotlinx-coroutines-core/common/test/flow/operators/SampleTest.kt @@ -250,7 +250,6 @@ class SampleTest : TestBase() { expect(2) yield() throw TestException() - it } assertFailsWith(flow) diff --git a/kotlinx-coroutines-core/common/test/flow/operators/TakeTest.kt b/kotlinx-coroutines-core/common/test/flow/operators/TakeTest.kt index 62d2322c04..ea8939fed2 100644 --- a/kotlinx-coroutines-core/common/test/flow/operators/TakeTest.kt +++ b/kotlinx-coroutines-core/common/test/flow/operators/TakeTest.kt @@ -88,9 +88,8 @@ class TakeTest : TestBase() { emit(1) } }.take(2) - .map { + .map { throw TestException() - 42 }.catch { emit(42) } assertEquals(42, flow.single()) diff --git a/kotlinx-coroutines-core/js/src/internal/LinkedList.kt b/kotlinx-coroutines-core/js/src/internal/LinkedList.kt index 147b31dc3e..d8c07f4e19 100644 --- a/kotlinx-coroutines-core/js/src/internal/LinkedList.kt +++ b/kotlinx-coroutines-core/js/src/internal/LinkedList.kt @@ -177,5 +177,5 @@ public open class LinkedListHead : LinkedListNode() { } // just a defensive programming -- makes sure that list head sentinel is never removed - public final override fun remove(): Boolean = throw UnsupportedOperationException() + public final override fun remove(): Nothing = throw UnsupportedOperationException() } diff --git a/kotlinx-coroutines-core/jvm/src/internal/LockFreeLinkedList.kt b/kotlinx-coroutines-core/jvm/src/internal/LockFreeLinkedList.kt index 9bbc6dc9eb..8b4517cb22 100644 --- a/kotlinx-coroutines-core/jvm/src/internal/LockFreeLinkedList.kt +++ b/kotlinx-coroutines-core/jvm/src/internal/LockFreeLinkedList.kt @@ -646,7 +646,7 @@ public actual open class LockFreeLinkedListHead : LockFreeLinkedListNode() { } // just a defensive programming -- makes sure that list head sentinel is never removed - public actual final override fun remove(): Boolean = error("head cannot be removed") + public actual final override fun remove(): Nothing = error("head cannot be removed") // optimization: because head is never removed, we don't have to read _next.value to check these: override val isRemoved: Boolean get() = false diff --git a/kotlinx-coroutines-core/native/src/internal/LinkedList.kt b/kotlinx-coroutines-core/native/src/internal/LinkedList.kt index a8aed04461..a161bc5bab 100644 --- a/kotlinx-coroutines-core/native/src/internal/LinkedList.kt +++ b/kotlinx-coroutines-core/native/src/internal/LinkedList.kt @@ -166,5 +166,5 @@ public open class LinkedListHead : LinkedListNode() { } // just a defensive programming -- makes sure that list head sentinel is never removed - public final override fun remove(): Boolean = throw UnsupportedOperationException() + public final override fun remove(): Nothing = throw UnsupportedOperationException() } diff --git a/kotlinx-coroutines-core/native/test/TestBase.kt b/kotlinx-coroutines-core/native/test/TestBase.kt index 4ffa6c0b11..1b12cefefe 100644 --- a/kotlinx-coroutines-core/native/test/TestBase.kt +++ b/kotlinx-coroutines-core/native/test/TestBase.kt @@ -78,7 +78,7 @@ public actual open class TestBase actual constructor() { var exCount = 0 var ex: Throwable? = null try { - runBlocking(block = block, context = CoroutineExceptionHandler { context, e -> + runBlocking(block = block, context = CoroutineExceptionHandler { _, e -> if (e is CancellationException) return@CoroutineExceptionHandler // are ignored exCount++ when {