Skip to content

Commit 47c2e5f

Browse files
ilya-gSpace Team
authored and
Space Team
committed
[stdlib] Workaround KT-46360 by removing @ORBLRT from Int/UInt overloads
1 parent 36ffa2e commit 47c2e5f

File tree

7 files changed

+6
-67
lines changed

7 files changed

+6
-67
lines changed

libraries/stdlib/common/src/generated/_Arrays.kt

-36
Original file line numberDiff line numberDiff line change
@@ -23049,8 +23049,6 @@ public inline fun CharArray.sumOf(selector: (Char) -> Double): Double {
2304923049
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2305023050
*/
2305123051
@SinceKotlin("1.4")
23052-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23053-
@OverloadResolutionByLambdaReturnType
2305423052
@kotlin.jvm.JvmName("sumOfInt")
2305523053
@kotlin.internal.InlineOnly
2305623054
public inline fun <T> Array<out T>.sumOf(selector: (T) -> Int): Int {
@@ -23065,8 +23063,6 @@ public inline fun <T> Array<out T>.sumOf(selector: (T) -> Int): Int {
2306523063
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2306623064
*/
2306723065
@SinceKotlin("1.4")
23068-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23069-
@OverloadResolutionByLambdaReturnType
2307023066
@kotlin.jvm.JvmName("sumOfInt")
2307123067
@kotlin.internal.InlineOnly
2307223068
public inline fun ByteArray.sumOf(selector: (Byte) -> Int): Int {
@@ -23081,8 +23077,6 @@ public inline fun ByteArray.sumOf(selector: (Byte) -> Int): Int {
2308123077
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2308223078
*/
2308323079
@SinceKotlin("1.4")
23084-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23085-
@OverloadResolutionByLambdaReturnType
2308623080
@kotlin.jvm.JvmName("sumOfInt")
2308723081
@kotlin.internal.InlineOnly
2308823082
public inline fun ShortArray.sumOf(selector: (Short) -> Int): Int {
@@ -23097,8 +23091,6 @@ public inline fun ShortArray.sumOf(selector: (Short) -> Int): Int {
2309723091
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2309823092
*/
2309923093
@SinceKotlin("1.4")
23100-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23101-
@OverloadResolutionByLambdaReturnType
2310223094
@kotlin.jvm.JvmName("sumOfInt")
2310323095
@kotlin.internal.InlineOnly
2310423096
public inline fun IntArray.sumOf(selector: (Int) -> Int): Int {
@@ -23113,8 +23105,6 @@ public inline fun IntArray.sumOf(selector: (Int) -> Int): Int {
2311323105
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2311423106
*/
2311523107
@SinceKotlin("1.4")
23116-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23117-
@OverloadResolutionByLambdaReturnType
2311823108
@kotlin.jvm.JvmName("sumOfInt")
2311923109
@kotlin.internal.InlineOnly
2312023110
public inline fun LongArray.sumOf(selector: (Long) -> Int): Int {
@@ -23129,8 +23119,6 @@ public inline fun LongArray.sumOf(selector: (Long) -> Int): Int {
2312923119
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2313023120
*/
2313123121
@SinceKotlin("1.4")
23132-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23133-
@OverloadResolutionByLambdaReturnType
2313423122
@kotlin.jvm.JvmName("sumOfInt")
2313523123
@kotlin.internal.InlineOnly
2313623124
public inline fun FloatArray.sumOf(selector: (Float) -> Int): Int {
@@ -23145,8 +23133,6 @@ public inline fun FloatArray.sumOf(selector: (Float) -> Int): Int {
2314523133
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2314623134
*/
2314723135
@SinceKotlin("1.4")
23148-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23149-
@OverloadResolutionByLambdaReturnType
2315023136
@kotlin.jvm.JvmName("sumOfInt")
2315123137
@kotlin.internal.InlineOnly
2315223138
public inline fun DoubleArray.sumOf(selector: (Double) -> Int): Int {
@@ -23161,8 +23147,6 @@ public inline fun DoubleArray.sumOf(selector: (Double) -> Int): Int {
2316123147
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2316223148
*/
2316323149
@SinceKotlin("1.4")
23164-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23165-
@OverloadResolutionByLambdaReturnType
2316623150
@kotlin.jvm.JvmName("sumOfInt")
2316723151
@kotlin.internal.InlineOnly
2316823152
public inline fun BooleanArray.sumOf(selector: (Boolean) -> Int): Int {
@@ -23177,8 +23161,6 @@ public inline fun BooleanArray.sumOf(selector: (Boolean) -> Int): Int {
2317723161
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2317823162
*/
2317923163
@SinceKotlin("1.4")
23180-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23181-
@OverloadResolutionByLambdaReturnType
2318223164
@kotlin.jvm.JvmName("sumOfInt")
2318323165
@kotlin.internal.InlineOnly
2318423166
public inline fun CharArray.sumOf(selector: (Char) -> Int): Int {
@@ -23337,8 +23319,6 @@ public inline fun CharArray.sumOf(selector: (Char) -> Long): Long {
2333723319
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2333823320
*/
2333923321
@SinceKotlin("1.5")
23340-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23341-
@OverloadResolutionByLambdaReturnType
2334223322
@kotlin.jvm.JvmName("sumOfUInt")
2334323323
@WasExperimental(ExperimentalUnsignedTypes::class)
2334423324
@kotlin.internal.InlineOnly
@@ -23354,8 +23334,6 @@ public inline fun <T> Array<out T>.sumOf(selector: (T) -> UInt): UInt {
2335423334
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2335523335
*/
2335623336
@SinceKotlin("1.5")
23357-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23358-
@OverloadResolutionByLambdaReturnType
2335923337
@kotlin.jvm.JvmName("sumOfUInt")
2336023338
@WasExperimental(ExperimentalUnsignedTypes::class)
2336123339
@kotlin.internal.InlineOnly
@@ -23371,8 +23349,6 @@ public inline fun ByteArray.sumOf(selector: (Byte) -> UInt): UInt {
2337123349
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2337223350
*/
2337323351
@SinceKotlin("1.5")
23374-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23375-
@OverloadResolutionByLambdaReturnType
2337623352
@kotlin.jvm.JvmName("sumOfUInt")
2337723353
@WasExperimental(ExperimentalUnsignedTypes::class)
2337823354
@kotlin.internal.InlineOnly
@@ -23388,8 +23364,6 @@ public inline fun ShortArray.sumOf(selector: (Short) -> UInt): UInt {
2338823364
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2338923365
*/
2339023366
@SinceKotlin("1.5")
23391-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23392-
@OverloadResolutionByLambdaReturnType
2339323367
@kotlin.jvm.JvmName("sumOfUInt")
2339423368
@WasExperimental(ExperimentalUnsignedTypes::class)
2339523369
@kotlin.internal.InlineOnly
@@ -23405,8 +23379,6 @@ public inline fun IntArray.sumOf(selector: (Int) -> UInt): UInt {
2340523379
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2340623380
*/
2340723381
@SinceKotlin("1.5")
23408-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23409-
@OverloadResolutionByLambdaReturnType
2341023382
@kotlin.jvm.JvmName("sumOfUInt")
2341123383
@WasExperimental(ExperimentalUnsignedTypes::class)
2341223384
@kotlin.internal.InlineOnly
@@ -23422,8 +23394,6 @@ public inline fun LongArray.sumOf(selector: (Long) -> UInt): UInt {
2342223394
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2342323395
*/
2342423396
@SinceKotlin("1.5")
23425-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23426-
@OverloadResolutionByLambdaReturnType
2342723397
@kotlin.jvm.JvmName("sumOfUInt")
2342823398
@WasExperimental(ExperimentalUnsignedTypes::class)
2342923399
@kotlin.internal.InlineOnly
@@ -23439,8 +23409,6 @@ public inline fun FloatArray.sumOf(selector: (Float) -> UInt): UInt {
2343923409
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2344023410
*/
2344123411
@SinceKotlin("1.5")
23442-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23443-
@OverloadResolutionByLambdaReturnType
2344423412
@kotlin.jvm.JvmName("sumOfUInt")
2344523413
@WasExperimental(ExperimentalUnsignedTypes::class)
2344623414
@kotlin.internal.InlineOnly
@@ -23456,8 +23424,6 @@ public inline fun DoubleArray.sumOf(selector: (Double) -> UInt): UInt {
2345623424
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2345723425
*/
2345823426
@SinceKotlin("1.5")
23459-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23460-
@OverloadResolutionByLambdaReturnType
2346123427
@kotlin.jvm.JvmName("sumOfUInt")
2346223428
@WasExperimental(ExperimentalUnsignedTypes::class)
2346323429
@kotlin.internal.InlineOnly
@@ -23473,8 +23439,6 @@ public inline fun BooleanArray.sumOf(selector: (Boolean) -> UInt): UInt {
2347323439
* Returns the sum of all values produced by [selector] function applied to each element in the array.
2347423440
*/
2347523441
@SinceKotlin("1.5")
23476-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
23477-
@OverloadResolutionByLambdaReturnType
2347823442
@kotlin.jvm.JvmName("sumOfUInt")
2347923443
@WasExperimental(ExperimentalUnsignedTypes::class)
2348023444
@kotlin.internal.InlineOnly

libraries/stdlib/common/src/generated/_Collections.kt

-4
Original file line numberDiff line numberDiff line change
@@ -3130,8 +3130,6 @@ public inline fun <T> Iterable<T>.sumOf(selector: (T) -> Double): Double {
31303130
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
31313131
*/
31323132
@SinceKotlin("1.4")
3133-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
3134-
@OverloadResolutionByLambdaReturnType
31353133
@kotlin.jvm.JvmName("sumOfInt")
31363134
@kotlin.internal.InlineOnly
31373135
public inline fun <T> Iterable<T>.sumOf(selector: (T) -> Int): Int {
@@ -3162,8 +3160,6 @@ public inline fun <T> Iterable<T>.sumOf(selector: (T) -> Long): Long {
31623160
* Returns the sum of all values produced by [selector] function applied to each element in the collection.
31633161
*/
31643162
@SinceKotlin("1.5")
3165-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
3166-
@OverloadResolutionByLambdaReturnType
31673163
@kotlin.jvm.JvmName("sumOfUInt")
31683164
@WasExperimental(ExperimentalUnsignedTypes::class)
31693165
@kotlin.internal.InlineOnly

libraries/stdlib/common/src/generated/_Sequences.kt

-4
Original file line numberDiff line numberDiff line change
@@ -2611,8 +2611,6 @@ public inline fun <T> Sequence<T>.sumOf(selector: (T) -> Double): Double {
26112611
* The operation is _terminal_.
26122612
*/
26132613
@SinceKotlin("1.4")
2614-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
2615-
@OverloadResolutionByLambdaReturnType
26162614
@kotlin.jvm.JvmName("sumOfInt")
26172615
@kotlin.internal.InlineOnly
26182616
public inline fun <T> Sequence<T>.sumOf(selector: (T) -> Int): Int {
@@ -2647,8 +2645,6 @@ public inline fun <T> Sequence<T>.sumOf(selector: (T) -> Long): Long {
26472645
* The operation is _terminal_.
26482646
*/
26492647
@SinceKotlin("1.5")
2650-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
2651-
@OverloadResolutionByLambdaReturnType
26522648
@kotlin.jvm.JvmName("sumOfUInt")
26532649
@WasExperimental(ExperimentalUnsignedTypes::class)
26542650
@kotlin.internal.InlineOnly

libraries/stdlib/common/src/generated/_Strings.kt

-4
Original file line numberDiff line numberDiff line change
@@ -2226,8 +2226,6 @@ public inline fun CharSequence.sumOf(selector: (Char) -> Double): Double {
22262226
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
22272227
*/
22282228
@SinceKotlin("1.4")
2229-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
2230-
@OverloadResolutionByLambdaReturnType
22312229
@kotlin.jvm.JvmName("sumOfInt")
22322230
@kotlin.internal.InlineOnly
22332231
public inline fun CharSequence.sumOf(selector: (Char) -> Int): Int {
@@ -2258,8 +2256,6 @@ public inline fun CharSequence.sumOf(selector: (Char) -> Long): Long {
22582256
* Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
22592257
*/
22602258
@SinceKotlin("1.5")
2261-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
2262-
@OverloadResolutionByLambdaReturnType
22632259
@kotlin.jvm.JvmName("sumOfUInt")
22642260
@WasExperimental(ExperimentalUnsignedTypes::class)
22652261
@kotlin.internal.InlineOnly

libraries/stdlib/common/src/generated/_UArrays.kt

-16
Original file line numberDiff line numberDiff line change
@@ -10331,8 +10331,6 @@ public inline fun UShortArray.sumOf(selector: (UShort) -> Double): Double {
1033110331
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1033210332
*/
1033310333
@SinceKotlin("1.4")
10334-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10335-
@OverloadResolutionByLambdaReturnType
1033610334
@Suppress("INAPPLICABLE_JVM_NAME")
1033710335
@kotlin.jvm.JvmName("sumOfInt")
1033810336
@ExperimentalUnsignedTypes
@@ -10349,8 +10347,6 @@ public inline fun UIntArray.sumOf(selector: (UInt) -> Int): Int {
1034910347
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1035010348
*/
1035110349
@SinceKotlin("1.4")
10352-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10353-
@OverloadResolutionByLambdaReturnType
1035410350
@Suppress("INAPPLICABLE_JVM_NAME")
1035510351
@kotlin.jvm.JvmName("sumOfInt")
1035610352
@ExperimentalUnsignedTypes
@@ -10367,8 +10363,6 @@ public inline fun ULongArray.sumOf(selector: (ULong) -> Int): Int {
1036710363
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1036810364
*/
1036910365
@SinceKotlin("1.4")
10370-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10371-
@OverloadResolutionByLambdaReturnType
1037210366
@Suppress("INAPPLICABLE_JVM_NAME")
1037310367
@kotlin.jvm.JvmName("sumOfInt")
1037410368
@ExperimentalUnsignedTypes
@@ -10385,8 +10379,6 @@ public inline fun UByteArray.sumOf(selector: (UByte) -> Int): Int {
1038510379
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1038610380
*/
1038710381
@SinceKotlin("1.4")
10388-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10389-
@OverloadResolutionByLambdaReturnType
1039010382
@Suppress("INAPPLICABLE_JVM_NAME")
1039110383
@kotlin.jvm.JvmName("sumOfInt")
1039210384
@ExperimentalUnsignedTypes
@@ -10475,8 +10467,6 @@ public inline fun UShortArray.sumOf(selector: (UShort) -> Long): Long {
1047510467
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1047610468
*/
1047710469
@SinceKotlin("1.5")
10478-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10479-
@OverloadResolutionByLambdaReturnType
1048010470
@Suppress("INAPPLICABLE_JVM_NAME")
1048110471
@kotlin.jvm.JvmName("sumOfUInt")
1048210472
@ExperimentalUnsignedTypes
@@ -10494,8 +10484,6 @@ public inline fun UIntArray.sumOf(selector: (UInt) -> UInt): UInt {
1049410484
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1049510485
*/
1049610486
@SinceKotlin("1.5")
10497-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10498-
@OverloadResolutionByLambdaReturnType
1049910487
@Suppress("INAPPLICABLE_JVM_NAME")
1050010488
@kotlin.jvm.JvmName("sumOfUInt")
1050110489
@ExperimentalUnsignedTypes
@@ -10513,8 +10501,6 @@ public inline fun ULongArray.sumOf(selector: (ULong) -> UInt): UInt {
1051310501
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1051410502
*/
1051510503
@SinceKotlin("1.5")
10516-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10517-
@OverloadResolutionByLambdaReturnType
1051810504
@Suppress("INAPPLICABLE_JVM_NAME")
1051910505
@kotlin.jvm.JvmName("sumOfUInt")
1052010506
@ExperimentalUnsignedTypes
@@ -10532,8 +10518,6 @@ public inline fun UByteArray.sumOf(selector: (UByte) -> UInt): UInt {
1053210518
* Returns the sum of all values produced by [selector] function applied to each element in the array.
1053310519
*/
1053410520
@SinceKotlin("1.5")
10535-
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10536-
@OverloadResolutionByLambdaReturnType
1053710521
@Suppress("INAPPLICABLE_JVM_NAME")
1053810522
@kotlin.jvm.JvmName("sumOfUInt")
1053910523
@ExperimentalUnsignedTypes

libraries/stdlib/test/collections/CollectionTest.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,8 @@ class CollectionTest {
994994
val items = listOf("", "a", "bc", "de", "fgh", "klmnop")
995995
assertEquals(items.size + 14, items.sumOf { it.length + 1 })
996996
assertEquals(14L, items.sumOf { it.length.toLong() })
997-
assertEquals(items.size.toUInt(), items.sumOf { 1U.toUInt() })
997+
assertEquals(0, items.sumOf { if (it.any { c -> c in "aeiou" }) 1 else -1 })
998+
assertEquals(items.size.toUInt(), items.sumOf { 1U })
998999
assertEquals(14UL, items.sumOf { it.length.toULong() })
9991000
assertEquals(14.0, items.sumOf { it.length.toDouble() })
10001001
assertEquals(Double.NaN, items.sumOf { 0.0 / it.length })

libraries/tools/kotlin-stdlib-gen/src/templates/Aggregates.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,10 @@ object Aggregates : TemplateGroupBase() {
268268
selectorType.startsWith("java") -> selectorType.substringAfterLast('.')
269269
else -> selectorType
270270
}
271-
annotation("@OptIn(kotlin.experimental.ExperimentalTypeInference::class)")
272-
annotation("@OverloadResolutionByLambdaReturnType")
271+
if (selectorType !in listOf("Int", "UInt")) {
272+
annotation("@OptIn(kotlin.experimental.ExperimentalTypeInference::class)")
273+
annotation("@OverloadResolutionByLambdaReturnType")
274+
}
273275
specialFor(ArraysOfUnsigned) {
274276
annotation("""@Suppress("INAPPLICABLE_JVM_NAME")""")
275277
}

0 commit comments

Comments
 (0)