Skip to content

Commit 1c16c72

Browse files
committed
Add a migration for compose operator
1 parent b08d61c commit 1c16c72

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

kotlinx-coroutines-core/common/src/flow/Migration.kt

+21
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,24 @@ public fun <T> Flow<Flow<T>>.merge(): Flow<T> = error("Should not be called")
209209
replaceWith = ReplaceWith("flattenConcat()")
210210
)
211211
public fun <T> Flow<Flow<T>>.flatten(): Flow<T> = error("Should not be called")
212+
213+
/**
214+
* Kotlin has a built-in generic mechanism for making chained calls.
215+
* If you wish to write something like
216+
* ```
217+
* myFlow.compose(MyFlowExtensions.ignoreErrors()).collect { ... }
218+
* ```
219+
* you can replace it with
220+
*
221+
* ```
222+
* myFlow.let(MyFlowExtensions.ignoreErrors()).collect { ... }
223+
* ```
224+
*
225+
* @suppress
226+
*/
227+
@Deprecated(
228+
level = DeprecationLevel.ERROR,
229+
message = "Kotlin analogue of compose is 'let'",
230+
replaceWith = ReplaceWith("let(transformer)")
231+
)
232+
public fun <T, R> Flow<T>.compose(transformer: Flow<T>.() -> Flow<R>): Flow<R> = error("Should not be called")

0 commit comments

Comments
 (0)