11@file:JvmMultifileClass
22@file:JvmName(" BuildersKt" )
33@file:OptIn(ExperimentalContracts ::class )
4+ @file:Suppress(" LEAKED_IN_PLACE_LAMBDA" , " WRONG_INVOCATION_KIND" )
45
56package kotlinx.coroutines
67
@@ -153,7 +154,6 @@ public suspend fun <T> withContext(
153154 // FAST PATH #1 -- new context is the same as the old one
154155 if (newContext == = oldContext) {
155156 val coroutine = ScopeCoroutine (newContext, uCont)
156- @Suppress(" LEAKED_IN_PLACE_LAMBDA" ) // Contract is preserved, invoked immediately or throws
157157 return @sc coroutine.startUndispatchedOrReturn(coroutine, block)
158158 }
159159 // FAST PATH #2 -- the new dispatcher is the same as the old one (something else changed)
@@ -162,13 +162,11 @@ public suspend fun <T> withContext(
162162 val coroutine = UndispatchedCoroutine (newContext, uCont)
163163 // There are changes in the context, so this thread needs to be updated
164164 withCoroutineContext(coroutine.context, null ) {
165- @Suppress(" LEAKED_IN_PLACE_LAMBDA" ) // Contract is preserved, invoked immediately or throws
166165 return @sc coroutine.startUndispatchedOrReturn(coroutine, block)
167166 }
168167 }
169168 // SLOW PATH -- use new dispatcher
170169 val coroutine = DispatchedCoroutine (newContext, uCont)
171- @Suppress(" LEAKED_IN_PLACE_LAMBDA" ) // Contract is preserved, invoked immediately or throws
172170 block.startCoroutineCancellable(coroutine, coroutine)
173171 coroutine.getResult()
174172 }
0 commit comments