[Stdlib] Deprecate and make open Number.toChar()

^KT-46465 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-02-21 12:53:58 +02:00
committed by Space Team
parent 90ec84d7b7
commit a64d8e8a31
30 changed files with 399 additions and 72 deletions
+8 -6
View File
@@ -214,7 +214,7 @@ public final class Byte : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Byte>|, R
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toByte(): R|kotlin/Byte|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5), errorSince = String(2.3)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toDouble(): R|kotlin/Double|
@@ -521,7 +521,7 @@ public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toByte(): R|kotlin/Byte|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5), errorSince = String(2.3)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toDouble(): R|kotlin/Double|
@@ -714,7 +714,7 @@ public final class Float : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Float>|,
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toByte(): R|kotlin/Byte|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5), errorSince = String(2.3)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toDouble(): R|kotlin/Double|
@@ -1049,7 +1049,7 @@ public final class Long : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Long>|, R
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toByte(): R|kotlin/Byte|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5), errorSince = String(2.3)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toDouble(): R|kotlin/Double|
@@ -1101,7 +1101,9 @@ public final class Nothing {
public abstract class Number : R|kotlin/Any|, R|java/io/Serializable| {
public abstract fun toByte(): R|kotlin/Byte|
public abstract fun toChar(): R|kotlin/Char|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.
If you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.
See https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.9), errorSince = String(2.3)) public open fun toChar(): R|kotlin/Char|
public abstract fun toDouble(): R|kotlin/Double|
@@ -1290,7 +1292,7 @@ public final class Short : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Short>|,
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toByte(): R|kotlin/Byte|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5), errorSince = String(2.3)) @R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toChar(): R|kotlin/Char|
@R|kotlin/internal/IntrinsicConstEvaluation|() public open fun toDouble(): R|kotlin/Double|
@@ -128,7 +128,7 @@ internal object FirToConstantValueTransformer : FirDefaultVisitor<ConstantValue<
"toShort" -> ShortValue((dispatchReceiverValue!!.value as Number).toShort())
"toFloat" -> FloatValue((dispatchReceiverValue!!.value as Number).toFloat())
"toDouble" -> DoubleValue((dispatchReceiverValue!!.value as Number).toDouble())
"toChar" -> CharValue((dispatchReceiverValue!!.value as Number).toChar())
"toChar" -> CharValue((dispatchReceiverValue!!.value as Number).toInt().toChar())
"unaryMinus" -> {
when (val receiverValue = dispatchReceiverValue) {
is ByteValue -> ByteValue((-receiverValue.value).toByte())
@@ -35293,6 +35293,24 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
@@ -35293,6 +35293,24 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
@@ -11,10 +11,16 @@ fun String.walkTopDown(f: (File) -> Unit) {
val root = File(this)
for (file in root.walkTopDown()) {
if (file.isDirectory) continue
if (file.path.contains("kotlin-native") ||
file.path.contains("testData") ||
file.path.contains("testdata") ||
file.path.contains("resources")) continue
val path = file.path
if (
path.contains("kotlin-native") ||
path.contains("testData") ||
path.contains("testdata") ||
path.contains("resources")
) continue
if (path.replace(File.separator, "/").contains("stdlib/api")) continue
if (file.extension != "kt") continue
f(file)
@@ -29,4 +35,4 @@ fun String.walkTopDownWithTestData(f: (File) -> Unit) {
f(file)
}
}
}
+8 -6
View File
@@ -104,7 +104,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte> {
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -287,7 +287,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -396,7 +396,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -579,7 +579,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -620,7 +620,9 @@ public final class Nothing {
public abstract class Number {
/*primary*/ public constructor Number()
public abstract fun toByte(): kotlin.Byte
public abstract fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.
If you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.
See https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.9") public open fun toChar(): kotlin.Char
public abstract fun toDouble(): kotlin.Double
public abstract fun toFloat(): kotlin.Float
public abstract fun toInt(): kotlin.Int
@@ -727,7 +729,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short> {
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
+8 -6
View File
@@ -106,7 +106,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -299,7 +299,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -411,7 +411,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -596,7 +596,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -638,7 +638,9 @@ public final class Nothing {
public abstract class Number : kotlin.Any, java.io.Serializable {
/*primary*/ public constructor Number()
public abstract fun toByte(): kotlin.Byte
public abstract fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.
If you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.
See https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.9") public open fun toChar(): kotlin.Char
public abstract fun toDouble(): kotlin.Double
public abstract fun toFloat(): kotlin.Float
public abstract fun toInt(): kotlin.Int
@@ -749,7 +751,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
+8 -6
View File
@@ -106,7 +106,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -301,7 +301,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -413,7 +413,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -598,7 +598,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -640,7 +640,9 @@ public final class Nothing {
public abstract class Number : kotlin.Any, java.io.Serializable {
/*primary*/ public constructor Number()
public abstract fun toByte(): kotlin.Byte
public abstract fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.
If you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.
See https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.9") public open fun toChar(): kotlin.Char
public abstract fun toDouble(): kotlin.Double
public abstract fun toFloat(): kotlin.Float
public abstract fun toInt(): kotlin.Int
@@ -751,7 +753,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
+8 -6
View File
@@ -106,7 +106,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -299,7 +299,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -411,7 +411,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -596,7 +596,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -638,7 +638,9 @@ public final class Nothing {
public abstract class Number : kotlin.Any, java.io.Serializable {
/*primary*/ public constructor Number()
public abstract fun toByte(): kotlin.Byte
public abstract fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.
If you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.
See https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.9") public open fun toChar(): kotlin.Char
public abstract fun toDouble(): kotlin.Double
public abstract fun toFloat(): kotlin.Float
public abstract fun toInt(): kotlin.Int
@@ -749,7 +751,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
@kotlin.internal.IntrinsicConstEvaluation public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toDouble(): kotlin.Double
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toFloat(): kotlin.Float
@kotlin.internal.IntrinsicConstEvaluation public open override /*1*/ fun toInt(): kotlin.Int
@@ -0,0 +1,38 @@
// DONT_TARGET_EXACT_BACKEND: JVM
// DONT_TARGET_EXACT_BACKEND: JS
// IGNORE_BACKEND: JVM_IR, JS_IR
// KT-46465
// WITH_STDLIB
class MyNumber(val b: Boolean) : Number() {
override fun toByte(): Byte {
return toInt().toByte()
}
override fun toDouble(): Double {
return toInt().toDouble()
}
override fun toFloat(): Float {
return toInt().toFloat()
}
override fun toInt(): Int {
return if (b) { 'O'.code } else { 'K'.code }
}
override fun toLong(): Long {
return toInt().toLong()
}
override fun toShort(): Short {
return toInt().toShort()
}
}
@Suppress("DEPRECATION")
fun box(): String {
val o = MyNumber(true)
val k = MyNumber(false)
return "${o.toChar()}${k.toChar()}"
}
@@ -0,0 +1,42 @@
// DONT_TARGET_EXACT_BACKEND: JVM
// DONT_TARGET_EXACT_BACKEND: JS
// IGNORE_BACKEND: JS_IR
// KT-46465
// WITH_STDLIB
class MyNumber(val b: Boolean) : Number() {
override fun toByte(): Byte {
return toInt().toByte()
}
override fun toDouble(): Double {
return toInt().toDouble()
}
override fun toFloat(): Float {
return toInt().toFloat()
}
override fun toChar(): Char {
return super.toChar()
}
override fun toInt(): Int {
return if (b) { 'O'.code } else { 'K'.code }
}
override fun toLong(): Long {
return toInt().toLong()
}
override fun toShort(): Short {
return toInt().toShort()
}
}
@Suppress("DEPRECATION")
fun box(): String {
val o = MyNumber(true)
val k = MyNumber(false)
return "${o.toChar()}${k.toChar()}"
}
@@ -0,0 +1,41 @@
// DONT_TARGET_EXACT_BACKEND: JVM
// DONT_TARGET_EXACT_BACKEND: JS
// KT-46465
// WITH_STDLIB
interface Some {
fun toChar(): Char
}
class MyNumber(val b: Boolean) : Number() {
override fun toByte(): Byte {
return toInt().toByte()
}
override fun toDouble(): Double {
return toInt().toDouble()
}
override fun toFloat(): Float {
return toInt().toFloat()
}
override fun toInt(): Int {
return if (b) { 'O'.code } else { 'K'.code }
}
override fun toLong(): Long {
return toInt().toLong()
}
override fun toShort(): Short {
return toInt().toShort()
}
}
@Suppress("DEPRECATION")
fun box(): String {
val o = MyNumber(true)
val k = MyNumber(false)
return "${o.toChar()}${k.toChar()}"
}
@@ -275,7 +275,7 @@ CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:publ
annotations:
IntrinsicConstEvaluation
overridden:
public abstract fun toChar (): kotlin.Char declared in kotlin.Number
public open fun toChar (): kotlin.Char declared in kotlin.Number
$this: VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:<this> type:kotlin.Int
FUN IR_EXTERNAL_DECLARATION_STUB name:toDouble visibility:public modality:OPEN <> ($this:kotlin.Int) returnType:kotlin.Double
annotations:
@@ -35293,6 +35293,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
+5 -2
View File
@@ -43,8 +43,11 @@ public abstract class Number {
/**
* Returns the [Char] with the numeric value equal to this number, truncated to 16 bits if appropriate.
*/
// @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
public abstract fun toChar(): Char
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\nIf you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.\nSee https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.9", errorSince = "2.3")
public open fun toChar(): Char {
return toInt().toChar()
}
/**
* Returns the value of this number as a [Short], which may involve rounding or truncation.
+6 -5
View File
@@ -287,7 +287,7 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
* whereas the most significant 8 bits are filled with the sign bit of this value.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@kotlin.internal.IntrinsicConstEvaluation
public override fun toChar(): Char
/**
@@ -627,7 +627,7 @@ public class Short private constructor() : Number(), Comparable<Short> {
* i.e. it has the same binary representation as this `Short`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@kotlin.internal.IntrinsicConstEvaluation
public override fun toChar(): Char
/** Returns this value. */
@@ -1001,6 +1001,7 @@ public class Int private constructor() : Number(), Comparable<Int> {
*
* The resulting `Char` code is represented by the least significant 16 bits of this `Int` value.
*/
@Suppress("OVERRIDE_DEPRECATION")
@kotlin.internal.IntrinsicConstEvaluation
public override fun toChar(): Char
/**
@@ -1377,7 +1378,7 @@ public class Long private constructor() : Number(), Comparable<Long> {
* The resulting `Char` code is represented by the least significant 16 bits of this `Long` value.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@kotlin.internal.IntrinsicConstEvaluation
public override fun toChar(): Char
/**
@@ -1683,7 +1684,7 @@ public class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@kotlin.internal.IntrinsicConstEvaluation
public override fun toChar(): Char
/**
@@ -1985,7 +1986,7 @@ public class Double private constructor() : Number(), Comparable<Double> {
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@kotlin.internal.IntrinsicConstEvaluation
public override fun toChar(): Char
/**
+7 -7
View File
@@ -437,10 +437,6 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
return kind in PrimitiveType.floatingPoint && otherKind in listOf(PrimitiveType.BYTE, PrimitiveType.SHORT)
}
fun isCharConversionDeprecated(otherKind: PrimitiveType): Boolean {
return kind != PrimitiveType.INT && otherKind == PrimitiveType.CHAR
}
val thisName = kind.capitalized
for (otherKind in PrimitiveType.exceptBoolean) {
val otherName = otherKind.capitalized
@@ -469,9 +465,13 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
out.println(" @Deprecated(\"Unclear conversion. To achieve the same result convert to Int explicitly and then to $otherName.\", ReplaceWith(\"toInt().to$otherName()\"))")
out.println(" @DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.5\")")
}
if (isCharConversionDeprecated(otherKind)) {
out.println(" @Deprecated(\"Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\", ReplaceWith(\"this.toInt().toChar()\"))")
out.println(" @DeprecatedSinceKotlin(warningSince = \"1.5\")")
if (otherKind == PrimitiveType.CHAR) {
if (kind == PrimitiveType.INT) {
out.println(" @Suppress(\"OVERRIDE_DEPRECATION\")")
} else {
out.println(" @Deprecated(\"Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\", ReplaceWith(\"this.toInt().toChar()\"))")
out.println(" @DeprecatedSinceKotlin(warningSince = \"1.5\", errorSince = \"2.3\")")
}
}
out.println(" @kotlin.internal.IntrinsicConstEvaluation")
@@ -24849,6 +24849,24 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/primitiveTypes/crossTypeEquals.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
@@ -24849,6 +24849,24 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/primitiveTypes/crossTypeEquals.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
@@ -24849,6 +24849,24 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/primitiveTypes/crossTypeEquals.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
@@ -32,7 +32,11 @@ public abstract class Number {
/**
* Returns the [Char] with the numeric value equal to this number, truncated to 16 bits if appropriate.
*/
public abstract fun toChar(): Char
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\nIf you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.\nSee https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.9", errorSince = "2.3")
public open fun toChar(): Char {
return toInt().toChar()
}
/**
* Returns the value of this number as a [Short], which may involve rounding or truncation.
@@ -289,7 +289,7 @@ public final class Byte private constructor() : Number(), Comparable<Byte> {
* whereas the most significant 8 bits are filled with the sign bit of this value.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@TypedIntrinsic(IntrinsicType.SIGN_EXTEND)
external public override fun toChar(): Char
/**
@@ -634,7 +634,7 @@ public final class Short private constructor() : Number(), Comparable<Short> {
* i.e. it has the same binary representation as this `Short`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@TypedIntrinsic(IntrinsicType.ZERO_EXTEND)
external public override fun toChar(): Char
@@ -1017,6 +1017,7 @@ public final class Int private constructor() : Number(), Comparable<Int> {
* The resulting `Char` code is represented by the least significant 16 bits of this `Int` value.
*/
@TypedIntrinsic(IntrinsicType.INT_TRUNCATE)
@Suppress("OVERRIDE_DEPRECATION")
external public override fun toChar(): Char
/**
* Converts this [Int] value to [Short].
@@ -1397,7 +1398,7 @@ public final class Long private constructor() : Number(), Comparable<Long> {
* The resulting `Char` code is represented by the least significant 16 bits of this `Long` value.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
@TypedIntrinsic(IntrinsicType.INT_TRUNCATE)
external public override fun toChar(): Char
/**
@@ -1706,7 +1707,7 @@ public final class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char = this.toInt().toChar()
/**
@@ -2014,7 +2015,7 @@ public final class Double private constructor() : Number(), Comparable<Double> {
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char = this.toInt().toChar()
/**
+10 -6
View File
@@ -1135,7 +1135,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
/*∆*/ @kotlin.internal.IntrinsicConstEvaluation
public open override fun toChar(): kotlin.Char
@@ -1524,7 +1524,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
/*∆*/ @kotlin.internal.IntrinsicConstEvaluation
public open override fun toChar(): kotlin.Char
@@ -1819,7 +1819,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
/*∆*/ @kotlin.internal.IntrinsicConstEvaluation
public open override fun toChar(): kotlin.Char
@@ -2348,7 +2348,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
/*∆*/ @kotlin.internal.IntrinsicConstEvaluation
public open override fun toChar(): kotlin.Char
@@ -2443,7 +2443,11 @@ public abstract class Number {
public abstract fun toByte(): kotlin.Byte
public abstract fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.
If you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.
See https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.9")
public open fun toChar(): kotlin.Char
public abstract fun toDouble(): kotlin.Double
@@ -2766,7 +2770,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
/*∆*/ @kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
/*∆*/ @kotlin.internal.IntrinsicConstEvaluation
public open override fun toChar(): kotlin.Char
+10 -5
View File
@@ -1051,7 +1051,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
public open override fun toChar(): kotlin.Char
public open override fun toDouble(): kotlin.Double
@@ -1381,7 +1381,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
public open override fun toChar(): kotlin.Char
public open override fun toDouble(): kotlin.Double
@@ -1612,7 +1612,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
public open override fun toChar(): kotlin.Char
public open override fun toDouble(): kotlin.Double
@@ -2037,7 +2037,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
public open override fun toChar(): kotlin.Char
public open override fun toDouble(): kotlin.Double
@@ -2121,7 +2121,11 @@ public abstract class Number {
public abstract fun toByte(): kotlin.Byte
public abstract fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.
If you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.
See https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.9")
public open fun toChar(): kotlin.Char
public abstract fun toDouble(): kotlin.Double
@@ -2382,6 +2386,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short> {
public open override fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
@kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5")
public open override fun toChar(): kotlin.Char
public open override fun toDouble(): kotlin.Double
@@ -249,7 +249,7 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
* whereas the most significant 8 bits are filled with the sign bit of this value.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char
/**
* Converts this [Byte] value to [Short].
@@ -542,6 +542,7 @@ public class Short private constructor() : Number(), Comparable<Short> {
* i.e. it has the same binary representation as this `Short`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char
/** Returns this value. */
public override fun toShort(): Short
@@ -861,6 +862,7 @@ public class Int private constructor() : Number(), Comparable<Int> {
*
* The resulting `Char` code is represented by the least significant 16 bits of this `Int` value.
*/
@Suppress("OVERRIDE_DEPRECATION")
public override fun toChar(): Char
/**
* Converts this [Int] value to [Short].
@@ -1118,7 +1120,7 @@ public class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char
/**
* Converts this [Float] value to [Short].
@@ -1374,7 +1376,7 @@ public class Double private constructor() : Number(), Comparable<Double> {
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char
/**
* Converts this [Double] value to [Short].
+1 -1
View File
@@ -307,7 +307,7 @@ public class Long internal constructor(
public override fun toByte(): Byte = low.toByte()
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char = low.toChar()
public override fun toShort(): Short = low.toShort()
public override fun toInt(): Int = low
@@ -313,6 +313,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
* The least significant 8 bits of the resulting `Char` code are the same as the bits of this `Byte` value,
* whereas the most significant 8 bits are filled with the sign bit of this value.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char = reinterpretAsInt().reinterpretAsChar()
/**
@@ -696,6 +698,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
* The resulting `Char` code is equal to this value reinterpreted as an unsigned number,
* i.e. it has the same binary representation as this `Short`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override fun toChar(): Char = reinterpretAsInt().reinterpretAsChar()
/** Returns this value. */
@@ -1125,6 +1129,7 @@ public class Int private constructor(private val value: Int) : Number(), Compara
*
* The resulting `Char` code is represented by the least significant 16 bits of this `Int` value.
*/
@Suppress("OVERRIDE_DEPRECATION")
public override fun toChar(): Char =
(this and 0xFFFF).reinterpretAsChar()
@@ -1576,6 +1581,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
*
* The resulting `Char` code is represented by the least significant 16 bits of this `Long` value.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override inline fun toChar(): Char =
this.toInt().toChar()
@@ -1923,6 +1930,8 @@ public class Float private constructor(private val value: Float) : Number(), Com
*
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override inline fun toChar(): Char = this.toInt().toChar()
/**
@@ -2264,6 +2273,8 @@ public class Double private constructor(private val value: Double) : Number(), C
*
* The resulting `Char` value is equal to `this.toInt().toChar()`.
*/
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3")
public override inline fun toChar(): Char = this.toInt().toChar()
/**
@@ -28349,6 +28349,24 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
@@ -28026,6 +28026,24 @@ public class K1NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTes
runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt");
}
@Test
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@Test
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@Test
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@Test
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
@@ -22147,6 +22147,21 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt");
}
@TestMetadata("customNumberInheritor.kt")
public void testCustomNumberInheritor() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor.kt");
}
@TestMetadata("customNumberInheritor_callToSuper.kt")
public void testCustomNumberInheritor_callToSuper() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_callToSuper.kt");
}
@TestMetadata("customNumberInheritor_interfaceInheritance.kt")
public void testCustomNumberInheritor_interfaceInheritance() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/customNumberInheritor_interfaceInheritance.kt");
}
@TestMetadata("ea35963.kt")
public void testEa35963() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/ea35963.kt");