Suppress code warnings in kotlin-stdlib

This commit is contained in:
Alexander Udalov
2020-08-13 19:13:31 +02:00
parent 5ef4f7df5a
commit da6d904c6e
32 changed files with 62 additions and 18 deletions
@@ -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<Double>() === obj) {
return obj.toInt()
}
@@ -117,5 +117,5 @@ internal external class JsObject {
}
}
internal fun <T, R> boxIntrinsic(x: T): R = error("Should be lowered")
internal fun <T, R> unboxIntrinsic(x: T): R = error("Should be lowered")
internal fun <T, R> boxIntrinsic(@Suppress("UNUSED_PARAMETER") x: T): R = error("Should be lowered")
internal fun <T, R> unboxIntrinsic(@Suppress("UNUSED_PARAMETER") x: T): R = error("Should be lowered")
@@ -10,5 +10,5 @@ internal fun <T : Enum<T>> enumValuesIntrinsic(): Array<T> =
throw IllegalStateException("Should be replaced by compiler")
@PublishedApi
internal fun <T : Enum<T>> enumValueOfIntrinsic(name: String): T =
internal fun <T : Enum<T>> enumValueOfIntrinsic(@Suppress("UNUSED_PARAMETER") name: String): T =
throw IllegalStateException("Should be replaced by compiler")
+2
View File
@@ -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
/**
+3
View File
@@ -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
@@ -51,6 +51,7 @@ internal fun <T> taggedArrayCopy(array: dynamic): T {
}
@PublishedApi
@Suppress("NOTHING_TO_INLINE")
internal inline fun withType(type: String, array: dynamic): dynamic {
array.`$type$` = type
return array
@@ -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<Double>()
internal fun numberToDouble(@Suppress("UNUSED_PARAMETER") a: dynamic): Double = js("+a").unsafeCast<Double>()
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<Byte>()
internal fun toShort(a: dynamic): Short = js("a << 16 >> 16").unsafeCast<Short>()
internal fun toByte(@Suppress("UNUSED_PARAMETER") a: dynamic): Byte = js("a << 24 >> 24").unsafeCast<Byte>()
internal fun toShort(@Suppress("UNUSED_PARAMETER") a: dynamic): Short = js("a << 16 >> 16").unsafeCast<Short>()
internal fun numberToLong(a: dynamic): Long = if (a is Long) a else fromNumber(a)
@@ -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<Array<dynamic>> = arrayOf<Array<dynamic>>(
// immutable , mutable
@@ -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<Int>() === arity
}
@@ -106,7 +107,7 @@ internal fun isArrayish(o: dynamic) =
isJsArray(o) || js("ArrayBuffer").isView(o).unsafeCast<Boolean>()
internal fun isChar(c: Any): Boolean {
internal fun isChar(@Suppress("UNUSED_PARAMETER") c: Any): Boolean {
error("isChar is not implemented")
}