Implicit exhaustive when check for definite variable initialization (KT-8700)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
52c3fb03a2
commit
011a9f23b9
@@ -5,10 +5,10 @@ enum class MyEnum {
|
||||
fun foo(x: MyEnum?): Int {
|
||||
val y: Int
|
||||
// See KT-6046: y is always initialized
|
||||
when (x) {
|
||||
<!DEBUG_INFO_IMPLICIT_EXHAUSTIVE!>when (x) {
|
||||
MyEnum.A -> y = 1
|
||||
MyEnum.B -> y = 2
|
||||
null -> y = 0
|
||||
}
|
||||
}<!>
|
||||
return y
|
||||
}
|
||||
Reference in New Issue
Block a user