Promote scanReduce deprecation level to error

This commit is contained in:
Abduqodiri Qurbonzoda
2020-05-31 22:27:03 +03:00
parent 4e820edd1f
commit 820353ee0e
7 changed files with 40 additions and 42 deletions
@@ -20133,14 +20133,14 @@ public inline fun <R> 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 <S, T : S> Array<out T>.scanReduce(operation: (acc: S, T) -> S): List<S> {
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<I
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
@@ -20172,7 +20172,7 @@ public inline fun LongArray.scanReduce(operation: (acc: Long, Long) -> 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 <S, T : S> Array<out T>.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): List<S> {
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
@@ -2601,14 +2601,14 @@ public inline fun <T, R> Iterable<T>.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 <S, T : S> Iterable<T>.scanReduce(operation: (acc: S, T) -> S): List<S> {
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 <S, T : S> Iterable<T>.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): List<S> {
@@ -2046,14 +2046,14 @@ public fun <T, R> Sequence<T>.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 <S, T : S> Sequence<T>.scanReduce(operation: (acc: S, T) -> S): Sequence<S> {
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 <S, T : S> Sequence<T>.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): Sequence<S> {
@@ -1867,14 +1867,14 @@ public inline fun <R> 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<Char> {
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<Char> {
@@ -9106,7 +9106,7 @@ public inline fun <R> 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
@@ -468,18 +468,16 @@ abstract class IterableTests<T : Iterable<String>>(val createFrom: (Array<out St
}
@Test
@Suppress("DEPRECATION")
fun scanReduce() {
val accumulators = data.scanReduce { acc, e -> 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"))
@@ -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() }