Skip to content

Commit 8d1ee7d

Browse files
authored
Promote the following experimental API to stable (Kotlin#2971)
* transformWhile * awaitClose and ProducerScope (for callbackFlow and channelFlow) * merge * runningFold, runningReduce, and scan
1 parent 5a62781 commit 8d1ee7d

File tree

5 files changed

+2
-13
lines changed

5 files changed

+2
-13
lines changed

kotlinx-coroutines-core/common/src/channels/Produce.kt

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ package kotlinx.coroutines.channels
66

77
import kotlinx.coroutines.*
88
import kotlin.coroutines.*
9+
import kotlinx.coroutines.flow.*
910

1011
/**
11-
* Scope for the [produce][CoroutineScope.produce] coroutine builder.
12-
*
13-
* **Note: This is an experimental api.** Behavior of producers that work as children in a parent scope with respect
14-
* to cancellation and error handling may change in the future.
12+
* Scope for the [produce][CoroutineScope.produce], [callbackFlow] and [channelFlow] builders.
1513
*/
16-
@ExperimentalCoroutinesApi
1714
public interface ProducerScope<in E> : CoroutineScope, SendChannel<E> {
1815
/**
1916
* A reference to the channel this coroutine [sends][send] elements to.
@@ -45,7 +42,6 @@ public interface ProducerScope<in E> : CoroutineScope, SendChannel<E> {
4542
* }
4643
* ```
4744
*/
48-
@ExperimentalCoroutinesApi
4945
public suspend fun ProducerScope<*>.awaitClose(block: () -> Unit = {}) {
5046
check(kotlin.coroutines.coroutineContext[Job] === this) { "awaitClose() can only be invoked from the producer context" }
5147
try {

kotlinx-coroutines-core/common/src/flow/operators/Limit.kt

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ public fun <T> Flow<T>.takeWhile(predicate: suspend (T) -> Boolean): Flow<T> = f
112112
* }
113113
* ```
114114
*/
115-
@ExperimentalCoroutinesApi
116115
public fun <T, R> Flow<T>.transformWhile(
117116
@BuilderInference transform: suspend FlowCollector<R>.(value: T) -> Boolean
118117
): Flow<R> =

kotlinx-coroutines-core/common/src/flow/operators/Merge.kt

-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public fun <T> Flow<Flow<T>>.flattenConcat(): Flow<T> = flow {
9090
* Applications of [flowOn], [buffer], and [produceIn] _after_ this operator are fused with
9191
* its concurrent merging so that only one properly configured channel is used for execution of merging logic.
9292
*/
93-
@ExperimentalCoroutinesApi
9493
public fun <T> Iterable<Flow<T>>.merge(): Flow<T> {
9594
/*
9695
* This is a fuseable implementation of the following operator:
@@ -114,7 +113,6 @@ public fun <T> Iterable<Flow<T>>.merge(): Flow<T> {
114113
* Applications of [flowOn], [buffer], and [produceIn] _after_ this operator are fused with
115114
* its concurrent merging so that only one properly configured channel is used for execution of merging logic.
116115
*/
117-
@ExperimentalCoroutinesApi
118116
public fun <T> merge(vararg flows: Flow<T>): Flow<T> = flows.asIterable().merge()
119117

120118
/**

kotlinx-coroutines-core/common/src/flow/operators/Transform.kt

-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public fun <T> Flow<T>.onEach(action: suspend (T) -> Unit): Flow<T> = transform
8585
*
8686
* This function is an alias to [runningFold] operator.
8787
*/
88-
@ExperimentalCoroutinesApi
8988
public fun <T, R> Flow<T>.scan(initial: R, @BuilderInference operation: suspend (accumulator: R, value: T) -> R): Flow<R> = runningFold(initial, operation)
9089

9190
/**
@@ -97,7 +96,6 @@ public fun <T, R> Flow<T>.scan(initial: R, @BuilderInference operation: suspend
9796
* ```
9897
* will produce `[], [1], [1, 2], [1, 2, 3]]`.
9998
*/
100-
@ExperimentalCoroutinesApi
10199
public fun <T, R> Flow<T>.runningFold(initial: R, @BuilderInference operation: suspend (accumulator: R, value: T) -> R): Flow<R> = flow {
102100
var accumulator: R = initial
103101
emit(accumulator)
@@ -118,7 +116,6 @@ public fun <T, R> Flow<T>.runningFold(initial: R, @BuilderInference operation: s
118116
* ```
119117
* will produce `[1, 3, 6, 10]`
120118
*/
121-
@ExperimentalCoroutinesApi
122119
public fun <T> Flow<T>.runningReduce(operation: suspend (accumulator: T, value: T) -> T): Flow<T> = flow {
123120
var accumulator: Any? = NULL
124121
collect { value ->

reactive/kotlinx-coroutines-reactor/src/ReactorContext.kt

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package kotlinx.coroutines.reactor
66

7-
import kotlinx.coroutines.ExperimentalCoroutinesApi
87
import kotlin.coroutines.*
98
import kotlinx.coroutines.reactive.*
109
import reactor.util.context.*

0 commit comments

Comments
 (0)