@@ -209,6 +209,7 @@ internal abstract class SegmentQueueSynchronizer<T : Any> {
209
209
returnValue(value)
210
210
}
211
211
212
+ @Suppress(" INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION" )
212
213
internal fun suspendCancelled (): T ? {
213
214
// Increment `suspendIdx` and find the segment
214
215
// with the corresponding id. It is guaranteed
@@ -238,14 +239,15 @@ internal abstract class SegmentQueueSynchronizer<T : Any> {
238
239
if (value != = BROKEN && segment.cas(i, value, TAKEN )) {
239
240
// The elimination is performed successfully,
240
241
// complete with the value stored in the cell.
242
+ @Suppress(" UNCHECKED_CAST" )
241
243
return value as T
242
244
}
243
245
// The cell is broken, this can happen only in the `SYNC` resumption mode.
244
246
assert { resumeMode == SYNC && segment.get(i) == = BROKEN }
245
247
return null
246
248
}
247
249
248
- @Suppress(" UNCHECKED_CAST" )
250
+ @Suppress(" UNCHECKED_CAST" , " INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION " )
249
251
internal fun suspend (waiter : Waiter ): Boolean {
250
252
// Increment `suspendIdx` and find the segment
251
253
// with the corresponding id. It is guaranteed
@@ -335,7 +337,7 @@ internal abstract class SegmentQueueSynchronizer<T : Any> {
335
337
* moves [resumeIdx] to the first possibly non-cancelled cell, i.e.,
336
338
* to the first segment id multiplied by [SEGMENT_SIZE].
337
339
*/
338
- @Suppress(" UNCHECKED_CAST" )
340
+ @Suppress(" UNCHECKED_CAST" , " INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION " )
339
341
private fun tryResumeImpl (value : T , adjustResumeIdx : Boolean ): Int {
340
342
// Check that `adjustResumeIdx` is `false` in the simple cancellation mode.
341
343
assertNot { cancellationMode == SIMPLE && adjustResumeIdx }
@@ -561,12 +563,14 @@ internal abstract class SegmentQueueSynchronizer<T : Any> {
561
563
// provided by a concurrent `resume(..)`.
562
564
// The value could be put only in the asynchronous mode,
563
565
// so the `resume(..)` call above must not fail.
566
+ @Suppress(" UNCHECKED_CAST" )
564
567
resume(value as T )
565
568
} else {
566
569
// The `resume(..)` that will come to this cell should be refused.
567
570
// Mark the cell correspondingly and help a concurrent
568
571
// `resume(..)` to process its value if needed.
569
572
val value = markRefuse(index) ? : return
573
+ @Suppress(" UNCHECKED_CAST" )
570
574
returnRefusedValue(value as T )
571
575
}
572
576
}
0 commit comments