Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360
This commit is contained in:
+2
-2
@@ -10,8 +10,8 @@ fun box(): String {
|
||||
if (!("a".equals(c))) return "fail4"
|
||||
if (!((null as Any?)?.equals(null) ?: true)) return "fail5"
|
||||
val d = 5.6
|
||||
if (!(d.toShort().equals(5.toShort()))) return "fail6"
|
||||
if (!(d.toByte().equals(5.toByte()))) return "fail7"
|
||||
if (!(d.toInt().toShort().equals(5.toShort()))) return "fail6"
|
||||
if (!(d.toInt().toByte().equals(5.toByte()))) return "fail7"
|
||||
if (!(d.toFloat().equals(5.6.toFloat()))) return "fail8"
|
||||
if (!(d.toInt().equals(5))) return "fail9"
|
||||
if (true.equals(false)) return "fail10"
|
||||
|
||||
@@ -3,12 +3,6 @@ package foo
|
||||
|
||||
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(-56, 200L.toByte())
|
||||
|
||||
@@ -18,15 +12,11 @@ fun box(): String {
|
||||
assertEquals(65, (321.toShort()).toByte())
|
||||
assertEquals(-56, (200.toShort()).toByte())
|
||||
|
||||
assertEquals(-1, 65535.0.toShort())
|
||||
assertEquals(-1, 65535.0f.toShort())
|
||||
assertEquals(-1, 65535L.toShort())
|
||||
assertEquals(-1, 65535.toShort())
|
||||
|
||||
assertEquals(65535, 65535.2.toInt())
|
||||
assertEquals(23, 23.6f.toInt())
|
||||
assertEquals(-12, -12.4.toShort())
|
||||
assertEquals(-12, -12.4.toByte())
|
||||
|
||||
assertEquals('\u0419', (-654311).toChar())
|
||||
assertEquals('\u0419', (-654311.0).toChar())
|
||||
|
||||
@@ -25,8 +25,6 @@ fun box(): String {
|
||||
assertEquals(true, 65.0f == doubleX.toFloat())
|
||||
assertEquals(true, 65L == doubleX.toLong())
|
||||
assertEquals(true, 65 == doubleX.toInt())
|
||||
assertEquals(true, 65.toShort() == doubleX.toShort())
|
||||
assertEquals(true, 65.toByte() == doubleX.toByte())
|
||||
assertEquals(true, 'A' == doubleX.toChar())
|
||||
|
||||
var floatX: Float = 65.0f
|
||||
@@ -34,8 +32,6 @@ fun box(): String {
|
||||
assertEquals(true, 65.0f == floatX.toFloat())
|
||||
assertEquals(true, 65L == floatX.toLong())
|
||||
assertEquals(true, 65 == floatX.toInt())
|
||||
assertEquals(true, 65.toShort() == floatX.toShort())
|
||||
assertEquals(true, 65.toByte() == floatX.toByte())
|
||||
assertEquals(true, 'A' == floatX.toChar())
|
||||
|
||||
val longX: Long = 65L
|
||||
|
||||
@@ -9,15 +9,9 @@ fun box(): String {
|
||||
if (c.toFloat() != 3.6.toFloat()) {
|
||||
return "fail2"
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return "fail3"
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return "fail4"
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return "fail5"
|
||||
}
|
||||
|
||||
val cn: Double = -3.6
|
||||
if (cn.toDouble() != -3.6) {
|
||||
@@ -26,15 +20,9 @@ fun box(): String {
|
||||
if (cn.toFloat() != -3.6.toFloat()) {
|
||||
return "fail7"
|
||||
}
|
||||
if (cn.toByte() != (-3).toByte()) {
|
||||
return "fail8"
|
||||
}
|
||||
if (cn.toInt() != -3) {
|
||||
return "fail9"
|
||||
}
|
||||
if (cn.toShort() != (-3).toShort()) {
|
||||
return "fail10"
|
||||
}
|
||||
|
||||
val f: Float = 3.6.toFloat()
|
||||
if (f.toDouble() != 3.6) {
|
||||
@@ -43,15 +31,9 @@ fun box(): String {
|
||||
if (f.toFloat() != 3.6.toFloat()) {
|
||||
return "fail12"
|
||||
}
|
||||
if (f.toByte() != 3.toByte()) {
|
||||
return "fail13"
|
||||
}
|
||||
if (f.toInt() != 3) {
|
||||
return "fail14"
|
||||
}
|
||||
if (f.toShort() != 3.toShort()) {
|
||||
return "fail15"
|
||||
}
|
||||
|
||||
val fn: Float = -3.6.toFloat()
|
||||
if (fn.toDouble() != -3.6) {
|
||||
@@ -60,15 +42,9 @@ fun box(): String {
|
||||
if (fn.toFloat() != -3.6.toFloat()) {
|
||||
return "fail17"
|
||||
}
|
||||
if (fn.toByte() != (-3).toByte()) {
|
||||
return "fail18"
|
||||
}
|
||||
if (fn.toInt() != -3) {
|
||||
return "fail19"
|
||||
}
|
||||
if (fn.toShort() != (-3).toShort()) {
|
||||
return "fail20"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user