Files
kotlin-fork/compiler/testData/codegen/box/when/whenSubjectVariable/ieee754EqualityWithSmartCast.kt
T
2018-06-28 12:26:41 +02:00

22 lines
474 B
Kotlin
Vendored

// !LANGUAGE: +VariableDeclarationInWhenSubject +ProperIeee754Comparisons
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS, JS_IR
val az: Any = -0.0
val afz: Any = -0.0f
fun box(): String {
when (val y = az) {
!is Double -> throw AssertionError()
0.0 -> {}
else -> throw AssertionError()
}
when (val y = afz) {
!is Float -> throw AssertionError()
0.0 -> {}
else -> throw AssertionError()
}
return "OK"
}