Implicit exhaustive when check for definite variable initialization (KT-8700)

This commit is contained in:
Mikhail Glukhikh
2015-12-25 14:25:38 +03:00
committed by Mikhail Glukhikh
parent 52c3fb03a2
commit 011a9f23b9
10 changed files with 47 additions and 16 deletions
@@ -5,11 +5,11 @@ enum class Direction {
fun foo(dir: Direction): Int {
val res: Int
// See KT-6046: res is always initialized
when (dir) {
<!DEBUG_INFO_IMPLICIT_EXHAUSTIVE!>when (dir) {
Direction.NORTH -> res = 1
Direction.SOUTH -> res = 2
Direction.WEST -> res = 3
Direction.EAST -> res = 4
}
}<!>
return res
}