Skip to content

Commit df155b2

Browse files
qwwdfsaddkhalanskyjb
authored andcommitted
Work around for KT-63278 by renaming asHandler to asHandler1
1 parent 64a1248 commit df155b2

File tree

8 files changed

+12
-21
lines changed

8 files changed

+12
-21
lines changed

kotlinx-coroutines-core/common/src/Await.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private class AwaitAll<T>(private val deferreds: Array<out Deferred<T>>) {
7575
val deferred = deferreds[i]
7676
deferred.start() // To properly await lazily started deferreds
7777
AwaitAllNode(cont).apply {
78-
handle = deferred.invokeOnCompletion(asHandler)
78+
handle = deferred.invokeOnCompletion(asHandler1)
7979
}
8080
}
8181
val disposer = DisposeHandlersOnCancel(nodes)

kotlinx-coroutines-core/common/src/CancellableContinuationImpl.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ internal open class CancellableContinuationImpl<in T>(
347347
// Install the handle
348348
val handle = parent.invokeOnCompletion(
349349
onCancelling = true,
350-
handler = ChildContinuation(this).asHandler
350+
handler = ChildContinuation(this).asHandler1
351351
)
352352
_parentHandle.compareAndSet(null, handle)
353353
return handle

kotlinx-coroutines-core/common/src/CompletionHandler.common.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal expect abstract class CompletionHandlerBase() : LockFreeLinkedListNode
3131
abstract fun invoke(cause: Throwable?)
3232
}
3333

34-
internal expect val CompletionHandlerBase.asHandler: CompletionHandler
34+
internal expect val CompletionHandlerBase.asHandler1: CompletionHandler
3535

3636
// More compact version of CompletionHandlerBase for CancellableContinuation with same workaround for JS
3737
internal expect abstract class CancelHandlerBase() {

kotlinx-coroutines-core/common/src/Job.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ public interface ChildHandle : DisposableHandle {
491491
* ```
492492
*/
493493
internal fun Job.disposeOnCompletion(handle: DisposableHandle): DisposableHandle =
494-
invokeOnCompletion(handler = DisposeOnCompletion(handle).asHandler)
494+
invokeOnCompletion(handler = DisposeOnCompletion(handle).asHandler1)
495495

496496
/**
497497
* Cancels the job and suspends the invoking coroutine until the cancelled job is complete.

kotlinx-coroutines-core/common/src/JobSupport.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
558558

559559
private suspend fun joinSuspend() = suspendCancellableCoroutine<Unit> { cont ->
560560
// We have to invoke join() handler only on cancellation, on completion we will be resumed regularly without handlers
561-
cont.disposeOnCancellation(invokeOnCompletion(handler = ResumeOnCompletion(cont).asHandler))
561+
cont.disposeOnCancellation(invokeOnCompletion(handler = ResumeOnCompletion(cont).asHandler1))
562562
}
563563

564564
@Suppress("UNCHECKED_CAST")
@@ -574,7 +574,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
574574
select.selectInRegistrationPhase(Unit)
575575
return
576576
}
577-
val disposableHandle = invokeOnCompletion(SelectOnJoinCompletionHandler(select).asHandler)
577+
val disposableHandle = invokeOnCompletion(SelectOnJoinCompletionHandler(select).asHandler1)
578578
select.disposeOnCompletion(disposableHandle)
579579
}
580580

@@ -921,7 +921,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
921921
private tailrec fun tryWaitForChild(state: Finishing, child: ChildHandleNode, proposedUpdate: Any?): Boolean {
922922
val handle = child.childJob.invokeOnCompletion(
923923
invokeImmediately = false,
924-
handler = ChildCompletion(this, state, child, proposedUpdate).asHandler
924+
handler = ChildCompletion(this, state, child, proposedUpdate).asHandler1
925925
)
926926
if (handle !== NonDisposableHandle) return true // child is not complete and we've started waiting for it
927927
val nextChild = child.nextChild() ?: return false
@@ -971,7 +971,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
971971
* If child is attached when the job is already being cancelled, such child will receive immediate notification on
972972
* cancellation, but parent *will* wait for that child before completion and will handle its exception.
973973
*/
974-
return invokeOnCompletion(onCancelling = true, handler = ChildHandleNode(child).asHandler) as ChildHandle
974+
return invokeOnCompletion(onCancelling = true, handler = ChildHandleNode(child).asHandler1) as ChildHandle
975975
}
976976

977977
/**
@@ -1234,7 +1234,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
12341234
val cont = AwaitContinuation(uCont.intercepted(), this)
12351235
// we are mimicking suspendCancellableCoroutine here and call initCancellability, too.
12361236
cont.initCancellability()
1237-
cont.disposeOnCancellation(invokeOnCompletion(ResumeAwaitOnCompletion(cont).asHandler))
1237+
cont.disposeOnCancellation(invokeOnCompletion(ResumeAwaitOnCompletion(cont).asHandler1))
12381238
cont.getResult()
12391239
}
12401240

@@ -1256,7 +1256,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
12561256
}
12571257
if (startInternal(state) >= 0) break // break unless needs to retry
12581258
}
1259-
val disposableHandle = invokeOnCompletion(SelectOnAwaitCompletionHandler(select).asHandler)
1259+
val disposableHandle = invokeOnCompletion(SelectOnAwaitCompletionHandler(select).asHandler1)
12601260
select.disposeOnCompletion(disposableHandle)
12611261
}
12621262

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

-9
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,4 @@ class CombineParametersTest : TestBase() {
181181
val result = flow.combine(flow) { a, b -> a + b }.toList()
182182
assertEquals(List(1024) { it * 2 } , result)
183183
}
184-
185-
@Test
186-
fun testArrayType() = runTest {
187-
val arr = flowOf(1)
188-
combine(listOf(arr, arr)) {
189-
println(it[0])
190-
it[0]
191-
}.toList().also { println(it) }
192-
}
193184
}

kotlinx-coroutines-core/concurrent/src/CompletionHandler.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal actual abstract class CompletionHandlerBase actual constructor() : Lock
1010
actual abstract override fun invoke(cause: Throwable?)
1111
}
1212

13-
internal actual inline val CompletionHandlerBase.asHandler: CompletionHandler get() = this
13+
internal actual inline val CompletionHandlerBase.asHandler1: CompletionHandler get() = this
1414

1515
internal actual abstract class CancelHandlerBase actual constructor() : CompletionHandler {
1616
actual abstract override fun invoke(cause: Throwable?)

kotlinx-coroutines-core/js/src/CompletionHandler.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal actual abstract class CompletionHandlerBase : LinkedListNode() {
1212
}
1313

1414
@Suppress("UnsafeCastFromDynamic")
15-
internal actual inline val CompletionHandlerBase.asHandler: CompletionHandler get() = asDynamic()
15+
internal actual inline val CompletionHandlerBase.asHandler1: CompletionHandler get() = asDynamic()
1616

1717
internal actual abstract class CancelHandlerBase {
1818
@JsName("invoke")

0 commit comments

Comments
 (0)