Exhaustive when on sealed trees implemented #KT-13130 Fixed

Also #KT-13227 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-01-18 18:40:42 +03:00
parent 3d7bcbdff9
commit 9625c32527
8 changed files with 292 additions and 36 deletions
@@ -0,0 +1,24 @@
sealed class A
sealed class B : A()
class C : B()
class D : B()
fun test(a: A): Any {
return when (a) {
is C -> ""
is D -> ""
}
}
fun test2(a: A): Any {
return when (a) {
is B -> ""
}
}
fun test3(a: A): Any {
return <!NO_ELSE_IN_WHEN!>when<!> (a) {
is D -> ""
}
}