Files
kotlin-fork/compiler/testData/codegen/box/ieee754/smartCastOnWhenSubjectAfterCheckInBranchLV13.kt
T
2018-02-13 09:25:40 +03:00

25 lines
435 B
Kotlin
Vendored

// LANGUAGE_VERSION: 1.3
fun testF(x: Any) =
when (x) {
!is Float -> "!Float"
0.0F -> "0.0"
else -> "other"
}
fun testD(x: Any) =
when (x) {
!is Double -> "!Double"
0.0 -> "0.0"
else -> "other"
}
fun box(): String {
val tf = testF(0.0F)
if (tf != "0.0") return "Fail 1: $tf"
val td = testD(0.0)
if (td != "0.0") return "Fail 2: $td"
return "OK"
}