Skip to content

Commit fda1e56

Browse files
committed
Add a migration for compose operator
1 parent e2a5671 commit fda1e56

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
@@ -193,3 +193,24 @@ public fun <T> Flow<Flow<T>>.merge(): Flow<T> = error("Should not be called")
193193
replaceWith = ReplaceWith("flattenConcat()")
194194
)
195195
public fun <T> Flow<Flow<T>>.flatten(): Flow<T> = error("Should not be called")
196+
197+
/**
198+
* Kotlin has a built-in generic mechanism for making chained calls.
199+
* If you wish to write something like
200+
* ```
201+
* myFlow.compose(MyFlowExtensions.ignoreErrors()).collect { ... }
202+
* ```
203+
* you can replace it with
204+
*
205+
* ```
206+
* myFlow.let(MyFlowExtensions.ignoreErrors()).collect { ... }
207+
* ```
208+
*
209+
* @suppress
210+
*/
211+
@Deprecated(
212+
level = DeprecationLevel.ERROR,
213+
message = "Kotlin analogue of compose is 'let'",
214+
replaceWith = ReplaceWith("let(transformer)")
215+
)
216+
public fun <T, R> Flow<T>.compose(transformer: Flow<T>.() -> Flow<R>): Flow<R> = error("Should not be called")

0 commit comments

Comments
 (0)