diff --git a/core/builtins/native/kotlin/Collections.kt b/core/builtins/native/kotlin/Collections.kt index caf6ab6212c..21aa2ec5f7e 100644 --- a/core/builtins/native/kotlin/Collections.kt +++ b/core/builtins/native/kotlin/Collections.kt @@ -328,7 +328,7 @@ public interface Map { @PlatformDependent public fun getOrDefault(key: K, defaultValue: @UnsafeVariance V): V { // See default implementation in JDK sources - return null as V + throw NotImplementedError() } // Views diff --git a/libraries/stdlib/common/src/kotlin/ExceptionsH.kt b/libraries/stdlib/common/src/kotlin/ExceptionsH.kt index b065e0bbe9e..ca8bc154580 100644 --- a/libraries/stdlib/common/src/kotlin/ExceptionsH.kt +++ b/libraries/stdlib/common/src/kotlin/ExceptionsH.kt @@ -138,6 +138,7 @@ public expect fun Throwable.stackTraceToString(): String * Prints the [detailed description][Throwable.stackTraceToString] of this throwable to the standard output or standard error output. */ @SinceKotlin("1.4") +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") public expect fun Throwable.printStackTrace(): Unit /** diff --git a/libraries/stdlib/js-ir/builtins/Boolean.kt b/libraries/stdlib/js-ir/builtins/Boolean.kt index 8cf8aed0a9e..aab0b3c7443 100644 --- a/libraries/stdlib/js-ir/builtins/Boolean.kt +++ b/libraries/stdlib/js-ir/builtins/Boolean.kt @@ -3,7 +3,7 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -@file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY") +@file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "UNUSED_PARAMETER") package kotlin diff --git a/libraries/stdlib/js-ir/builtins/Char.kt b/libraries/stdlib/js-ir/builtins/Char.kt index e6fb5a9a74d..cadd8e8ddbb 100644 --- a/libraries/stdlib/js-ir/builtins/Char.kt +++ b/libraries/stdlib/js-ir/builtins/Char.kt @@ -53,6 +53,7 @@ public class Char internal constructor(private val value: Int) : Comparable { * On the JVM, non-nullable values of this type are represented as values of the primitive type `float`. */ public class Float private constructor() : Number(), Comparable { + @Suppress("DIVISION_BY_ZERO") companion object { /** * A constant holding the smallest *positive* nonzero value of Float. @@ -893,6 +894,7 @@ public class Float private constructor() : Number(), Comparable { * On the JVM, non-nullable values of this type are represented as values of the primitive type `double`. */ public class Double private constructor() : Number(), Comparable { + @Suppress("DIVISION_BY_ZERO") companion object { /** * A constant holding the smallest *positive* nonzero value of Double. diff --git a/libraries/stdlib/js-ir/builtins/String.kt b/libraries/stdlib/js-ir/builtins/String.kt index 7d3c2bc7afb..465c73111ec 100644 --- a/libraries/stdlib/js-ir/builtins/String.kt +++ b/libraries/stdlib/js-ir/builtins/String.kt @@ -3,7 +3,7 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -@file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "MUST_BE_INITIALIZED_OR_BE_ABSTRACT") +@file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "MUST_BE_INITIALIZED_OR_BE_ABSTRACT", "UNUSED_PARAMETER") package kotlin diff --git a/libraries/stdlib/js-ir/runtime/bitUtils.kt b/libraries/stdlib/js-ir/runtime/bitUtils.kt index c37bf6cf68a..25af2ae812b 100644 --- a/libraries/stdlib/js-ir/runtime/bitUtils.kt +++ b/libraries/stdlib/js-ir/runtime/bitUtils.kt @@ -53,6 +53,7 @@ internal fun doubleSignBit(value: Double): Int { } internal fun getNumberHashCode(obj: Double): Int { + @Suppress("DEPRECATED_IDENTITY_EQUALS") if (jsBitwiseOr(obj, 0).unsafeCast() === obj) { return obj.toInt() } diff --git a/libraries/stdlib/js-ir/runtime/coreRuntime.kt b/libraries/stdlib/js-ir/runtime/coreRuntime.kt index 445e5ed0827..ff6c3db9c48 100644 --- a/libraries/stdlib/js-ir/runtime/coreRuntime.kt +++ b/libraries/stdlib/js-ir/runtime/coreRuntime.kt @@ -117,5 +117,5 @@ internal external class JsObject { } } -internal fun boxIntrinsic(x: T): R = error("Should be lowered") -internal fun unboxIntrinsic(x: T): R = error("Should be lowered") +internal fun boxIntrinsic(@Suppress("UNUSED_PARAMETER") x: T): R = error("Should be lowered") +internal fun unboxIntrinsic(@Suppress("UNUSED_PARAMETER") x: T): R = error("Should be lowered") diff --git a/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt b/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt index d484da5b996..d9cebb5b850 100644 --- a/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt +++ b/libraries/stdlib/js-ir/runtime/kotlinJsHacks.kt @@ -10,5 +10,5 @@ internal fun > enumValuesIntrinsic(): Array = throw IllegalStateException("Should be replaced by compiler") @PublishedApi -internal fun > enumValueOfIntrinsic(name: String): T = +internal fun > enumValueOfIntrinsic(@Suppress("UNUSED_PARAMETER") name: String): T = throw IllegalStateException("Should be replaced by compiler") diff --git a/libraries/stdlib/js-ir/runtime/long.kt b/libraries/stdlib/js-ir/runtime/long.kt index a0a39499c6c..72105220b8e 100644 --- a/libraries/stdlib/js-ir/runtime/long.kt +++ b/libraries/stdlib/js-ir/runtime/long.kt @@ -3,6 +3,8 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:Suppress("NOTHING_TO_INLINE") + package kotlin /** diff --git a/libraries/stdlib/js-ir/runtime/longjs.kt b/libraries/stdlib/js-ir/runtime/longjs.kt index c006f998515..6f9d35a5d58 100644 --- a/libraries/stdlib/js-ir/runtime/longjs.kt +++ b/libraries/stdlib/js-ir/runtime/longjs.kt @@ -286,6 +286,7 @@ internal fun Long.divide(other: Long): Long { internal fun Long.modulo(other: Long) = subtract(div(other).multiply(other)) internal fun Long.shiftLeft(numBits: Int): Long { + @Suppress("NAME_SHADOWING") val numBits = numBits and 63 if (numBits == 0) { return this @@ -299,6 +300,7 @@ internal fun Long.shiftLeft(numBits: Int): Long { } internal fun Long.shiftRight(numBits: Int): Long { + @Suppress("NAME_SHADOWING") val numBits = numBits and 63 if (numBits == 0) { return this @@ -312,6 +314,7 @@ internal fun Long.shiftRight(numBits: Int): Long { } internal fun Long.shiftRightUnsigned(numBits: Int): Long { + @Suppress("NAME_SHADOWING") val numBits = numBits and 63 if (numBits == 0) { return this diff --git a/libraries/stdlib/js-ir/runtime/noPackageHacks.kt b/libraries/stdlib/js-ir/runtime/noPackageHacks.kt index 1cb463fd1e5..081a7855366 100644 --- a/libraries/stdlib/js-ir/runtime/noPackageHacks.kt +++ b/libraries/stdlib/js-ir/runtime/noPackageHacks.kt @@ -51,6 +51,7 @@ internal fun taggedArrayCopy(array: dynamic): T { } @PublishedApi +@Suppress("NOTHING_TO_INLINE") internal inline fun withType(type: String, array: dynamic): dynamic { array.`$type$` = type return array diff --git a/libraries/stdlib/js-ir/runtime/numberConversion.kt b/libraries/stdlib/js-ir/runtime/numberConversion.kt index 52452dffa50..398feddd214 100644 --- a/libraries/stdlib/js-ir/runtime/numberConversion.kt +++ b/libraries/stdlib/js-ir/runtime/numberConversion.kt @@ -7,15 +7,15 @@ package kotlin.js internal fun numberToByte(a: dynamic): Byte = toByte(numberToInt(a)) -internal fun numberToDouble(a: dynamic): Double = js("+a").unsafeCast() +internal fun numberToDouble(@Suppress("UNUSED_PARAMETER") a: dynamic): Double = js("+a").unsafeCast() internal fun numberToInt(a: dynamic): Int = if (a is Long) a.toInt() else doubleToInt(a) internal fun numberToShort(a: dynamic): Short = toShort(numberToInt(a)) // << and >> shifts are used to preserve sign of the number -internal fun toByte(a: dynamic): Byte = js("a << 24 >> 24").unsafeCast() -internal fun toShort(a: dynamic): Short = js("a << 16 >> 16").unsafeCast() +internal fun toByte(@Suppress("UNUSED_PARAMETER") a: dynamic): Byte = js("a << 24 >> 24").unsafeCast() +internal fun toShort(@Suppress("UNUSED_PARAMETER") a: dynamic): Short = js("a << 16 >> 16").unsafeCast() internal fun numberToLong(a: dynamic): Long = if (a is Long) a else fromNumber(a) diff --git a/libraries/stdlib/js-ir/runtime/reflectRuntime.kt b/libraries/stdlib/js-ir/runtime/reflectRuntime.kt index 7bbe307ac02..5832af4bb62 100644 --- a/libraries/stdlib/js-ir/runtime/reflectRuntime.kt +++ b/libraries/stdlib/js-ir/runtime/reflectRuntime.kt @@ -33,7 +33,8 @@ private fun getKPropMetadata(paramCount: Int, setter: Any?, type: dynamic): dyna return mdata } -inline private fun metadataObject(): dynamic = js("{ kind: 'class', interfaces: [] }") +@Suppress("NOTHING_TO_INLINE") +private inline fun metadataObject(): dynamic = js("{ kind: 'class', interfaces: [] }") private val propertyRefClassMetadataCache: Array> = arrayOf>( // immutable , mutable diff --git a/libraries/stdlib/js-ir/runtime/typeCheckUtils.kt b/libraries/stdlib/js-ir/runtime/typeCheckUtils.kt index 0b8ff0d96ed..af031531ce5 100644 --- a/libraries/stdlib/js-ir/runtime/typeCheckUtils.kt +++ b/libraries/stdlib/js-ir/runtime/typeCheckUtils.kt @@ -76,6 +76,7 @@ public fun isInterface(ctor: dynamic, IType: dynamic): Boolean { internal fun isSuspendFunction(obj: dynamic, arity: Int): Boolean { if (jsTypeOf(obj) == "function") { + @Suppress("DEPRECATED_IDENTITY_EQUALS") return obj.`$arity`.unsafeCast() === arity } @@ -106,7 +107,7 @@ internal fun isArrayish(o: dynamic) = isJsArray(o) || js("ArrayBuffer").isView(o).unsafeCast() -internal fun isChar(c: Any): Boolean { +internal fun isChar(@Suppress("UNUSED_PARAMETER") c: Any): Boolean { error("isChar is not implemented") } diff --git a/libraries/stdlib/js-ir/src/generated/_ArraysJs.kt b/libraries/stdlib/js-ir/src/generated/_ArraysJs.kt index c5a9796926a..81bc399d1a8 100644 --- a/libraries/stdlib/js-ir/src/generated/_ArraysJs.kt +++ b/libraries/stdlib/js-ir/src/generated/_ArraysJs.kt @@ -173,10 +173,12 @@ public actual fun CharArray.asList(): List { return this@asList[index] } override fun indexOf(element: Char): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is Char) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: Char): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is Char) return -1 return this@asList.lastIndexOf(element) } diff --git a/libraries/stdlib/js-ir/src/generated/_UArraysJs.kt b/libraries/stdlib/js-ir/src/generated/_UArraysJs.kt index 460286120f6..7e3630eecf5 100644 --- a/libraries/stdlib/js-ir/src/generated/_UArraysJs.kt +++ b/libraries/stdlib/js-ir/src/generated/_UArraysJs.kt @@ -73,10 +73,12 @@ public actual fun UIntArray.asList(): List { return this@asList[index] } override fun indexOf(element: UInt): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UInt) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: UInt): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UInt) return -1 return this@asList.lastIndexOf(element) } @@ -98,10 +100,12 @@ public actual fun ULongArray.asList(): List { return this@asList[index] } override fun indexOf(element: ULong): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is ULong) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: ULong): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is ULong) return -1 return this@asList.lastIndexOf(element) } @@ -123,10 +127,12 @@ public actual fun UByteArray.asList(): List { return this@asList[index] } override fun indexOf(element: UByte): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UByte) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: UByte): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UByte) return -1 return this@asList.lastIndexOf(element) } @@ -148,10 +154,12 @@ public actual fun UShortArray.asList(): List { return this@asList[index] } override fun indexOf(element: UShort): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UShort) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: UShort): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UShort) return -1 return this@asList.lastIndexOf(element) } diff --git a/libraries/stdlib/js-v1/src/kotlin/builtins.kt b/libraries/stdlib/js-v1/src/kotlin/builtins.kt index c38350d7344..5c0598d8e76 100644 --- a/libraries/stdlib/js-v1/src/kotlin/builtins.kt +++ b/libraries/stdlib/js-v1/src/kotlin/builtins.kt @@ -96,7 +96,7 @@ internal fun subSequence(c: CharSequence, startIndex: Int, endIndex: Int): CharS } @JsName("captureStack") -internal fun captureStack(baseClass: JsClass, instance: Throwable) { +internal fun captureStack(@Suppress("UNUSED_PARAMETER") baseClass: JsClass, instance: Throwable) { if (js("Error").captureStackTrace) { // Using uncropped stack traces due to KT-37563. // Precise stack traces are implemented in JS IR compiler and stdlib diff --git a/libraries/stdlib/js-v1/src/kotlin/currentBeMisc.kt b/libraries/stdlib/js-v1/src/kotlin/currentBeMisc.kt index 44a23ca119e..a7741f1ef22 100644 --- a/libraries/stdlib/js-v1/src/kotlin/currentBeMisc.kt +++ b/libraries/stdlib/js-v1/src/kotlin/currentBeMisc.kt @@ -9,6 +9,8 @@ package kotlin.js // Used for js.translator/testData/box/number/mulInt32.kt @library @JsName("imulEmulated") +@Suppress("UNUSED_PARAMETER") internal fun imul(x: Int, y: Int): Int = definedExternally -internal inline fun isArrayish(o: dynamic) = js("Kotlin").isArrayish(o) \ No newline at end of file +@Suppress("NOTHING_TO_INLINE") +internal inline fun isArrayish(o: dynamic) = js("Kotlin").isArrayish(o) diff --git a/libraries/stdlib/js-v1/src/kotlin/numbers_js-v1.kt b/libraries/stdlib/js-v1/src/kotlin/numbers_js-v1.kt index 63f5eab72e7..54ca41a8bca 100644 --- a/libraries/stdlib/js-v1/src/kotlin/numbers_js-v1.kt +++ b/libraries/stdlib/js-v1/src/kotlin/numbers_js-v1.kt @@ -61,6 +61,7 @@ public actual fun Float.toRawBits(): Int = definedExternally public actual inline fun Float.Companion.fromBits(bits: Int): Float = js("Kotlin").floatFromBits(bits).unsafeCast() +@Suppress("NOTHING_TO_INLINE") internal inline fun Long(low: Int, high: Int) = js("Kotlin").Long.fromBits(low, high).unsafeCast() internal inline val Long.low: Int get() = this.asDynamic().getLowBits().unsafeCast() -internal inline val Long.high: Int get() = this.asDynamic().getHighBits().unsafeCast() \ No newline at end of file +internal inline val Long.high: Int get() = this.asDynamic().getHighBits().unsafeCast() diff --git a/libraries/stdlib/js-v1/src/kotlin/reflection_js-v1.kt b/libraries/stdlib/js-v1/src/kotlin/reflection_js-v1.kt index fa1a666848b..298d73a2aba 100644 --- a/libraries/stdlib/js-v1/src/kotlin/reflection_js-v1.kt +++ b/libraries/stdlib/js-v1/src/kotlin/reflection_js-v1.kt @@ -6,7 +6,7 @@ import kotlin.reflect.KClass @PublishedApi -internal fun KClass<*>.findAssociatedObject(annotationClass: KClass): Any? { +internal fun KClass<*>.findAssociatedObject(@Suppress("UNUSED_PARAMETER") annotationClass: KClass): Any? { // This API is not supported in js-v1. Return `null` to be source-compatible with js-ir. return null -} \ No newline at end of file +} diff --git a/libraries/stdlib/js/src/generated/_ArraysJs.kt b/libraries/stdlib/js/src/generated/_ArraysJs.kt index fe21624e672..dab9c3c7ee8 100644 --- a/libraries/stdlib/js/src/generated/_ArraysJs.kt +++ b/libraries/stdlib/js/src/generated/_ArraysJs.kt @@ -173,10 +173,12 @@ public actual fun CharArray.asList(): List { return this@asList[index] } override fun indexOf(element: Char): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is Char) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: Char): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is Char) return -1 return this@asList.lastIndexOf(element) } diff --git a/libraries/stdlib/js/src/generated/_UArraysJs.kt b/libraries/stdlib/js/src/generated/_UArraysJs.kt index 460286120f6..7e3630eecf5 100644 --- a/libraries/stdlib/js/src/generated/_UArraysJs.kt +++ b/libraries/stdlib/js/src/generated/_UArraysJs.kt @@ -73,10 +73,12 @@ public actual fun UIntArray.asList(): List { return this@asList[index] } override fun indexOf(element: UInt): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UInt) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: UInt): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UInt) return -1 return this@asList.lastIndexOf(element) } @@ -98,10 +100,12 @@ public actual fun ULongArray.asList(): List { return this@asList[index] } override fun indexOf(element: ULong): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is ULong) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: ULong): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is ULong) return -1 return this@asList.lastIndexOf(element) } @@ -123,10 +127,12 @@ public actual fun UByteArray.asList(): List { return this@asList[index] } override fun indexOf(element: UByte): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UByte) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: UByte): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UByte) return -1 return this@asList.lastIndexOf(element) } @@ -148,10 +154,12 @@ public actual fun UShortArray.asList(): List { return this@asList[index] } override fun indexOf(element: UShort): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UShort) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: UShort): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is UShort) return -1 return this@asList.lastIndexOf(element) } diff --git a/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt b/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt index 15ac6b98eaf..6419ced1609 100644 --- a/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt +++ b/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt @@ -125,7 +125,7 @@ private class TypeVariableImpl(private val typeParameter: KTypeParameter) : Type // [TypeVariable] extends [AnnotatedElement] starting from JDK 8. The following are copies of methods from there. // Suppression of VIRTUAL_MEMBER_HIDDEN is needed for cases when environment variable JDK_16 points to JDK 8+. - @Suppress("VIRTUAL_MEMBER_HIDDEN") + @Suppress("VIRTUAL_MEMBER_HIDDEN", "UNUSED_PARAMETER") fun getAnnotation(annotationClass: Class): T? = null @Suppress("VIRTUAL_MEMBER_HIDDEN") diff --git a/libraries/stdlib/src/kotlin/text/StringBuilder.kt b/libraries/stdlib/src/kotlin/text/StringBuilder.kt index 49a6c2b0332..a020f4acd2a 100644 --- a/libraries/stdlib/src/kotlin/text/StringBuilder.kt +++ b/libraries/stdlib/src/kotlin/text/StringBuilder.kt @@ -5,6 +5,7 @@ @file:kotlin.jvm.JvmMultifileClass @file:kotlin.jvm.JvmName("StringsKt") +@file:Suppress("EXTENSION_SHADOWED_BY_MEMBER") package kotlin.text diff --git a/libraries/stdlib/src/kotlin/util/Result.kt b/libraries/stdlib/src/kotlin/util/Result.kt index a2e519aebd9..ff701e6fd6a 100644 --- a/libraries/stdlib/src/kotlin/util/Result.kt +++ b/libraries/stdlib/src/kotlin/util/Result.kt @@ -299,7 +299,6 @@ public inline fun Result.recover(transform: (exception: Throwable) @InlineOnly @SinceKotlin("1.3") public inline fun Result.recoverCatching(transform: (exception: Throwable) -> R): Result { - val value = value // workaround for inline classes BE bug return when (val exception = exceptionOrNull()) { null -> this else -> runCatching { transform(exception) } diff --git a/libraries/stdlib/unsigned/src/kotlin/UByteArray.kt b/libraries/stdlib/unsigned/src/kotlin/UByteArray.kt index 6e78b9edd3d..65b0a9b4970 100644 --- a/libraries/stdlib/unsigned/src/kotlin/UByteArray.kt +++ b/libraries/stdlib/unsigned/src/kotlin/UByteArray.kt @@ -50,6 +50,7 @@ internal constructor(@PublishedApi internal val storage: ByteArray) : Collection override fun contains(element: UByte): Boolean { // TODO: Eliminate this check after KT-30016 gets fixed. // Currently JS BE does not generate special bridge method for this method. + @Suppress("USELESS_CAST") if ((element as Any?) !is UByte) return false return storage.contains(element.toByte()) diff --git a/libraries/stdlib/unsigned/src/kotlin/UIntArray.kt b/libraries/stdlib/unsigned/src/kotlin/UIntArray.kt index 6c6c0551473..89857ebef76 100644 --- a/libraries/stdlib/unsigned/src/kotlin/UIntArray.kt +++ b/libraries/stdlib/unsigned/src/kotlin/UIntArray.kt @@ -50,6 +50,7 @@ internal constructor(@PublishedApi internal val storage: IntArray) : Collection< override fun contains(element: UInt): Boolean { // TODO: Eliminate this check after KT-30016 gets fixed. // Currently JS BE does not generate special bridge method for this method. + @Suppress("USELESS_CAST") if ((element as Any?) !is UInt) return false return storage.contains(element.toInt()) diff --git a/libraries/stdlib/unsigned/src/kotlin/ULongArray.kt b/libraries/stdlib/unsigned/src/kotlin/ULongArray.kt index fd640df7033..4947e140da3 100644 --- a/libraries/stdlib/unsigned/src/kotlin/ULongArray.kt +++ b/libraries/stdlib/unsigned/src/kotlin/ULongArray.kt @@ -50,6 +50,7 @@ internal constructor(@PublishedApi internal val storage: LongArray) : Collection override fun contains(element: ULong): Boolean { // TODO: Eliminate this check after KT-30016 gets fixed. // Currently JS BE does not generate special bridge method for this method. + @Suppress("USELESS_CAST") if ((element as Any?) !is ULong) return false return storage.contains(element.toLong()) diff --git a/libraries/stdlib/unsigned/src/kotlin/UShortArray.kt b/libraries/stdlib/unsigned/src/kotlin/UShortArray.kt index 7f7cc6338ba..5c464c8a9cb 100644 --- a/libraries/stdlib/unsigned/src/kotlin/UShortArray.kt +++ b/libraries/stdlib/unsigned/src/kotlin/UShortArray.kt @@ -50,6 +50,7 @@ internal constructor(@PublishedApi internal val storage: ShortArray) : Collectio override fun contains(element: UShort): Boolean { // TODO: Eliminate this check after KT-30016 gets fixed. // Currently JS BE does not generate special bridge method for this method. + @Suppress("USELESS_CAST") if ((element as Any?) !is UShort) return false return storage.contains(element.toShort()) diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt index e063fea8f4b..c7899caff50 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Arrays.kt @@ -1509,10 +1509,12 @@ object ArrayOps : TemplateGroupBase() { return this@asList[index] } override fun indexOf(element: T): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is T) return -1 return this@asList.indexOf(element) } override fun lastIndexOf(element: T): Int { + @Suppress("USELESS_CAST") if ((element as Any?) !is T) return -1 return this@asList.lastIndexOf(element) }