0d7f649cc2
Now control flow analyzer knows when is exhaustive. If despite of this all conditions are accidentally false, jump to error is generated. A set of tests (diagnostic, control flow). #KT-5113 Fixed. #KT-6046 Fixed. #KT-1882 Fixed.
16 lines
261 B
Kotlin
Vendored
16 lines
261 B
Kotlin
Vendored
// See KT-5113
|
|
enum class E {
|
|
A,
|
|
B
|
|
}
|
|
|
|
class Outer(e: E) {
|
|
private val prop: Int
|
|
init {
|
|
when(e ) {
|
|
// When is exhaustive, property is always initialized
|
|
E.A -> prop = 1
|
|
E.B -> prop = 2
|
|
}
|
|
}
|
|
} |