[IR BE] Refactored FoldConstantLowering
- Fix `toString` evaluation for unsigned types in FoldConstantLowering - make corner cases around float/double evaluation work for K/JS - remove usage of kotlin type
This commit is contained in:
+24
-2
@@ -1,3 +1,16 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import kotlin.math.*
|
||||
|
||||
fun almostEqual(a: Float, b: Float): Boolean = abs(a - b) < 0.0000001F
|
||||
|
||||
val umax = UInt.MAX_VALUE
|
||||
val ulmax = ULong.MAX_VALUE
|
||||
val imax = Int.MAX_VALUE
|
||||
val lmax = Long.MAX_VALUE
|
||||
|
||||
fun box(): String {
|
||||
if (1F != 1.toFloat()) return "fail 1"
|
||||
if (1.0F != 1.0.toFloat()) return "fail 2"
|
||||
@@ -13,6 +26,15 @@ fun box(): String {
|
||||
if (1e-1f != 1e-1.toFloat()) return "fail 11"
|
||||
if (1.0e-1f != 1.0e-1.toFloat()) return "fail 12"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
if (!almostEqual(kotlin.math.E.toFloat(), exp(1.0F))) return "fail 13"
|
||||
|
||||
if (2147483647.toFloat() != imax.toFloat()) return "fail 14"
|
||||
|
||||
if (9223372036854775807L.toFloat() != lmax.toFloat()) return "fail 15"
|
||||
|
||||
if (0xFFFF_FFFF.toFloat() != umax.toFloat()) return "fail 16"
|
||||
|
||||
if ((2.0f * Long.MAX_VALUE + 1) != ulmax.toFloat()) return "fail 17"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
fun box(): String {
|
||||
if (239.toByte().toString() != (239.toByte() as Byte?).toString()) return "byte failed"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun box() : String {
|
||||
230?.toByte()?.hashCode()
|
||||
9.hashCode()
|
||||
|
||||
Reference in New Issue
Block a user