Skip to content

Commit 01dcafd

Browse files
committed
Fix nullability
1 parent d20620d commit 01dcafd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: kotlinx-coroutines-core/common/src/internal/ThreadContext.common.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ private class ThreadState(@JvmField val context: CoroutineContext, n: Int) {
2727
}
2828

2929
// Counts ThreadContextElements in the context
30-
// Any? here is Int | ThreadContextElement (when count is one)
30+
// Any here is Int | ThreadContextElement (when count is one)
3131
private val countAll =
32-
fun (countOrElement: Any?, element: CoroutineContext.Element): Any? {
32+
fun (countOrElement: Any, element: CoroutineContext.Element): Any {
3333
if (element is ThreadContextElement<*>) {
3434
val inCount = countOrElement as? Int ?: 1
3535
return if (inCount == 0) element else inCount + 1
@@ -91,4 +91,4 @@ internal fun restoreThreadContext(context: CoroutineContext, oldState: Any?) {
9191
}
9292
}
9393

94-
internal fun threadContextElements(context: CoroutineContext): Any = context.fold(0, countAll)!!
94+
internal fun threadContextElements(context: CoroutineContext): Any = context.fold(0, countAll)

0 commit comments

Comments
 (0)