[JS BE] Support val in when subject
#KT-25014 Fixed
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +VariableDeclarationInWhenSubject
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
val dz = -0.0
|
||||
val fz = -0.0f
|
||||
@@ -29,5 +28,14 @@ fun box(): String {
|
||||
}
|
||||
}
|
||||
|
||||
testDoubleAsUpperBound(-0.0)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun <T: Double> testDoubleAsUpperBound(v: T): Boolean {
|
||||
return when (val a = v*v) {
|
||||
0.0 -> true
|
||||
else -> throw AssertionError()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user