Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/whenSubjectExpression.kt
T
2021-11-26 11:26:21 +03:00

19 lines
403 B
Kotlin
Vendored

// DUMP_CFG
// ISSUE: KT-49860
fun whenWithSubjectExpression(x: Any) {
when (x) {
!is Double -> -1
0.0 -> 0 // `subj` in `subj == 0.0` must have type 'double'
else -> x.toInt()
}
}
fun whenWithSubjectVariable(x: Any) {
when (val y = x) {
!is Double -> -1
0.0 -> 0 // `subj` in `subj == 0.0` must have type 'double'
else -> y.toInt()
}
}