Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360

This commit is contained in:
Abduqodiri Qurbonzoda
2021-03-27 03:03:55 +03:00
parent 404c69ded7
commit 968099fbec
23 changed files with 64 additions and 76 deletions
+4 -4
View File
@@ -484,7 +484,7 @@ public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>
public final operator fun times(other: R|kotlin/Short|): R|kotlin/Double| public final operator fun times(other: R|kotlin/Short|): R|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())) ) public open fun toByte(): R|kotlin/Byte| @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)) public open fun toByte(): R|kotlin/Byte|
public open fun toChar(): R|kotlin/Char| public open fun toChar(): R|kotlin/Char|
@@ -496,7 +496,7 @@ public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>
public open fun toLong(): R|kotlin/Long| public open fun toLong(): R|kotlin/Long|
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) public open fun toShort(): R|kotlin/Short| @R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toShort(): R|kotlin/Short|
public final operator fun unaryMinus(): R|kotlin/Double| public final operator fun unaryMinus(): R|kotlin/Double|
@@ -663,7 +663,7 @@ public final class Float : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Float>|,
public final operator fun times(other: R|kotlin/Short|): R|kotlin/Float| public final operator fun times(other: R|kotlin/Short|): R|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())) ) public open fun toByte(): R|kotlin/Byte| @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)) public open fun toByte(): R|kotlin/Byte|
public open fun toChar(): R|kotlin/Char| public open fun toChar(): R|kotlin/Char|
@@ -675,7 +675,7 @@ public final class Float : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Float>|,
public open fun toLong(): R|kotlin/Long| public open fun toLong(): R|kotlin/Long|
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) public open fun toShort(): R|kotlin/Short| @R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toShort(): R|kotlin/Short|
public final operator fun unaryMinus(): R|kotlin/Float| public final operator fun unaryMinus(): R|kotlin/Float|
@@ -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 */ /** This file is generated by org.jetbrains.kotlin.backend.common.interpreter.builtins.GenerateBuiltInsMap.generateMap(). DO NOT MODIFY MANUALLY */
@Suppress("DEPRECATION") @Suppress("DEPRECATION_ERROR")
val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>( val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
unaryOperation<Boolean>("hashCode", "Boolean") { a -> a.hashCode() }, unaryOperation<Boolean>("hashCode", "Boolean") { a -> a.hashCode() },
unaryOperation<Boolean>("not", "Boolean") { a -> a.not() }, unaryOperation<Boolean>("not", "Boolean") { a -> a.not() },
+4 -4
View File
@@ -275,13 +275,13 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Double public final operator fun unaryMinus(): kotlin.Double
public final operator fun unaryPlus(): kotlin.Double public final operator fun unaryPlus(): kotlin.Double
@@ -376,13 +376,13 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Float public final operator fun unaryMinus(): kotlin.Float
public final operator fun unaryPlus(): kotlin.Float public final operator fun unaryPlus(): kotlin.Float
+4 -4
View File
@@ -285,13 +285,13 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Double public final operator fun unaryMinus(): kotlin.Double
public final operator fun unaryPlus(): kotlin.Double public final operator fun unaryPlus(): kotlin.Double
@@ -389,13 +389,13 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Float public final operator fun unaryMinus(): kotlin.Float
public final operator fun unaryPlus(): kotlin.Float public final operator fun unaryPlus(): kotlin.Float
+4 -4
View File
@@ -287,13 +287,13 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Double public final operator fun unaryMinus(): kotlin.Double
public final operator fun unaryPlus(): kotlin.Double public final operator fun unaryPlus(): kotlin.Double
@@ -391,13 +391,13 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Float public final operator fun unaryMinus(): kotlin.Float
public final operator fun unaryPlus(): kotlin.Float public final operator fun unaryPlus(): kotlin.Float
+4 -4
View File
@@ -285,13 +285,13 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Double public final operator fun unaryMinus(): kotlin.Double
public final operator fun unaryPlus(): kotlin.Double public final operator fun unaryPlus(): kotlin.Double
@@ -389,13 +389,13 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Int): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float 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 = {})) public open override /*1*/ fun toByte(): kotlin.Byte @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") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toInt(): kotlin.Int
public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) public open override /*1*/ fun toShort(): kotlin.Short @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Float public final operator fun unaryMinus(): kotlin.Float
public final operator fun unaryPlus(): kotlin.Float public final operator fun unaryPlus(): kotlin.Float
+1 -1
View File
@@ -12,7 +12,7 @@ fun box() : String {
assertEquals(1.toByte(), foo(1L) { x -> x!!.toByte() }) assertEquals(1.toByte(), foo(1L) { x -> x!!.toByte() })
assertEquals(1.toShort(), foo(1L) { x -> x!!.toShort() }) assertEquals(1.toShort(), foo(1L) { x -> x!!.toShort() })
assertEquals('a'.toDouble(), foo('a') { x -> x!!.toDouble() }) assertEquals('a'.toDouble(), foo('a') { x -> x!!.toDouble() })
assertEquals(1.0.toByte(), foo(1.0) { x -> x!!.toByte() }) assertEquals(1.0.toInt(), foo(1.0) { x -> x!!.toInt() })
return "OK" return "OK"
} }
@@ -42,13 +42,9 @@ fun box(): String {
65534.0, 65535.0, 65536.0, 65534.0, 65535.0, 65536.0,
2147483647.0, 2147483648.0, 2147483649.0, 2147483647.0, 2147483648.0, 2147483649.0,
Double.MAX_VALUE, Double.POSITIVE_INFINITY)) { Double.MAX_VALUE, Double.POSITIVE_INFINITY)) {
assertEquals(d.toInt().toByte(), d.toByte())
assertEquals(d.toInt().toShort(), d.toShort())
assertEquals(d.toInt().toChar(), d.toChar()) assertEquals(d.toInt().toChar(), d.toChar())
val f = d.toFloat() val f = d.toFloat()
assertEquals(f.toInt().toByte(), f.toByte())
assertEquals(f.toInt().toShort(), f.toShort())
assertEquals(f.toInt().toChar(), f.toChar()) assertEquals(f.toInt().toChar(), f.toChar())
} }
@@ -9,7 +9,7 @@ fun bar() {
foo(1L) { x -> x!!.toByte() } foo(1L) { x -> x!!.toByte() }
foo(1L) { x -> x!!.toShort() } foo(1L) { x -> x!!.toShort() }
foo('a') { x -> x!!.toDouble() } foo('a') { x -> x!!.toDouble() }
foo(1.0) { x -> x!!.toByte() } foo(1.0) { x -> x!!.toInt() }
} }
// 0 valueOf // 0 valueOf
@@ -17,6 +17,6 @@ fun bar() {
// 1 I2L // 1 I2L
// 2 L2I // 2 L2I
// 2 I2S // 2 I2S
// 2 I2B // 1 I2B
// 1 I2D // 1 I2D
// 1 D2I // 1 D2I
@@ -63,8 +63,8 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
unaryOperation(DOUBLE, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), unaryOperation(DOUBLE, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), unaryOperation(DOUBLE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toShort", { a -> a.<!DEPRECATION!>toShort<!>() }, emptyUnaryFun), unaryOperation(DOUBLE, "toShort", { a -> a.<!DEPRECATION_ERROR!>toShort<!>() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toByte", { a -> a.<!DEPRECATION!>toByte<!>() }, emptyUnaryFun), unaryOperation(DOUBLE, "toByte", { a -> a.<!DEPRECATION_ERROR!>toByte<!>() }, emptyUnaryFun),
unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun), unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
unaryOperation(FLOAT, "minus", { a -> a.unaryMinus() }, emptyUnaryFun), unaryOperation(FLOAT, "minus", { a -> a.unaryMinus() }, emptyUnaryFun),
unaryOperation(FLOAT, "toChar", { a -> a.toChar() }, emptyUnaryFun), unaryOperation(FLOAT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
@@ -72,8 +72,8 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
unaryOperation(FLOAT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), unaryOperation(FLOAT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun), unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
unaryOperation(FLOAT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun), unaryOperation(FLOAT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
unaryOperation(FLOAT, "toShort", { a -> a.<!DEPRECATION!>toShort<!>() }, emptyUnaryFun), unaryOperation(FLOAT, "toShort", { a -> a.<!DEPRECATION_ERROR!>toShort<!>() }, emptyUnaryFun),
unaryOperation(FLOAT, "toByte", { a -> a.<!DEPRECATION!>toByte<!>() }, emptyUnaryFun), unaryOperation(FLOAT, "toByte", { a -> a.<!DEPRECATION_ERROR!>toByte<!>() }, emptyUnaryFun),
unaryOperation(INT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun), unaryOperation(INT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun), unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun), unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
@@ -1218,6 +1218,7 @@ public class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Byte` value is equal to `this.toInt().toByte()`. * The resulting `Byte` value is equal to `this.toInt().toByte()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toByte(): Byte public override fun toByte(): Byte
/** /**
* Converts this [Float] value to [Char]. * Converts this [Float] value to [Char].
@@ -1231,6 +1232,7 @@ public class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Short` value is equal to `this.toInt().toShort()`. * The resulting `Short` value is equal to `this.toInt().toShort()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toShort(): Short public override fun toShort(): Short
/** /**
* Converts this [Float] value to [Int]. * Converts this [Float] value to [Int].
@@ -1455,6 +1457,7 @@ public class Double private constructor() : Number(), Comparable<Double> {
* The resulting `Byte` value is equal to `this.toInt().toByte()`. * The resulting `Byte` value is equal to `this.toInt().toByte()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toByte(): Byte public override fun toByte(): Byte
/** /**
* Converts this [Double] value to [Char]. * Converts this [Double] value to [Char].
@@ -1468,6 +1471,7 @@ public class Double private constructor() : Number(), Comparable<Double> {
* The resulting `Short` value is equal to `this.toInt().toShort()`. * The resulting `Short` value is equal to `this.toInt().toShort()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toShort(): Short public override fun toShort(): Short
/** /**
* Converts this [Double] value to [Int]. * Converts this [Double] value to [Int].
+1
View File
@@ -424,6 +424,7 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
if (isConversionDeprecated(otherKind)) { if (isConversionDeprecated(otherKind)) {
out.println(" @Deprecated(\"Unclear conversion. To achieve the same result convert to Int explicitly and then to $otherName.\", ReplaceWith(\"toInt().to$otherName()\"))") 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\")")
} }
out.println(" public override fun to$otherName(): $otherName") out.println(" public override fun to$otherName(): $otherName")
@@ -52,7 +52,7 @@ fun generateMap(): String {
val binaryIrOperationsMap = getBinaryIrOperationMap(irBuiltIns) val binaryIrOperationsMap = getBinaryIrOperationMap(irBuiltIns)
p.println("@Suppress(\"DEPRECATION\")") p.println("@Suppress(\"DEPRECATION_ERROR\")")
p.println("val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(") p.println("val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(")
p.println(generateUnaryBody(unaryOperationsMap, irBuiltIns)) p.println(generateUnaryBody(unaryOperationsMap, irBuiltIns))
p.println(")") p.println(")")
@@ -22,7 +22,7 @@ internal class A {
val i = 10.1.toInt() val i = 10.1.toInt()
val f = 10.1.toFloat() val f = 10.1.toFloat()
val l = 10.1.toLong() val l = 10.1.toLong()
val s = 10.1.toShort() val s = 10.1.toInt().toShort()
try { try {
val removed = list.removeAt(10) val removed = list.removeAt(10)
@@ -10,8 +10,8 @@ fun box(): String {
if (!("a".equals(c))) return "fail4" if (!("a".equals(c))) return "fail4"
if (!((null as Any?)?.equals(null) ?: true)) return "fail5" if (!((null as Any?)?.equals(null) ?: true)) return "fail5"
val d = 5.6 val d = 5.6
if (!(d.toShort().equals(5.toShort()))) return "fail6" if (!(d.toInt().toShort().equals(5.toShort()))) return "fail6"
if (!(d.toByte().equals(5.toByte()))) return "fail7" if (!(d.toInt().toByte().equals(5.toByte()))) return "fail7"
if (!(d.toFloat().equals(5.6.toFloat()))) return "fail8" if (!(d.toFloat().equals(5.6.toFloat()))) return "fail8"
if (!(d.toInt().equals(5))) return "fail9" if (!(d.toInt().equals(5))) return "fail9"
if (true.equals(false)) return "fail10" if (true.equals(false)) return "fail10"
@@ -3,12 +3,6 @@ package foo
fun box(): String { fun box(): String {
assertEquals(65, 321.0.toByte())
assertEquals(-56, 200.0.toByte())
assertEquals(65, 321.0f.toByte())
assertEquals(-56, 200.0f.toByte())
assertEquals(65, 321L.toByte()) assertEquals(65, 321L.toByte())
assertEquals(-56, 200L.toByte()) assertEquals(-56, 200L.toByte())
@@ -18,15 +12,11 @@ fun box(): String {
assertEquals(65, (321.toShort()).toByte()) assertEquals(65, (321.toShort()).toByte())
assertEquals(-56, (200.toShort()).toByte()) assertEquals(-56, (200.toShort()).toByte())
assertEquals(-1, 65535.0.toShort())
assertEquals(-1, 65535.0f.toShort())
assertEquals(-1, 65535L.toShort()) assertEquals(-1, 65535L.toShort())
assertEquals(-1, 65535.toShort()) assertEquals(-1, 65535.toShort())
assertEquals(65535, 65535.2.toInt()) assertEquals(65535, 65535.2.toInt())
assertEquals(23, 23.6f.toInt()) assertEquals(23, 23.6f.toInt())
assertEquals(-12, -12.4.toShort())
assertEquals(-12, -12.4.toByte())
assertEquals('\u0419', (-654311).toChar()) assertEquals('\u0419', (-654311).toChar())
assertEquals('\u0419', (-654311.0).toChar()) assertEquals('\u0419', (-654311.0).toChar())
@@ -25,8 +25,6 @@ fun box(): String {
assertEquals(true, 65.0f == doubleX.toFloat()) assertEquals(true, 65.0f == doubleX.toFloat())
assertEquals(true, 65L == doubleX.toLong()) assertEquals(true, 65L == doubleX.toLong())
assertEquals(true, 65 == doubleX.toInt()) assertEquals(true, 65 == doubleX.toInt())
assertEquals(true, 65.toShort() == doubleX.toShort())
assertEquals(true, 65.toByte() == doubleX.toByte())
assertEquals(true, 'A' == doubleX.toChar()) assertEquals(true, 'A' == doubleX.toChar())
var floatX: Float = 65.0f var floatX: Float = 65.0f
@@ -34,8 +32,6 @@ fun box(): String {
assertEquals(true, 65.0f == floatX.toFloat()) assertEquals(true, 65.0f == floatX.toFloat())
assertEquals(true, 65L == floatX.toLong()) assertEquals(true, 65L == floatX.toLong())
assertEquals(true, 65 == floatX.toInt()) assertEquals(true, 65 == floatX.toInt())
assertEquals(true, 65.toShort() == floatX.toShort())
assertEquals(true, 65.toByte() == floatX.toByte())
assertEquals(true, 'A' == floatX.toChar()) assertEquals(true, 'A' == floatX.toChar())
val longX: Long = 65L val longX: Long = 65L
@@ -9,15 +9,9 @@ fun box(): String {
if (c.toFloat() != 3.6.toFloat()) { if (c.toFloat() != 3.6.toFloat()) {
return "fail2" return "fail2"
} }
if (c.toByte() != 3.toByte()) {
return "fail3"
}
if (c.toInt() != 3) { if (c.toInt() != 3) {
return "fail4" return "fail4"
} }
if (c.toShort() != 3.toShort()) {
return "fail5"
}
val cn: Double = -3.6 val cn: Double = -3.6
if (cn.toDouble() != -3.6) { if (cn.toDouble() != -3.6) {
@@ -26,15 +20,9 @@ fun box(): String {
if (cn.toFloat() != -3.6.toFloat()) { if (cn.toFloat() != -3.6.toFloat()) {
return "fail7" return "fail7"
} }
if (cn.toByte() != (-3).toByte()) {
return "fail8"
}
if (cn.toInt() != -3) { if (cn.toInt() != -3) {
return "fail9" return "fail9"
} }
if (cn.toShort() != (-3).toShort()) {
return "fail10"
}
val f: Float = 3.6.toFloat() val f: Float = 3.6.toFloat()
if (f.toDouble() != 3.6) { if (f.toDouble() != 3.6) {
@@ -43,15 +31,9 @@ fun box(): String {
if (f.toFloat() != 3.6.toFloat()) { if (f.toFloat() != 3.6.toFloat()) {
return "fail12" return "fail12"
} }
if (f.toByte() != 3.toByte()) {
return "fail13"
}
if (f.toInt() != 3) { if (f.toInt() != 3) {
return "fail14" return "fail14"
} }
if (f.toShort() != 3.toShort()) {
return "fail15"
}
val fn: Float = -3.6.toFloat() val fn: Float = -3.6.toFloat()
if (fn.toDouble() != -3.6) { if (fn.toDouble() != -3.6) {
@@ -60,15 +42,9 @@ fun box(): String {
if (fn.toFloat() != -3.6.toFloat()) { if (fn.toFloat() != -3.6.toFloat()) {
return "fail17" return "fail17"
} }
if (fn.toByte() != (-3).toByte()) {
return "fail18"
}
if (fn.toInt() != -3) { if (fn.toInt() != -3) {
return "fail19" return "fail19"
} }
if (fn.toShort() != (-3).toShort()) {
return "fail20"
}
return "OK" return "OK"
} }
+4
View File
@@ -1312,6 +1312,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
public final operator fun times(other: kotlin.Short): kotlin.Double public final operator fun times(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.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")
public open override fun toByte(): kotlin.Byte public open override fun toByte(): kotlin.Byte
public open override fun toChar(): kotlin.Char public open override fun toChar(): kotlin.Char
@@ -1325,6 +1326,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
public open override fun toLong(): kotlin.Long public open override fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {}))
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
public open override fun toShort(): kotlin.Short public open override fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Double public final operator fun unaryMinus(): kotlin.Double
@@ -1547,6 +1549,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
public final operator fun times(other: kotlin.Short): kotlin.Float public final operator fun times(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.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")
public open override fun toByte(): kotlin.Byte public open override fun toByte(): kotlin.Byte
public open override fun toChar(): kotlin.Char public open override fun toChar(): kotlin.Char
@@ -1560,6 +1563,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
public open override fun toLong(): kotlin.Long public open override fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {}))
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
public open override fun toShort(): kotlin.Short public open override fun toShort(): kotlin.Short
public final operator fun unaryMinus(): kotlin.Float public final operator fun unaryMinus(): kotlin.Float
+4
View File
@@ -1287,6 +1287,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
public final operator fun times(other: kotlin.Short): kotlin.Double public final operator fun times(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.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")
public open override fun toByte(): kotlin.Byte public open override fun toByte(): kotlin.Byte
public open override fun toChar(): kotlin.Char public open override fun toChar(): kotlin.Char
@@ -1300,6 +1301,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
public open override fun toLong(): kotlin.Long public open override fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {}))
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
public open override fun toShort(): kotlin.Short public open override fun toShort(): kotlin.Short
/*∆*/ public open override fun toString(): kotlin.String /*∆*/ public open override fun toString(): kotlin.String
@@ -1526,6 +1528,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
public final operator fun times(other: kotlin.Short): kotlin.Float public final operator fun times(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.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")
public open override fun toByte(): kotlin.Byte public open override fun toByte(): kotlin.Byte
public open override fun toChar(): kotlin.Char public open override fun toChar(): kotlin.Char
@@ -1539,6 +1542,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
public open override fun toLong(): kotlin.Long public open override fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {}))
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
public open override fun toShort(): kotlin.Short public open override fun toShort(): kotlin.Short
/*∆*/ public open override fun toString(): kotlin.String /*∆*/ public open override fun toString(): kotlin.String
@@ -959,6 +959,7 @@ public class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Byte` value is equal to `this.toInt().toByte()`. * The resulting `Byte` value is equal to `this.toInt().toByte()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toByte(): Byte public override fun toByte(): Byte
/** /**
* Converts this [Float] value to [Char]. * Converts this [Float] value to [Char].
@@ -972,6 +973,7 @@ public class Float private constructor() : Number(), Comparable<Float> {
* The resulting `Short` value is equal to `this.toInt().toShort()`. * The resulting `Short` value is equal to `this.toInt().toShort()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toShort(): Short public override fun toShort(): Short
/** /**
* Converts this [Float] value to [Int]. * Converts this [Float] value to [Int].
@@ -1201,6 +1203,7 @@ public class Double private constructor() : Number(), Comparable<Double> {
* The resulting `Byte` value is equal to `this.toInt().toByte()`. * The resulting `Byte` value is equal to `this.toInt().toByte()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toByte(): Byte public override fun toByte(): Byte
/** /**
* Converts this [Double] value to [Char]. * Converts this [Double] value to [Char].
@@ -1214,6 +1217,7 @@ public class Double private constructor() : Number(), Comparable<Double> {
* The resulting `Short` value is equal to `this.toInt().toShort()`. * The resulting `Short` value is equal to `this.toInt().toShort()`.
*/ */
@Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toShort(): Short public override fun toShort(): Short
/** /**
* Converts this [Double] value to [Int]. * Converts this [Double] value to [Int].
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.nj2k.conversions
import org.jetbrains.kotlin.nj2k.NewJ2kConverterContext import org.jetbrains.kotlin.nj2k.NewJ2kConverterContext
import org.jetbrains.kotlin.nj2k.tree.* import org.jetbrains.kotlin.nj2k.tree.*
import org.jetbrains.kotlin.nj2k.types.primitiveTypes import org.jetbrains.kotlin.nj2k.types.primitiveTypes
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
import java.util.* import java.util.*
class BoxedTypeOperationsConversion(context: NewJ2kConverterContext) : RecursiveApplicableConversionBase(context) { class BoxedTypeOperationsConversion(context: NewJ2kConverterContext) : RecursiveApplicableConversionBase(context) {
@@ -38,9 +39,15 @@ class BoxedTypeOperationsConversion(context: NewJ2kConverterContext) : Recursive
} ?: return null } ?: return null
val primitiveTypeName = boxedTypeToPrimitiveType[boxedJavaType] ?: return null val primitiveTypeName = boxedTypeToPrimitiveType[boxedJavaType] ?: return null
if (operationType !in primitiveTypeNames) return null if (operationType !in primitiveTypeNames) return null
val shouldConvertToIntFirst =
primitiveTypeName in floatingPointPrimitiveTypeNames && operationType in typeNameOfIntegersLesserThanInt
val conversionType = if (shouldConvertToIntFirst) "Int" else operationType.capitalize(Locale.US)
return JKCallExpressionImpl( return JKCallExpressionImpl(
symbolProvider.provideMethodSymbol( symbolProvider.provideMethodSymbol(
"kotlin.${primitiveTypeName.capitalize(Locale.US)}.to${operationType.capitalize(Locale.US)}" "kotlin.${primitiveTypeName.capitalize(Locale.US)}.to$conversionType"
), ),
JKArgumentList() JKArgumentList()
).withFormattingFrom(methodCallExpression) ).withFormattingFrom(methodCallExpression)
@@ -58,5 +65,11 @@ class BoxedTypeOperationsConversion(context: NewJ2kConverterContext) : Recursive
private val primitiveTypeUnwrapRegexp = private val primitiveTypeUnwrapRegexp =
"""([\w.]+)\.(\w+)Value""".toRegex() """([\w.]+)\.(\w+)Value""".toRegex()
private val floatingPointPrimitiveTypeNames =
listOf(JvmPrimitiveType.DOUBLE.javaKeywordName, JvmPrimitiveType.FLOAT.javaKeywordName)
private val typeNameOfIntegersLesserThanInt =
listOf(JvmPrimitiveType.SHORT.javaKeywordName, JvmPrimitiveType.BYTE.javaKeywordName)
} }
} }
@@ -23,7 +23,7 @@ internal class A {
val i = 10.1.toInt() val i = 10.1.toInt()
val f = 10.1.toFloat() val f = 10.1.toFloat()
val l = 10.1.toLong() val l = 10.1.toLong()
val s = 10.1.toShort() val s = 10.1.toInt().toShort()
try { try {
val removed = list.removeAt(10) val removed = list.removeAt(10)
val isRemoved = list.remove("a") val isRemoved = list.remove("a")