Files
kotlin-fork/compiler/testData/codegen/box/ieee754/whenNoSubject.kt
T
Mads Ager e8a640851a FIR: Change the Fir2Ir handling of smart casts.
Generate the expression with the original type and then insert
an implicit conversion. That matches the behavior of psi2ir
better and therefore avoids breaking backend assumptions.

In particular, IrGetValue expects the type of the underlying
symbol and the type of the IrGetValue to be the same.
2020-01-31 09:31:52 +01:00

29 lines
584 B
Kotlin
Vendored

// !LANGUAGE: -ProperIeee754Comparisons
// DONT_TARGET_EXACT_BACKEND: JS_IR
fun box(): String {
val plusZero: Any = 0.0
val minusZero: Any = -0.0
if (plusZero is Double && minusZero is Double) {
when {
plusZero < minusZero -> {
return "fail 1"
}
plusZero > minusZero -> {}
else -> {
return "fail 2"
}
}
when {
plusZero == minusZero -> {
return "fail 3"
}
else -> {}
}
}
return "OK"
}