Skip to content

Commit 62bf21c

Browse files
authored
Remove outdated kludges (#4466)
The issue that required those has been fixed in the compiler since Kotlin 1.3.60, and we're at Kotlin 2.2.0 nowadays. https://youtrack.jetbrains.com/issue/KT-28938
1 parent 1407535 commit 62bf21c

File tree

1 file changed

+2
-4
lines changed
  • kotlinx-coroutines-core/common/src/flow/operators

1 file changed

+2
-4
lines changed

kotlinx-coroutines-core/common/src/flow/operators/Emitters.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public inline fun <T, R> Flow<T>.transform(
3434
@BuilderInference crossinline transform: suspend FlowCollector<R>.(value: T) -> Unit
3535
): Flow<R> = flow { // Note: safe flow is used here, because collector is exposed to transform on each operation
3636
collect { value ->
37-
// kludge, without it Unit will be returned and TCE won't kick in, KT-28938
38-
return@collect transform(value)
37+
transform(value)
3938
}
4039
}
4140

@@ -45,8 +44,7 @@ internal inline fun <T, R> Flow<T>.unsafeTransform(
4544
@BuilderInference crossinline transform: suspend FlowCollector<R>.(value: T) -> Unit
4645
): Flow<R> = unsafeFlow { // Note: unsafe flow is used here, because unsafeTransform is only for internal use
4746
collect { value ->
48-
// kludge, without it Unit will be returned and TCE won't kick in, KT-28938
49-
return@collect transform(value)
47+
transform(value)
5048
}
5149
}
5250

0 commit comments

Comments
 (0)