Skip to content

Commit

Permalink
Update Migration.kt (#4105)
Browse files Browse the repository at this point in the history
Replacing "SharingStared" with correct "SharingStarted".  
Fixing wrong order of parameters in replaceWith of cache() method.
  • Loading branch information
mikegr committed May 1, 2024
1 parent 87244f9 commit 4c24659
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions kotlinx-coroutines-core/common/src/flow/Migration.kt
Expand Up @@ -443,8 +443,8 @@ public fun <T> Flow<T>.scanReduce(operation: suspend (accumulator: T, value: T)
level = DeprecationLevel.ERROR,
message = "Flow analogue of 'publish()' is 'shareIn'. \n" +
"publish().connect() is the default strategy (no extra call is needed), \n" +
"publish().autoConnect() translates to 'started = SharingStared.Lazily' argument, \n" +
"publish().refCount() translates to 'started = SharingStared.WhileSubscribed()' argument.",
"publish().autoConnect() translates to 'started = SharingStarted.Lazily' argument, \n" +
"publish().refCount() translates to 'started = SharingStarted.WhileSubscribed()' argument.",
replaceWith = ReplaceWith("this.shareIn(scope, 0)")
)
public fun <T> Flow<T>.publish(): Flow<T> = noImpl()
Expand All @@ -454,8 +454,8 @@ public fun <T> Flow<T>.publish(): Flow<T> = noImpl()
level = DeprecationLevel.ERROR,
message = "Flow analogue of 'publish(bufferSize)' is 'buffer' followed by 'shareIn'. \n" +
"publish().connect() is the default strategy (no extra call is needed), \n" +
"publish().autoConnect() translates to 'started = SharingStared.Lazily' argument, \n" +
"publish().refCount() translates to 'started = SharingStared.WhileSubscribed()' argument.",
"publish().autoConnect() translates to 'started = SharingStarted.Lazily' argument, \n" +
"publish().refCount() translates to 'started = SharingStarted.WhileSubscribed()' argument.",
replaceWith = ReplaceWith("this.buffer(bufferSize).shareIn(scope, 0)")
)
public fun <T> Flow<T>.publish(bufferSize: Int): Flow<T> = noImpl()
Expand All @@ -465,8 +465,8 @@ public fun <T> Flow<T>.publish(bufferSize: Int): Flow<T> = noImpl()
level = DeprecationLevel.ERROR,
message = "Flow analogue of 'replay()' is 'shareIn' with unlimited replay. \n" +
"replay().connect() is the default strategy (no extra call is needed), \n" +
"replay().autoConnect() translates to 'started = SharingStared.Lazily' argument, \n" +
"replay().refCount() translates to 'started = SharingStared.WhileSubscribed()' argument.",
"replay().autoConnect() translates to 'started = SharingStarted.Lazily' argument, \n" +
"replay().refCount() translates to 'started = SharingStarted.WhileSubscribed()' argument.",
replaceWith = ReplaceWith("this.shareIn(scope, Int.MAX_VALUE)")
)
public fun <T> Flow<T>.replay(): Flow<T> = noImpl()
Expand All @@ -476,16 +476,16 @@ public fun <T> Flow<T>.replay(): Flow<T> = noImpl()
level = DeprecationLevel.ERROR,
message = "Flow analogue of 'replay(bufferSize)' is 'shareIn' with the specified replay parameter. \n" +
"replay().connect() is the default strategy (no extra call is needed), \n" +
"replay().autoConnect() translates to 'started = SharingStared.Lazily' argument, \n" +
"replay().refCount() translates to 'started = SharingStared.WhileSubscribed()' argument.",
"replay().autoConnect() translates to 'started = SharingStarted.Lazily' argument, \n" +
"replay().refCount() translates to 'started = SharingStarted.WhileSubscribed()' argument.",
replaceWith = ReplaceWith("this.shareIn(scope, bufferSize)")
)
public fun <T> Flow<T>.replay(bufferSize: Int): Flow<T> = noImpl()

/** @suppress */
@Deprecated(
level = DeprecationLevel.ERROR,
message = "Flow analogue of 'cache()' is 'shareIn' with unlimited replay and 'started = SharingStared.Lazily' argument'",
replaceWith = ReplaceWith("this.shareIn(scope, Int.MAX_VALUE, started = SharingStared.Lazily)")
message = "Flow analogue of 'cache()' is 'shareIn' with unlimited replay and 'started = SharingStarted.Lazily' argument'",
replaceWith = ReplaceWith("this.shareIn(scope, started = SharingStarted.Lazily, replay = Int.MAX_VALUE)")
)
public fun <T> Flow<T>.cache(): Flow<T> = noImpl()

0 comments on commit 4c24659

Please sign in to comment.