Skip to content

Commit 14f2f38

Browse files
committed
Add a migration for compose operator
1 parent db52e97 commit 14f2f38

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

0 commit comments

Comments
 (0)