Skip to content

Commit b94a828

Browse files
committed
Small code refactoring
1 parent 7c1391a commit b94a828

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ internal abstract class AbstractChannel<E>(
494494
// Too late, already cancelled, but we removed it from the queue and need to notify on undelivered element.
495495
// The only exception is when this "send" operation is an `onSend` clause that has to be re-registered
496496
// in the corresponding `select` invocation.
497-
if (send !is SendElementSelectWithUndeliveredHandler<*> || send.trySelectResult != REREGISTER)
497+
if (!(send is SendElementSelectWithUndeliveredHandler<*> && send.trySelectResult == REREGISTER))
498498
send.undeliveredElement()
499499
}
500500
}

kotlinx-coroutines-core/common/src/channels/ArrayChannel.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ internal open class ArrayChannel<E>(
158158
// Too late, already cancelled, but we removed it from the queue and need to notify on undelivered element.
159159
// The only exception is when this "send" operation is an `onSend` clause that has to be re-registered
160160
// in the corresponding `select` invocation.
161-
val send = send
162-
if (send !is SendElementSelectWithUndeliveredHandler<*> || send.trySelectResult != REREGISTER)
163-
send!!.undeliveredElement()
161+
val send = send!!
162+
if (!(send is SendElementSelectWithUndeliveredHandler<*> && send.trySelectResult == REREGISTER))
163+
send.undeliveredElement()
164164
}
165165
}
166166
if (replacement !== POLL_FAILED && replacement !is Closed<*>) {

0 commit comments

Comments
 (0)