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
@@ -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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 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.Long): 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 toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
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 unaryPlus(): kotlin.Float
+1 -1
View File
@@ -12,7 +12,7 @@ fun box() : String {
assertEquals(1.toByte(), foo(1L) { x -> x!!.toByte() })
assertEquals(1.toShort(), foo(1L) { x -> x!!.toShort() })
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"
}
@@ -42,13 +42,9 @@ fun box(): String {
65534.0, 65535.0, 65536.0,
2147483647.0, 2147483648.0, 2147483649.0,
Double.MAX_VALUE, Double.POSITIVE_INFINITY)) {
assertEquals(d.toInt().toByte(), d.toByte())
assertEquals(d.toInt().toShort(), d.toShort())
assertEquals(d.toInt().toChar(), d.toChar())
val f = d.toFloat()
assertEquals(f.toInt().toByte(), f.toByte())
assertEquals(f.toInt().toShort(), f.toShort())
assertEquals(f.toInt().toChar(), f.toChar())
}
@@ -9,7 +9,7 @@ fun bar() {
foo(1L) { x -> x!!.toByte() }
foo(1L) { x -> x!!.toShort() }
foo('a') { x -> x!!.toDouble() }
foo(1.0) { x -> x!!.toByte() }
foo(1.0) { x -> x!!.toInt() }
}
// 0 valueOf
@@ -17,6 +17,6 @@ fun bar() {
// 1 I2L
// 2 L2I
// 2 I2S
// 2 I2B
// 1 I2B
// 1 I2D
// 1 D2I
@@ -63,8 +63,8 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
unaryOperation(DOUBLE, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toShort", { a -> a.<!DEPRECATION!>toShort<!>() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toByte", { a -> a.<!DEPRECATION!>toByte<!>() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toShort", { a -> a.<!DEPRECATION_ERROR!>toShort<!>() }, emptyUnaryFun),
unaryOperation(DOUBLE, "toByte", { a -> a.<!DEPRECATION_ERROR!>toByte<!>() }, emptyUnaryFun),
unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
unaryOperation(FLOAT, "minus", { a -> a.unaryMinus() }, 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, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
unaryOperation(FLOAT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
unaryOperation(FLOAT, "toShort", { a -> a.<!DEPRECATION!>toShort<!>() }, emptyUnaryFun),
unaryOperation(FLOAT, "toByte", { a -> a.<!DEPRECATION!>toByte<!>() }, emptyUnaryFun),
unaryOperation(FLOAT, "toShort", { a -> a.<!DEPRECATION_ERROR!>toShort<!>() }, emptyUnaryFun),
unaryOperation(FLOAT, "toByte", { a -> a.<!DEPRECATION_ERROR!>toByte<!>() }, emptyUnaryFun),
unaryOperation(INT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
unaryOperation(INT, "toShort", { a -> a.toShort() }, emptyUnaryFun),
unaryOperation(INT, "toByte", { a -> a.toByte() }, emptyUnaryFun),