[FIR] Properly support smartcasts on stable when subjects in when conditions
^KT-49860 Fixed
This commit is contained in:
committed by
teamcityserver
parent
20425fb458
commit
330574cab6
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user