[K/N] Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360

This commit is contained in:
Abduqodiri Qurbonzoda
2021-04-07 06:12:11 +03:00
parent 22ca412dd2
commit b18cd24b81
3 changed files with 7 additions and 5 deletions
@@ -2230,10 +2230,9 @@ task hash0(type: KonanLocalTest) {
}
task ieee754(type: KonanLocalTest) {
goldValue = "Infinity 2147483647 -1 -1\n" +
goldValue = "Infinity 2147483647 -1\n" +
"3.4028235E38\n" +
"NAN2SHORT:: 0\n" +
"MAX2SHORT:: -1\n" +
"2147483647 -1\n" +
"FLOAT:: Infinity INT:: 2147483647\n" +
"FLOAT:: 1.7014117E38 INT:: 2147483647\n" +
@@ -10,17 +10,16 @@ import kotlin.test.*
@Test fun runTest() {
val v = Float.POSITIVE_INFINITY
val i = v.toInt()
println("$v $i ${v.toShort()} ${i.toShort()}")
println("$v $i ${i.toShort()}")
val a = 42
val b = Float.MAX_VALUE
println("${a + b}")
val s = Float.NaN.toShort()
val s = Float.NaN.toInt().toShort()
println("NAN2SHORT:: $s")
val d: Float = Float.MAX_VALUE
println("MAX2SHORT:: ${d.toShort()}")
val d2i = d.toInt()
println("$d2i ${d2i.toShort()}")
@@ -1347,6 +1347,7 @@ public final class Float private constructor() : Number(), Comparable<Float> {
* 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()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toByte(): Byte = this.toInt().toByte()
/**
@@ -1362,6 +1363,7 @@ public final class Float private constructor() : Number(), Comparable<Float> {
* 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()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toShort(): Short = this.toInt().toShort()
/**
@@ -1621,6 +1623,7 @@ public final class Double private constructor() : Number(), Comparable<Double> {
* 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()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toByte(): Byte = this.toInt().toByte()
/**
@@ -1636,6 +1639,7 @@ public final class Double private constructor() : Number(), Comparable<Double> {
* 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()"))
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
public override fun toShort(): Short = this.toInt().toShort()
/**