Skip to content

Commit

Permalink
~ Move useless operator extension to LintKt and make them errors
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed May 7, 2020
1 parent dcfe836 commit 1e81e6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion kotlinx-coroutines-core/common/src/flow/Migration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import kotlin.jvm.*
* Deprecated functions also are moved here when they renamed. The difference is that they have
* a body with their implementation while pure stubs have [noImpl].
*/
private fun noImpl(): Nothing =
internal fun noImpl(): Nothing =
throw UnsupportedOperationException("Not implemented, should not be called")

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,42 @@
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

@file:JvmMultifileClass
@file:JvmName("FlowKt")

package kotlinx.coroutines.flow

import kotlin.coroutines.*
import kotlin.jvm.*

/**
* Returns this.
* Applying [flowOn][Flow.flowOn] operator to [StateFlow] has no effect.
* See [StateFlow] documentation on Operator Fusion.
*/
@Deprecated(
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
message = "Applying flowOn operator to StateFlow has no effect. See StateFlow documentation on Operator Fusion.",
replaceWith = ReplaceWith("this")
)
public fun <T> StateFlow<T>.flowOn(context: CoroutineContext): Flow<T> = this
public fun <T> StateFlow<T>.flowOn(context: CoroutineContext): Flow<T> = noImpl()

/**
* Returns this.
* Applying [conflate][Flow.conflate] operator to [StateFlow] has no effect.
* See [StateFlow] documentation on Operator Fusion.
*/
@Deprecated(
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
message = "Applying conflate operator to StateFlow has no effect. See StateFlow documentation on Operator Fusion.",
replaceWith = ReplaceWith("this")
)
public fun <T> StateFlow<T>.conflate(): Flow<T> = this
public fun <T> StateFlow<T>.conflate(): Flow<T> = noImpl()

/**
* Returns this.
* Applying [distinctUntilChanged][Flow.distinctUntilChanged] operator to [StateFlow] has no effect.
* See [StateFlow] documentation on Operator Fusion.
*/
@Deprecated(
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
message = "Applying distinctUntilChanged operator to StateFlow has no effect. See StateFlow documentation on Operator Fusion.",
replaceWith = ReplaceWith("this")
)
public fun <T> StateFlow<T>.distinctUntilChanged(): Flow<T> = this
public fun <T> StateFlow<T>.distinctUntilChanged(): Flow<T> = noImpl()

0 comments on commit 1e81e6d

Please sign in to comment.