Skip to content

Commit

Permalink
More precise SharedFlow lint message (Kotlin#2830)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad committed Jul 20, 2021
1 parent a3429f7 commit 3694ac9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kotlinx-coroutines-core/common/src/flow/operators/Lint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public val FlowCollector<*>.coroutineContext: CoroutineContext
get() = noImpl()

@Deprecated(
message = "SharedFlow never completes, so this operator has no effect.",
message = "SharedFlow never completes, so this operator typically has not effect, it can only " +
"catch exceptions from 'onSubscribe' operator",
level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("this")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ class SharedFlowTest : TestBase() {
}

@Test
@Suppress("DEPRECATION") // 'catch'
fun onSubscriptionThrows() = runTest {
expect(1)
val sh = MutableSharedFlow<String>(1)
Expand Down

0 comments on commit 3694ac9

Please sign in to comment.