'val' in 'when': IEEE754 equality

This commit is contained in:
Dmitry Petrov
2018-06-08 17:32:31 +03:00
parent 67247ee490
commit 6949610dcb
7 changed files with 77 additions and 4 deletions
@@ -0,0 +1,13 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
// IGNORE_BACKEND: JS
val dz = -0.0
fun box(): String {
when (val y = dz) {
0.0 -> {}
else -> throw AssertionError()
}
return "OK"
}
@@ -0,0 +1,14 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject +ProperIeee754Comparisons
// IGNORE_BACKEND: JS
val az: Any = -0.0
fun box(): String {
when (val y = az) {
!is Double -> throw AssertionError()
0.0 -> {}
else -> throw AssertionError()
}
return "OK"
}