'val' in 'when': IEEE754 equality
This commit is contained in:
@@ -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"
|
||||
}
|
||||
+14
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user