Exhaustive whens without else and 'Nothing' as the result are considered 'implicit exhaustive'

This commit is contained in:
Mikhail Glukhikh
2015-12-24 13:23:49 +03:00
committed by Mikhail Glukhikh
parent d62d7dd84f
commit b93894953d
7 changed files with 17 additions and 13 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ sealed class Tree {
class Node(val left: Tree, val right: Tree): Tree()
fun max(): Int {
when(this) {
<!DEBUG_INFO_IMPLICIT_EXHAUSTIVE!>when(this) {
is Empty -> return -1
is Leaf -> return <!DEBUG_INFO_SMARTCAST!>this<!>.x
is Node -> return <!DEBUG_INFO_SMARTCAST!>this<!>.left.max()
}
}<!>
}
}