Suppress code warnings in kotlin-stdlib
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public class Char internal constructor(private val value: Int) : Comparable<Char
|
||||
public fun toDouble(): Double = value.toDouble()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
@Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
|
||||
if (other === this) return true
|
||||
if (other !is Char) return false
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
import kotlin.internal.PureReifiable
|
||||
|
||||
@@ -676,6 +676,7 @@ public class Int private constructor() : Number(), Comparable<Int> {
|
||||
* 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<Float> {
|
||||
@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<Float> {
|
||||
* 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<Double> {
|
||||
@Suppress("DIVISION_BY_ZERO")
|
||||
companion object {
|
||||
/**
|
||||
* A constant holding the smallest *positive* nonzero value of Double.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -173,10 +173,12 @@ public actual fun CharArray.asList(): List<Char> {
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -73,10 +73,12 @@ public actual fun UIntArray.asList(): List<UInt> {
|
||||
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<ULong> {
|
||||
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<UByte> {
|
||||
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<UShort> {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user