diff --git a/libraries/stdlib/common/src/generated/_Arrays.kt b/libraries/stdlib/common/src/generated/_Arrays.kt index 2539d6cde98..e28f0ff2e88 100644 --- a/libraries/stdlib/common/src/generated/_Arrays.kt +++ b/libraries/stdlib/common/src/generated/_Arrays.kt @@ -20133,14 +20133,14 @@ public inline fun CharArray.scanIndexed(initial: R, operation: (index: Int, return runningFoldIndexed(initial, operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public inline fun Array.scanReduce(operation: (acc: S, T) -> S): List { return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20148,7 +20148,7 @@ public inline fun ByteArray.scanReduce(operation: (acc: Byte, Byte) -> Byte): Li return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20156,7 +20156,7 @@ public inline fun ShortArray.scanReduce(operation: (acc: Short, Short) -> Short) return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20164,7 +20164,7 @@ public inline fun IntArray.scanReduce(operation: (acc: Int, Int) -> Int): List Long): Li return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20180,7 +20180,7 @@ public inline fun FloatArray.scanReduce(operation: (acc: Float, Float) -> Float) return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20188,7 +20188,7 @@ public inline fun DoubleArray.scanReduce(operation: (acc: Double, Double) -> Dou return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20196,7 +20196,7 @@ public inline fun BooleanArray.scanReduce(operation: (acc: Boolean, Boolean) -> return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20204,14 +20204,14 @@ public inline fun CharArray.scanReduce(operation: (acc: Char, Char) -> Char): Li return runningReduce(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public inline fun Array.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): List { return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20219,7 +20219,7 @@ public inline fun ByteArray.scanReduceIndexed(operation: (index: Int, acc: Byte, return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20227,7 +20227,7 @@ public inline fun ShortArray.scanReduceIndexed(operation: (index: Int, acc: Shor return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20235,7 +20235,7 @@ public inline fun IntArray.scanReduceIndexed(operation: (index: Int, acc: Int, I return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20243,7 +20243,7 @@ public inline fun LongArray.scanReduceIndexed(operation: (index: Int, acc: Long, return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20251,7 +20251,7 @@ public inline fun FloatArray.scanReduceIndexed(operation: (index: Int, acc: Floa return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20259,7 +20259,7 @@ public inline fun DoubleArray.scanReduceIndexed(operation: (index: Int, acc: Dou return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly @@ -20267,7 +20267,7 @@ public inline fun BooleanArray.scanReduceIndexed(operation: (index: Int, acc: Bo return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @kotlin.internal.InlineOnly diff --git a/libraries/stdlib/common/src/generated/_Collections.kt b/libraries/stdlib/common/src/generated/_Collections.kt index 7ee5b90baa0..e65855cf190 100644 --- a/libraries/stdlib/common/src/generated/_Collections.kt +++ b/libraries/stdlib/common/src/generated/_Collections.kt @@ -2601,14 +2601,14 @@ public inline fun Iterable.scanIndexed(initial: R, operation: (index: return runningFoldIndexed(initial, operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public inline fun Iterable.scanReduce(operation: (acc: S, T) -> S): List { return runningReduce(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public inline fun Iterable.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): List { diff --git a/libraries/stdlib/common/src/generated/_Sequences.kt b/libraries/stdlib/common/src/generated/_Sequences.kt index 226cc14e606..215711e286e 100644 --- a/libraries/stdlib/common/src/generated/_Sequences.kt +++ b/libraries/stdlib/common/src/generated/_Sequences.kt @@ -2046,14 +2046,14 @@ public fun Sequence.scanIndexed(initial: R, operation: (index: Int, ac return runningFoldIndexed(initial, operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public fun Sequence.scanReduce(operation: (acc: S, T) -> S): Sequence { return runningReduce(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public fun Sequence.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): Sequence { diff --git a/libraries/stdlib/common/src/generated/_Strings.kt b/libraries/stdlib/common/src/generated/_Strings.kt index 799a1cf6839..f766c0ff2c4 100644 --- a/libraries/stdlib/common/src/generated/_Strings.kt +++ b/libraries/stdlib/common/src/generated/_Strings.kt @@ -1867,14 +1867,14 @@ public inline fun CharSequence.scanIndexed(initial: R, operation: (index: In return runningFoldIndexed(initial, operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public inline fun CharSequence.scanReduce(operation: (acc: Char, Char) -> Char): List { return runningReduce(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi public inline fun CharSequence.scanReduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): List { diff --git a/libraries/stdlib/common/src/generated/_UArrays.kt b/libraries/stdlib/common/src/generated/_UArrays.kt index d4daf5ac8ac..bc965861343 100644 --- a/libraries/stdlib/common/src/generated/_UArrays.kt +++ b/libraries/stdlib/common/src/generated/_UArrays.kt @@ -9106,7 +9106,7 @@ public inline fun UShortArray.scanIndexed(initial: R, operation: (index: Int return runningFoldIndexed(initial, operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes @@ -9115,7 +9115,7 @@ public inline fun UIntArray.scanReduce(operation: (acc: UInt, UInt) -> UInt): Li return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes @@ -9124,7 +9124,7 @@ public inline fun ULongArray.scanReduce(operation: (acc: ULong, ULong) -> ULong) return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes @@ -9133,7 +9133,7 @@ public inline fun UByteArray.scanReduce(operation: (acc: UByte, UByte) -> UByte) return runningReduce(operation) } -@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)")) +@Deprecated("Use runningReduce instead.", ReplaceWith("runningReduce(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes @@ -9142,7 +9142,7 @@ public inline fun UShortArray.scanReduce(operation: (acc: UShort, UShort) -> USh return runningReduce(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes @@ -9151,7 +9151,7 @@ public inline fun UIntArray.scanReduceIndexed(operation: (index: Int, acc: UInt, return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes @@ -9160,7 +9160,7 @@ public inline fun ULongArray.scanReduceIndexed(operation: (index: Int, acc: ULon return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes @@ -9169,7 +9169,7 @@ public inline fun UByteArray.scanReduceIndexed(operation: (index: Int, acc: UByt return runningReduceIndexed(operation) } -@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)")) +@Deprecated("Use runningReduceIndexed instead.", ReplaceWith("runningReduceIndexed(operation)"), level = DeprecationLevel.ERROR) @SinceKotlin("1.3") @ExperimentalStdlibApi @ExperimentalUnsignedTypes diff --git a/libraries/stdlib/test/collections/IterableTests.kt b/libraries/stdlib/test/collections/IterableTests.kt index 0e862478aa4..8dce6de37cd 100644 --- a/libraries/stdlib/test/collections/IterableTests.kt +++ b/libraries/stdlib/test/collections/IterableTests.kt @@ -468,18 +468,16 @@ abstract class IterableTests>(val createFrom: (Array acc + e } + fun runningReduce() { + val accumulators = data.runningReduce { acc, e -> acc + e } assertEquals(2, accumulators.size) assertTrue(accumulators.first() in listOf("foo", "bar")) assertTrue(accumulators.last() in listOf("foobar", "barfoo")) } @Test - @Suppress("DEPRECATION") - fun scanReduceIndexed() { - val accumulators = data.scanReduceIndexed { i, acc, e -> acc + i + e } + fun runningReduceIndexed() { + val accumulators = data.runningReduceIndexed { i, acc, e -> acc + i + e } assertEquals(2, accumulators.size) assertTrue(accumulators.first() in listOf("foo", "bar")) assertTrue(accumulators.last() in listOf("foo1bar", "bar1foo")) diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt index 1111869274e..b3f7657311f 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt @@ -1797,7 +1797,7 @@ object Aggregates : TemplateGroupBase() { } builder { since("1.3") annotation("@ExperimentalStdlibApi") - deprecate(Deprecation("Use runningReduce instead.", "runningReduce(operation)", DeprecationLevel.WARNING)) + deprecate(Deprecation("Use runningReduce instead.", "runningReduce(operation)", DeprecationLevel.ERROR)) specialFor(CharSequences) { inline() } specialFor(ArraysOfPrimitives, ArraysOfUnsigned) { inlineOnly() } @@ -1812,7 +1812,7 @@ object Aggregates : TemplateGroupBase() { } builder { since("1.3") annotation("@ExperimentalStdlibApi") - deprecate(Deprecation("Use runningReduceIndexed instead.", "runningReduceIndexed(operation)", DeprecationLevel.WARNING)) + deprecate(Deprecation("Use runningReduceIndexed instead.", "runningReduceIndexed(operation)", DeprecationLevel.ERROR)) specialFor(CharSequences) { inline() } specialFor(ArraysOfPrimitives, ArraysOfUnsigned) { inlineOnly() } @@ -1827,7 +1827,7 @@ object Aggregates : TemplateGroupBase() { } builder { since("1.3") annotation("@ExperimentalStdlibApi") - deprecate(Deprecation("Use runningReduce instead.", "runningReduce(operation)", DeprecationLevel.WARNING)) + deprecate(Deprecation("Use runningReduce instead.", "runningReduce(operation)", DeprecationLevel.ERROR)) specialFor(ArraysOfObjects, Iterables) { inline() } @@ -1844,7 +1844,7 @@ object Aggregates : TemplateGroupBase() { } builder { since("1.3") annotation("@ExperimentalStdlibApi") - deprecate(Deprecation("Use runningReduceIndexed instead.", "runningReduceIndexed(operation)", DeprecationLevel.WARNING)) + deprecate(Deprecation("Use runningReduceIndexed instead.", "runningReduceIndexed(operation)", DeprecationLevel.ERROR)) specialFor(ArraysOfObjects, Iterables) { inline() }