Skip to content

Commit 3f459d5

Browse files
authored
Remove workarounds for obsolete compiler bugs (#2829)
1 parent 61acb95 commit 3f459d5

File tree

12 files changed

+10
-16
lines changed

12 files changed

+10
-16
lines changed

kotlinx-coroutines-core/common/src/internal/LockFreeLinkedList.common.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public expect open class LockFreeLinkedListNode() {
4343
public expect open class LockFreeLinkedListHead() : LockFreeLinkedListNode {
4444
public val isEmpty: Boolean
4545
public inline fun <reified T : LockFreeLinkedListNode> forEach(block: (T) -> Unit)
46-
public final override fun remove(): Boolean // Actual return type is Nothing, KT-27534
46+
public final override fun remove(): Nothing
4747
}
4848

4949
/** @suppress **This is unstable API and it is subject to change.** */

kotlinx-coroutines-core/common/test/flow/operators/DropTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ class DropTest : TestBase() {
4848
expectUnreached()
4949
}
5050
}.drop(1)
51-
.map {
51+
.map<Int, Int> {
5252
expect(4)
5353
throw TestException()
54-
42
5554
}.catch { emit(42) }
5655

5756
expect(1)

kotlinx-coroutines-core/common/test/flow/operators/FilterTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class FilterTest : TestBase() {
3838
}.filter {
3939
latch.receive()
4040
throw TestException()
41-
true
4241
}.catch { emit(42) }
4342

4443
assertEquals(42, flow.single())
@@ -74,7 +73,6 @@ class FilterTest : TestBase() {
7473
}.filterNot {
7574
latch.receive()
7675
throw TestException()
77-
true
7876
}.catch { emit(42) }
7977

8078
assertEquals(42, flow.single())

kotlinx-coroutines-core/common/test/flow/operators/FlatMapMergeBaseTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ abstract class FlatMapMergeBaseTest : FlatMapBaseTest() {
7272
emit(2)
7373
expectUnreached()
7474
}.flatMap {
75-
if (it == 1) flow<Int> {
75+
if (it == 1) flow {
7676
expect(5)
7777
latch.send(Unit)
7878
hang { expect(7) }

kotlinx-coroutines-core/common/test/flow/operators/FlowOnTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class FlowOnTest : TestBase() {
8383
}.map {
8484
expect(2)
8585
assertEquals("throwing", it)
86-
throw TestException(); it
86+
throw TestException()
8787
}.flowOn(NamedDispatchers("throwing"))
8888

8989
assertFailsWith<TestException>(flow)

kotlinx-coroutines-core/common/test/flow/operators/MapNotNullTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ class MapNotNullTest : TestBase() {
3939
}
4040
emit(1)
4141
}
42-
}.mapNotNull {
42+
}.mapNotNull<Int, Int> {
4343
latch.receive()
4444
throw TestException()
45-
it + 1
4645
}.catch { emit(42) }
4746

4847
assertEquals(42, flow.single())

kotlinx-coroutines-core/common/test/flow/operators/SampleTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ class SampleTest : TestBase() {
250250
expect(2)
251251
yield()
252252
throw TestException()
253-
it
254253
}
255254

256255
assertFailsWith<TestException>(flow)

kotlinx-coroutines-core/common/test/flow/operators/TakeTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ class TakeTest : TestBase() {
8888
emit(1)
8989
}
9090
}.take(2)
91-
.map {
91+
.map<Int, Int> {
9292
throw TestException()
93-
42
9493
}.catch { emit(42) }
9594

9695
assertEquals(42, flow.single())

kotlinx-coroutines-core/js/src/internal/LinkedList.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,5 @@ public open class LinkedListHead : LinkedListNode() {
177177
}
178178

179179
// just a defensive programming -- makes sure that list head sentinel is never removed
180-
public final override fun remove(): Boolean = throw UnsupportedOperationException()
180+
public final override fun remove(): Nothing = throw UnsupportedOperationException()
181181
}

kotlinx-coroutines-core/jvm/src/internal/LockFreeLinkedList.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ public actual open class LockFreeLinkedListHead : LockFreeLinkedListNode() {
646646
}
647647

648648
// just a defensive programming -- makes sure that list head sentinel is never removed
649-
public actual final override fun remove(): Boolean = error("head cannot be removed")
649+
public actual final override fun remove(): Nothing = error("head cannot be removed")
650650

651651
// optimization: because head is never removed, we don't have to read _next.value to check these:
652652
override val isRemoved: Boolean get() = false

0 commit comments

Comments
 (0)