Stabilize unsigned types KT-45653

Deprecate specialized unsigned iterators for removal.

Fix compiler tests:
- drop unsignedLiteralsOn1_2 because apiVersion 1.2 is no longer supported
- drop experimental unsigned literals diagnostic test
This commit is contained in:
Ilya Gorbunov
2021-03-19 20:38:02 +03:00
parent 768c165a72
commit 94240f7b21
63 changed files with 1305 additions and 1461 deletions
@@ -21925,11 +21925,11 @@ public inline fun CharArray.sumOf(selector: (Char) -> Long): Long {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun <T> Array<out T>.sumOf(selector: (T) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -21942,11 +21942,11 @@ public inline fun <T> Array<out T>.sumOf(selector: (T) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ByteArray.sumOf(selector: (Byte) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -21959,11 +21959,11 @@ public inline fun ByteArray.sumOf(selector: (Byte) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ShortArray.sumOf(selector: (Short) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -21976,11 +21976,11 @@ public inline fun ShortArray.sumOf(selector: (Short) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun IntArray.sumOf(selector: (Int) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -21993,11 +21993,11 @@ public inline fun IntArray.sumOf(selector: (Int) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun LongArray.sumOf(selector: (Long) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -22010,11 +22010,11 @@ public inline fun LongArray.sumOf(selector: (Long) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun FloatArray.sumOf(selector: (Float) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -22027,11 +22027,11 @@ public inline fun FloatArray.sumOf(selector: (Float) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun DoubleArray.sumOf(selector: (Double) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -22044,11 +22044,11 @@ public inline fun DoubleArray.sumOf(selector: (Double) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun BooleanArray.sumOf(selector: (Boolean) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -22061,11 +22061,11 @@ public inline fun BooleanArray.sumOf(selector: (Boolean) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun CharArray.sumOf(selector: (Char) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -22078,11 +22078,11 @@ public inline fun CharArray.sumOf(selector: (Char) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun <T> Array<out T>.sumOf(selector: (T) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22095,11 +22095,11 @@ public inline fun <T> Array<out T>.sumOf(selector: (T) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ByteArray.sumOf(selector: (Byte) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22112,11 +22112,11 @@ public inline fun ByteArray.sumOf(selector: (Byte) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ShortArray.sumOf(selector: (Short) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22129,11 +22129,11 @@ public inline fun ShortArray.sumOf(selector: (Short) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun IntArray.sumOf(selector: (Int) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22146,11 +22146,11 @@ public inline fun IntArray.sumOf(selector: (Int) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun LongArray.sumOf(selector: (Long) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22163,11 +22163,11 @@ public inline fun LongArray.sumOf(selector: (Long) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun FloatArray.sumOf(selector: (Float) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22180,11 +22180,11 @@ public inline fun FloatArray.sumOf(selector: (Float) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun DoubleArray.sumOf(selector: (Double) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22197,11 +22197,11 @@ public inline fun DoubleArray.sumOf(selector: (Double) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun BooleanArray.sumOf(selector: (Boolean) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -22214,11 +22214,11 @@ public inline fun BooleanArray.sumOf(selector: (Boolean) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun CharArray.sumOf(selector: (Char) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -2898,11 +2898,11 @@ public inline fun <T> Iterable<T>.sumOf(selector: (T) -> Long): Long {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.sumOf(selector: (T) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -2915,11 +2915,11 @@ public inline fun <T> Iterable<T>.sumOf(selector: (T) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.sumOf(selector: (T) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -2351,11 +2351,11 @@ public inline fun <T> Sequence<T>.sumOf(selector: (T) -> Long): Long {
*
* The operation is _terminal_.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.sumOf(selector: (T) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -2370,11 +2370,11 @@ public inline fun <T> Sequence<T>.sumOf(selector: (T) -> UInt): UInt {
*
* The operation is _terminal_.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.sumOf(selector: (T) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -2087,11 +2087,11 @@ public inline fun CharSequence.sumOf(selector: (Char) -> Long): Long {
/**
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun CharSequence.sumOf(selector: (Char) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -2104,11 +2104,11 @@ public inline fun CharSequence.sumOf(selector: (Char) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun CharSequence.sumOf(selector: (Char) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -1262,8 +1262,8 @@ public fun UShortArray.random(random: Random): UShort {
* Returns a random element from this array, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UIntArray.randomOrNull(): UInt? {
return randomOrNull(Random)
@@ -1273,8 +1273,8 @@ public inline fun UIntArray.randomOrNull(): UInt? {
* Returns a random element from this array, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun ULongArray.randomOrNull(): ULong? {
return randomOrNull(Random)
@@ -1284,8 +1284,8 @@ public inline fun ULongArray.randomOrNull(): ULong? {
* Returns a random element from this array, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UByteArray.randomOrNull(): UByte? {
return randomOrNull(Random)
@@ -1295,8 +1295,8 @@ public inline fun UByteArray.randomOrNull(): UByte? {
* Returns a random element from this array, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UShortArray.randomOrNull(): UShort? {
return randomOrNull(Random)
@@ -1306,8 +1306,8 @@ public inline fun UShortArray.randomOrNull(): UShort? {
* Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
public fun UIntArray.randomOrNull(random: Random): UInt? {
if (isEmpty())
return null
@@ -1318,8 +1318,8 @@ public fun UIntArray.randomOrNull(random: Random): UInt? {
* Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
public fun ULongArray.randomOrNull(random: Random): ULong? {
if (isEmpty())
return null
@@ -1330,8 +1330,8 @@ public fun ULongArray.randomOrNull(random: Random): ULong? {
* Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
public fun UByteArray.randomOrNull(random: Random): UByte? {
if (isEmpty())
return null
@@ -1342,8 +1342,8 @@ public fun UByteArray.randomOrNull(random: Random): UByte? {
* Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
public fun UShortArray.randomOrNull(random: Random): UShort? {
if (isEmpty())
return null
@@ -8490,8 +8490,8 @@ public inline fun UShortArray.reduceIndexedOrNull(operation: (index: Int, acc: U
* @sample samples.collections.Collections.Aggregates.reduceOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UIntArray.reduceOrNull(operation: (acc: UInt, UInt) -> UInt): UInt? {
if (isEmpty())
@@ -8515,8 +8515,8 @@ public inline fun UIntArray.reduceOrNull(operation: (acc: UInt, UInt) -> UInt):
* @sample samples.collections.Collections.Aggregates.reduceOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun ULongArray.reduceOrNull(operation: (acc: ULong, ULong) -> ULong): ULong? {
if (isEmpty())
@@ -8540,8 +8540,8 @@ public inline fun ULongArray.reduceOrNull(operation: (acc: ULong, ULong) -> ULon
* @sample samples.collections.Collections.Aggregates.reduceOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UByteArray.reduceOrNull(operation: (acc: UByte, UByte) -> UByte): UByte? {
if (isEmpty())
@@ -8565,8 +8565,8 @@ public inline fun UByteArray.reduceOrNull(operation: (acc: UByte, UByte) -> UByt
* @sample samples.collections.Collections.Aggregates.reduceOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UShortArray.reduceOrNull(operation: (acc: UShort, UShort) -> UShort): UShort? {
if (isEmpty())
@@ -8894,8 +8894,8 @@ public inline fun UShortArray.reduceRightIndexedOrNull(operation: (index: Int, U
* @sample samples.collections.Collections.Aggregates.reduceRightOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UIntArray.reduceRightOrNull(operation: (UInt, acc: UInt) -> UInt): UInt? {
var index = lastIndex
@@ -8919,8 +8919,8 @@ public inline fun UIntArray.reduceRightOrNull(operation: (UInt, acc: UInt) -> UI
* @sample samples.collections.Collections.Aggregates.reduceRightOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun ULongArray.reduceRightOrNull(operation: (ULong, acc: ULong) -> ULong): ULong? {
var index = lastIndex
@@ -8944,8 +8944,8 @@ public inline fun ULongArray.reduceRightOrNull(operation: (ULong, acc: ULong) ->
* @sample samples.collections.Collections.Aggregates.reduceRightOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UByteArray.reduceRightOrNull(operation: (UByte, acc: UByte) -> UByte): UByte? {
var index = lastIndex
@@ -8969,8 +8969,8 @@ public inline fun UByteArray.reduceRightOrNull(operation: (UByte, acc: UByte) ->
* @sample samples.collections.Collections.Aggregates.reduceRightOrNull
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun UShortArray.reduceRightOrNull(operation: (UShort, acc: UShort) -> UShort): UShort? {
var index = lastIndex
@@ -9402,8 +9402,8 @@ public inline fun UShortArray.runningReduceIndexed(operation: (index: Int, acc:
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> UIntArray.scan(initial: R, operation: (acc: R, UInt) -> R): List<R> {
return runningFold(initial, operation)
@@ -9421,8 +9421,8 @@ public inline fun <R> UIntArray.scan(initial: R, operation: (acc: R, UInt) -> R)
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> ULongArray.scan(initial: R, operation: (acc: R, ULong) -> R): List<R> {
return runningFold(initial, operation)
@@ -9440,8 +9440,8 @@ public inline fun <R> ULongArray.scan(initial: R, operation: (acc: R, ULong) ->
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> UByteArray.scan(initial: R, operation: (acc: R, UByte) -> R): List<R> {
return runningFold(initial, operation)
@@ -9459,8 +9459,8 @@ public inline fun <R> UByteArray.scan(initial: R, operation: (acc: R, UByte) ->
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> UShortArray.scan(initial: R, operation: (acc: R, UShort) -> R): List<R> {
return runningFold(initial, operation)
@@ -9479,8 +9479,8 @@ public inline fun <R> UShortArray.scan(initial: R, operation: (acc: R, UShort) -
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> UIntArray.scanIndexed(initial: R, operation: (index: Int, acc: R, UInt) -> R): List<R> {
return runningFoldIndexed(initial, operation)
@@ -9499,8 +9499,8 @@ public inline fun <R> UIntArray.scanIndexed(initial: R, operation: (index: Int,
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> ULongArray.scanIndexed(initial: R, operation: (index: Int, acc: R, ULong) -> R): List<R> {
return runningFoldIndexed(initial, operation)
@@ -9519,8 +9519,8 @@ public inline fun <R> ULongArray.scanIndexed(initial: R, operation: (index: Int,
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> UByteArray.scanIndexed(initial: R, operation: (index: Int, acc: R, UByte) -> R): List<R> {
return runningFoldIndexed(initial, operation)
@@ -9539,8 +9539,8 @@ public inline fun <R> UByteArray.scanIndexed(initial: R, operation: (index: Int,
* @sample samples.collections.Collections.Aggregates.scan
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun <R> UShortArray.scanIndexed(initial: R, operation: (index: Int, acc: R, UShort) -> R): List<R> {
return runningFoldIndexed(initial, operation)
@@ -9949,12 +9949,13 @@ public inline fun UShortArray.sumOf(selector: (UShort) -> Long): Long {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UIntArray.sumOf(selector: (UInt) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -9967,12 +9968,13 @@ public inline fun UIntArray.sumOf(selector: (UInt) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ULongArray.sumOf(selector: (ULong) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -9985,12 +9987,13 @@ public inline fun ULongArray.sumOf(selector: (ULong) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UByteArray.sumOf(selector: (UByte) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -10003,12 +10006,13 @@ public inline fun UByteArray.sumOf(selector: (UByte) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfUInt")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UShortArray.sumOf(selector: (UShort) -> UInt): UInt {
var sum: UInt = 0.toUInt()
@@ -10021,12 +10025,13 @@ public inline fun UShortArray.sumOf(selector: (UShort) -> UInt): UInt {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UIntArray.sumOf(selector: (UInt) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -10039,12 +10044,13 @@ public inline fun UIntArray.sumOf(selector: (UInt) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ULongArray.sumOf(selector: (ULong) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -10057,12 +10063,13 @@ public inline fun ULongArray.sumOf(selector: (ULong) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UByteArray.sumOf(selector: (UByte) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -10075,12 +10082,13 @@ public inline fun UByteArray.sumOf(selector: (UByte) -> ULong): ULong {
/**
* Returns the sum of all values produced by [selector] function applied to each element in the array.
*/
@SinceKotlin("1.4")
@SinceKotlin("1.5")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@Suppress("INAPPLICABLE_JVM_NAME")
@kotlin.jvm.JvmName("sumOfULong")
@ExperimentalUnsignedTypes
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UShortArray.sumOf(selector: (UShort) -> ULong): ULong {
var sum: ULong = 0.toULong()
@@ -10474,8 +10482,8 @@ public inline fun <V> UShortArray.zip(other: UShortArray, transform: (a: UShort,
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfUInt")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Array<out UInt>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -10488,8 +10496,8 @@ public fun Array<out UInt>.sum(): UInt {
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfULong")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Array<out ULong>.sum(): ULong {
var sum: ULong = 0uL
for (element in this) {
@@ -10502,8 +10510,8 @@ public fun Array<out ULong>.sum(): ULong {
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfUByte")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Array<out UByte>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -10516,8 +10524,8 @@ public fun Array<out UByte>.sum(): UInt {
* Returns the sum of all elements in the array.
*/
@kotlin.jvm.JvmName("sumOfUShort")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Array<out UShort>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -73,8 +73,8 @@ public fun Collection<UShort>.toUShortArray(): UShortArray {
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfUInt")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<UInt>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -87,8 +87,8 @@ public fun Iterable<UInt>.sum(): UInt {
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfULong")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<ULong>.sum(): ULong {
var sum: ULong = 0uL
for (element in this) {
@@ -101,8 +101,8 @@ public fun Iterable<ULong>.sum(): ULong {
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfUByte")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<UByte>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -115,8 +115,8 @@ public fun Iterable<UByte>.sum(): UInt {
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfUShort")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<UShort>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -18,8 +18,8 @@ import kotlin.random.*
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun maxOf(a: UInt, b: UInt): UInt {
return if (a >= b) a else b
}
@@ -27,8 +27,8 @@ public fun maxOf(a: UInt, b: UInt): UInt {
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun maxOf(a: ULong, b: ULong): ULong {
return if (a >= b) a else b
}
@@ -36,8 +36,8 @@ public fun maxOf(a: ULong, b: ULong): ULong {
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun maxOf(a: UByte, b: UByte): UByte {
return if (a >= b) a else b
}
@@ -45,8 +45,8 @@ public fun maxOf(a: UByte, b: UByte): UByte {
/**
* Returns the greater of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun maxOf(a: UShort, b: UShort): UShort {
return if (a >= b) a else b
}
@@ -54,8 +54,8 @@ public fun maxOf(a: UShort, b: UShort): UShort {
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun maxOf(a: UInt, b: UInt, c: UInt): UInt {
return maxOf(a, maxOf(b, c))
@@ -64,8 +64,8 @@ public inline fun maxOf(a: UInt, b: UInt, c: UInt): UInt {
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun maxOf(a: ULong, b: ULong, c: ULong): ULong {
return maxOf(a, maxOf(b, c))
@@ -74,8 +74,8 @@ public inline fun maxOf(a: ULong, b: ULong, c: ULong): ULong {
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun maxOf(a: UByte, b: UByte, c: UByte): UByte {
return maxOf(a, maxOf(b, c))
@@ -84,8 +84,8 @@ public inline fun maxOf(a: UByte, b: UByte, c: UByte): UByte {
/**
* Returns the greater of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun maxOf(a: UShort, b: UShort, c: UShort): UShort {
return maxOf(a, maxOf(b, c))
@@ -138,8 +138,8 @@ public fun maxOf(a: UShort, vararg other: UShort): UShort {
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun minOf(a: UInt, b: UInt): UInt {
return if (a <= b) a else b
}
@@ -147,8 +147,8 @@ public fun minOf(a: UInt, b: UInt): UInt {
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun minOf(a: ULong, b: ULong): ULong {
return if (a <= b) a else b
}
@@ -156,8 +156,8 @@ public fun minOf(a: ULong, b: ULong): ULong {
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun minOf(a: UByte, b: UByte): UByte {
return if (a <= b) a else b
}
@@ -165,8 +165,8 @@ public fun minOf(a: UByte, b: UByte): UByte {
/**
* Returns the smaller of two values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun minOf(a: UShort, b: UShort): UShort {
return if (a <= b) a else b
}
@@ -174,8 +174,8 @@ public fun minOf(a: UShort, b: UShort): UShort {
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun minOf(a: UInt, b: UInt, c: UInt): UInt {
return minOf(a, minOf(b, c))
@@ -184,8 +184,8 @@ public inline fun minOf(a: UInt, b: UInt, c: UInt): UInt {
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun minOf(a: ULong, b: ULong, c: ULong): ULong {
return minOf(a, minOf(b, c))
@@ -194,8 +194,8 @@ public inline fun minOf(a: ULong, b: ULong, c: ULong): ULong {
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun minOf(a: UByte, b: UByte, c: UByte): UByte {
return minOf(a, minOf(b, c))
@@ -204,8 +204,8 @@ public inline fun minOf(a: UByte, b: UByte, c: UByte): UByte {
/**
* Returns the smaller of three values.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun minOf(a: UShort, b: UShort, c: UShort): UShort {
return minOf(a, minOf(b, c))
@@ -20,8 +20,8 @@ import kotlin.random.*
*
* @throws IllegalArgumentException if this range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UIntRange.random(): UInt {
return random(Random)
@@ -32,8 +32,8 @@ public inline fun UIntRange.random(): UInt {
*
* @throws IllegalArgumentException if this range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ULongRange.random(): ULong {
return random(Random)
@@ -44,8 +44,8 @@ public inline fun ULongRange.random(): ULong {
*
* @throws IllegalArgumentException if this range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UIntRange.random(random: Random): UInt {
try {
return random.nextUInt(this)
@@ -59,8 +59,8 @@ public fun UIntRange.random(random: Random): UInt {
*
* @throws IllegalArgumentException if this range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun ULongRange.random(random: Random): ULong {
try {
return random.nextULong(this)
@@ -72,9 +72,8 @@ public fun ULongRange.random(random: Random): ULong {
/**
* Returns a random element from this range, or `null` if this range is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalStdlibApi::class, ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun UIntRange.randomOrNull(): UInt? {
return randomOrNull(Random)
@@ -83,9 +82,8 @@ public inline fun UIntRange.randomOrNull(): UInt? {
/**
* Returns a random element from this range, or `null` if this range is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalStdlibApi::class, ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline fun ULongRange.randomOrNull(): ULong? {
return randomOrNull(Random)
@@ -94,9 +92,8 @@ public inline fun ULongRange.randomOrNull(): ULong? {
/**
* Returns a random element from this range using the specified source of randomness, or `null` if this range is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalStdlibApi::class, ExperimentalUnsignedTypes::class)
public fun UIntRange.randomOrNull(random: Random): UInt? {
if (isEmpty())
return null
@@ -106,9 +103,8 @@ public fun UIntRange.randomOrNull(random: Random): UInt? {
/**
* Returns a random element from this range using the specified source of randomness, or `null` if this range is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalStdlibApi::class, ExperimentalUnsignedTypes::class)
public fun ULongRange.randomOrNull(random: Random): ULong? {
if (isEmpty())
return null
@@ -120,8 +116,8 @@ public fun ULongRange.randomOrNull(random: Random): ULong? {
*
* Always returns `false` if the [element] is `null`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline operator fun UIntRange.contains(element: UInt?): Boolean {
return element != null && contains(element)
@@ -132,8 +128,8 @@ public inline operator fun UIntRange.contains(element: UInt?): Boolean {
*
* Always returns `false` if the [element] is `null`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@kotlin.internal.InlineOnly
public inline operator fun ULongRange.contains(element: ULong?): Boolean {
return element != null && contains(element)
@@ -142,8 +138,8 @@ public inline operator fun ULongRange.contains(element: ULong?): Boolean {
/**
* Checks if the specified [value] belongs to this range.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public operator fun UIntRange.contains(value: UByte): Boolean {
return contains(value.toUInt())
}
@@ -151,8 +147,8 @@ public operator fun UIntRange.contains(value: UByte): Boolean {
/**
* Checks if the specified [value] belongs to this range.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public operator fun ULongRange.contains(value: UByte): Boolean {
return contains(value.toULong())
}
@@ -160,8 +156,8 @@ public operator fun ULongRange.contains(value: UByte): Boolean {
/**
* Checks if the specified [value] belongs to this range.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public operator fun ULongRange.contains(value: UInt): Boolean {
return contains(value.toULong())
}
@@ -169,8 +165,8 @@ public operator fun ULongRange.contains(value: UInt): Boolean {
/**
* Checks if the specified [value] belongs to this range.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public operator fun UIntRange.contains(value: ULong): Boolean {
return (value shr UInt.SIZE_BITS) == 0uL && contains(value.toUInt())
}
@@ -178,8 +174,8 @@ public operator fun UIntRange.contains(value: ULong): Boolean {
/**
* Checks if the specified [value] belongs to this range.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public operator fun UIntRange.contains(value: UShort): Boolean {
return contains(value.toUInt())
}
@@ -187,8 +183,8 @@ public operator fun UIntRange.contains(value: UShort): Boolean {
/**
* Checks if the specified [value] belongs to this range.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public operator fun ULongRange.contains(value: UShort): Boolean {
return contains(value.toULong())
}
@@ -199,8 +195,8 @@ public operator fun ULongRange.contains(value: UShort): Boolean {
* The [to] value should be less than or equal to `this` value.
* If the [to] value is greater than `this` value the returned progression is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun UByte.downTo(to: UByte): UIntProgression {
return UIntProgression.fromClosedRange(this.toUInt(), to.toUInt(), -1)
}
@@ -211,8 +207,8 @@ public infix fun UByte.downTo(to: UByte): UIntProgression {
* The [to] value should be less than or equal to `this` value.
* If the [to] value is greater than `this` value the returned progression is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun UInt.downTo(to: UInt): UIntProgression {
return UIntProgression.fromClosedRange(this, to, -1)
}
@@ -223,8 +219,8 @@ public infix fun UInt.downTo(to: UInt): UIntProgression {
* The [to] value should be less than or equal to `this` value.
* If the [to] value is greater than `this` value the returned progression is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun ULong.downTo(to: ULong): ULongProgression {
return ULongProgression.fromClosedRange(this, to, -1L)
}
@@ -235,8 +231,8 @@ public infix fun ULong.downTo(to: ULong): ULongProgression {
* The [to] value should be less than or equal to `this` value.
* If the [to] value is greater than `this` value the returned progression is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun UShort.downTo(to: UShort): UIntProgression {
return UIntProgression.fromClosedRange(this.toUInt(), to.toUInt(), -1)
}
@@ -244,8 +240,8 @@ public infix fun UShort.downTo(to: UShort): UIntProgression {
/**
* Returns a progression that goes over the same range in the opposite direction with the same step.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UIntProgression.reversed(): UIntProgression {
return UIntProgression.fromClosedRange(last, first, -step)
}
@@ -253,8 +249,8 @@ public fun UIntProgression.reversed(): UIntProgression {
/**
* Returns a progression that goes over the same range in the opposite direction with the same step.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun ULongProgression.reversed(): ULongProgression {
return ULongProgression.fromClosedRange(last, first, -step)
}
@@ -262,8 +258,8 @@ public fun ULongProgression.reversed(): ULongProgression {
/**
* Returns a progression that goes over the same range with the given step.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun UIntProgression.step(step: Int): UIntProgression {
checkStepIsPositive(step > 0, step)
return UIntProgression.fromClosedRange(first, last, if (this.step > 0) step else -step)
@@ -272,8 +268,8 @@ public infix fun UIntProgression.step(step: Int): UIntProgression {
/**
* Returns a progression that goes over the same range with the given step.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun ULongProgression.step(step: Long): ULongProgression {
checkStepIsPositive(step > 0, step)
return ULongProgression.fromClosedRange(first, last, if (this.step > 0) step else -step)
@@ -284,8 +280,8 @@ public infix fun ULongProgression.step(step: Long): ULongProgression {
*
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun UByte.until(to: UByte): UIntRange {
if (to <= UByte.MIN_VALUE) return UIntRange.EMPTY
return this.toUInt() .. (to - 1u).toUInt()
@@ -296,8 +292,8 @@ public infix fun UByte.until(to: UByte): UIntRange {
*
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun UInt.until(to: UInt): UIntRange {
if (to <= UInt.MIN_VALUE) return UIntRange.EMPTY
return this .. (to - 1u).toUInt()
@@ -308,8 +304,8 @@ public infix fun UInt.until(to: UInt): UIntRange {
*
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun ULong.until(to: ULong): ULongRange {
if (to <= ULong.MIN_VALUE) return ULongRange.EMPTY
return this .. (to - 1u).toULong()
@@ -320,8 +316,8 @@ public infix fun ULong.until(to: ULong): ULongRange {
*
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public infix fun UShort.until(to: UShort): UIntRange {
if (to <= UShort.MIN_VALUE) return UIntRange.EMPTY
return this.toUInt() .. (to - 1u).toUInt()
@@ -334,8 +330,8 @@ public infix fun UShort.until(to: UShort): UIntRange {
*
* @sample samples.comparisons.ComparableOps.coerceAtLeastUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UInt.coerceAtLeast(minimumValue: UInt): UInt {
return if (this < minimumValue) minimumValue else this
}
@@ -347,8 +343,8 @@ public fun UInt.coerceAtLeast(minimumValue: UInt): UInt {
*
* @sample samples.comparisons.ComparableOps.coerceAtLeastUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun ULong.coerceAtLeast(minimumValue: ULong): ULong {
return if (this < minimumValue) minimumValue else this
}
@@ -360,8 +356,8 @@ public fun ULong.coerceAtLeast(minimumValue: ULong): ULong {
*
* @sample samples.comparisons.ComparableOps.coerceAtLeastUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UByte.coerceAtLeast(minimumValue: UByte): UByte {
return if (this < minimumValue) minimumValue else this
}
@@ -373,8 +369,8 @@ public fun UByte.coerceAtLeast(minimumValue: UByte): UByte {
*
* @sample samples.comparisons.ComparableOps.coerceAtLeastUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UShort.coerceAtLeast(minimumValue: UShort): UShort {
return if (this < minimumValue) minimumValue else this
}
@@ -386,8 +382,8 @@ public fun UShort.coerceAtLeast(minimumValue: UShort): UShort {
*
* @sample samples.comparisons.ComparableOps.coerceAtMostUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UInt.coerceAtMost(maximumValue: UInt): UInt {
return if (this > maximumValue) maximumValue else this
}
@@ -399,8 +395,8 @@ public fun UInt.coerceAtMost(maximumValue: UInt): UInt {
*
* @sample samples.comparisons.ComparableOps.coerceAtMostUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun ULong.coerceAtMost(maximumValue: ULong): ULong {
return if (this > maximumValue) maximumValue else this
}
@@ -412,8 +408,8 @@ public fun ULong.coerceAtMost(maximumValue: ULong): ULong {
*
* @sample samples.comparisons.ComparableOps.coerceAtMostUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UByte.coerceAtMost(maximumValue: UByte): UByte {
return if (this > maximumValue) maximumValue else this
}
@@ -425,8 +421,8 @@ public fun UByte.coerceAtMost(maximumValue: UByte): UByte {
*
* @sample samples.comparisons.ComparableOps.coerceAtMostUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UShort.coerceAtMost(maximumValue: UShort): UShort {
return if (this > maximumValue) maximumValue else this
}
@@ -438,8 +434,8 @@ public fun UShort.coerceAtMost(maximumValue: UShort): UShort {
*
* @sample samples.comparisons.ComparableOps.coerceInUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UInt.coerceIn(minimumValue: UInt, maximumValue: UInt): UInt {
if (minimumValue > maximumValue) throw IllegalArgumentException("Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.")
if (this < minimumValue) return minimumValue
@@ -454,8 +450,8 @@ public fun UInt.coerceIn(minimumValue: UInt, maximumValue: UInt): UInt {
*
* @sample samples.comparisons.ComparableOps.coerceInUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun ULong.coerceIn(minimumValue: ULong, maximumValue: ULong): ULong {
if (minimumValue > maximumValue) throw IllegalArgumentException("Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.")
if (this < minimumValue) return minimumValue
@@ -470,8 +466,8 @@ public fun ULong.coerceIn(minimumValue: ULong, maximumValue: ULong): ULong {
*
* @sample samples.comparisons.ComparableOps.coerceInUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UByte.coerceIn(minimumValue: UByte, maximumValue: UByte): UByte {
if (minimumValue > maximumValue) throw IllegalArgumentException("Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.")
if (this < minimumValue) return minimumValue
@@ -486,8 +482,8 @@ public fun UByte.coerceIn(minimumValue: UByte, maximumValue: UByte): UByte {
*
* @sample samples.comparisons.ComparableOps.coerceInUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UShort.coerceIn(minimumValue: UShort, maximumValue: UShort): UShort {
if (minimumValue > maximumValue) throw IllegalArgumentException("Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.")
if (this < minimumValue) return minimumValue
@@ -502,8 +498,8 @@ public fun UShort.coerceIn(minimumValue: UShort, maximumValue: UShort): UShort {
*
* @sample samples.comparisons.ComparableOps.coerceInUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun UInt.coerceIn(range: ClosedRange<UInt>): UInt {
if (range is ClosedFloatingPointRange) {
return this.coerceIn<UInt>(range)
@@ -523,8 +519,8 @@ public fun UInt.coerceIn(range: ClosedRange<UInt>): UInt {
*
* @sample samples.comparisons.ComparableOps.coerceInUnsigned
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun ULong.coerceIn(range: ClosedRange<ULong>): ULong {
if (range is ClosedFloatingPointRange) {
return this.coerceIn<ULong>(range)
@@ -21,8 +21,8 @@ import kotlin.random.*
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("sumOfUInt")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Sequence<UInt>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -37,8 +37,8 @@ public fun Sequence<UInt>.sum(): UInt {
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("sumOfULong")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Sequence<ULong>.sum(): ULong {
var sum: ULong = 0uL
for (element in this) {
@@ -53,8 +53,8 @@ public fun Sequence<ULong>.sum(): ULong {
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("sumOfUByte")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Sequence<UByte>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
@@ -69,8 +69,8 @@ public fun Sequence<UByte>.sum(): UInt {
* The operation is _terminal_.
*/
@kotlin.jvm.JvmName("sumOfUShort")
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Sequence<UShort>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {