mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
Introduce lowering to remove null checks for primitive type expressions and replace them with true/false. Side-effects are preserved. Generate ifnull/ifnonnull instructions for null checks instead of materializing a null literal for an equality check.
23 lines
679 B
Kotlin
Vendored
23 lines
679 B
Kotlin
Vendored
// !LANGUAGE: +ProperIeee754Comparisons
|
|
fun equals5(a: Any?, b: Any?) = if (a is Float && b is Float?) a == b else null!!
|
|
|
|
fun equals6(a: Any?, b: Any?) = if (a is Float? && b is Float) a == b else null!!
|
|
|
|
fun equals8(a: Any?, b: Any?) = if (a is Float? && b is Float?) a == b else null!!
|
|
|
|
|
|
fun box(): String {
|
|
if (!equals5(-0.0F, 0.0F)) return "fail 5"
|
|
if (!equals6(-0.0F, 0.0F)) return "fail 6"
|
|
|
|
if (!equals8(-0.0F, 0.0F)) return "fail 8"
|
|
if (!equals8(null, null)) return "fail 9"
|
|
if (equals8(null, 0.0F)) return "fail 10"
|
|
if (equals8(0.0F, null)) return "fail 11"
|
|
|
|
return "OK"
|
|
}
|
|
|
|
// 3 areEqual \(Ljava/lang/Float;Ljava/lang/Float;\)Z
|
|
// 3 areEqual
|