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,23 @@
sealed class Stmt
class ForStmt : Stmt()
sealed class Expr : Stmt() {
object BinExpr : Expr()
}
fun test(x: Stmt): String =
when (x) {
is Expr -> "expr"
is Stmt -> "stmt"
}
fun test2(x: Stmt): String =
<!NO_ELSE_IN_WHEN!>when<!> (x) {
is Expr -> "expr"
}
fun test3(x: Expr): String =
when (x) {
is Stmt -> "stmt"
}