Migrate deprecations in core, compiler, idea, tests
Replacing deprecated Char.toInt() with Char.code and Number.toChar() with Number.toInt().toChar(), where Number is not Int. KT-23451
This commit is contained in:
+2
-2
@@ -82,8 +82,8 @@ internal class CharProgressionType(symbols: Symbols<CommonBackendContext>) :
|
||||
ProgressionType(
|
||||
elementClass = symbols.char.owner,
|
||||
stepClass = symbols.int.owner,
|
||||
minValueAsLong = Char.MIN_VALUE.toLong(),
|
||||
maxValueAsLong = Char.MAX_VALUE.toLong(),
|
||||
minValueAsLong = Char.MIN_VALUE.code.toLong(),
|
||||
maxValueAsLong = Char.MAX_VALUE.code.toLong(),
|
||||
// Uses `getProgressionLastElement(Int, Int, Int): Int`
|
||||
getProgressionLastElementFunction = symbols.getProgressionLastElementByReturnType[symbols.int]
|
||||
) {
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ internal val IrExpression.canHaveSideEffects: Boolean
|
||||
private fun Any?.toLong(): Long? =
|
||||
when (this) {
|
||||
is Number -> toLong()
|
||||
is Char -> toLong()
|
||||
is Char -> code.toLong()
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ class ConstTransformer(private val context: JsIrBackendContext) : IrElementTrans
|
||||
}
|
||||
return when {
|
||||
expression.kind is IrConstKind.Char ->
|
||||
lowerConst(charClassSymbol, IrConstImpl.Companion::int, IrConstKind.Char.valueOf(expression).toInt())
|
||||
lowerConst(charClassSymbol, IrConstImpl.Companion::int, IrConstKind.Char.valueOf(expression).code)
|
||||
|
||||
expression.kind is IrConstKind.Long ->
|
||||
createLong(IrConstKind.Long.valueOf(expression))
|
||||
|
||||
+2
-2
@@ -736,7 +736,7 @@ class ExpressionCodegen(
|
||||
private fun isDefaultValueForType(type: Type, value: Any?): Boolean =
|
||||
when (type) {
|
||||
Type.BOOLEAN_TYPE -> value is Boolean && !value
|
||||
Type.CHAR_TYPE -> value is Char && value.toInt() == 0
|
||||
Type.CHAR_TYPE -> value is Char && value.code == 0
|
||||
Type.BYTE_TYPE, Type.SHORT_TYPE, Type.INT_TYPE, Type.LONG_TYPE -> value is Number && value.toLong() == 0L
|
||||
// Must use `equals` for these two to differentiate between +0.0 and -0.0:
|
||||
Type.FLOAT_TYPE -> value is Number && value.toFloat().equals(0.0f)
|
||||
@@ -836,7 +836,7 @@ class ExpressionCodegen(
|
||||
mv.nop()
|
||||
return BooleanConstant(this, value)
|
||||
}
|
||||
is Char -> mv.iconst(value.toInt())
|
||||
is Char -> mv.iconst(value.code)
|
||||
is Long -> mv.lconst(value)
|
||||
is Float -> mv.fconst(value)
|
||||
is Double -> mv.dconst(value)
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
|
||||
is IrConstKind.Short -> body.buildConstI32(kind.valueOf(expression).toInt())
|
||||
is IrConstKind.Int -> body.buildConstI32(kind.valueOf(expression))
|
||||
is IrConstKind.Long -> body.buildConstI64(kind.valueOf(expression))
|
||||
is IrConstKind.Char -> body.buildConstI32(kind.valueOf(expression).toInt())
|
||||
is IrConstKind.Char -> body.buildConstI32(kind.valueOf(expression).code)
|
||||
is IrConstKind.Float -> body.buildConstF32(kind.valueOf(expression))
|
||||
is IrConstKind.Double -> body.buildConstF64(kind.valueOf(expression))
|
||||
is IrConstKind.String -> {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.ir.interpreter.state.*
|
||||
|
||||
/** This file is generated by org.jetbrains.kotlin.backend.common.interpreter.builtins.GenerateBuiltInsMap.generateMap(). DO NOT MODIFY MANUALLY */
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Boolean>("hashCode", "Boolean") { a -> a.hashCode() },
|
||||
unaryOperation<Boolean>("not", "Boolean") { a -> a.not() },
|
||||
|
||||
+1
-1
@@ -580,7 +580,7 @@ open class IrFileSerializer(
|
||||
IrConstKind.Null -> proto.`null` = true
|
||||
IrConstKind.Boolean -> proto.boolean = value.value as Boolean
|
||||
IrConstKind.Byte -> proto.byte = (value.value as Byte).toInt()
|
||||
IrConstKind.Char -> proto.char = (value.value as Char).toInt()
|
||||
IrConstKind.Char -> proto.char = (value.value as Char).code
|
||||
IrConstKind.Short -> proto.short = (value.value as Short).toInt()
|
||||
IrConstKind.Int -> proto.int = value.value as Int
|
||||
IrConstKind.Long -> proto.long = value.value as Long
|
||||
|
||||
Reference in New Issue
Block a user