KT-234 Force when() expressions to have an 'else' branch

KT-973 Unreachable code
This commit is contained in:
svtk
2012-01-18 13:31:42 +04:00
parent 94e3cc9976
commit becd713111
23 changed files with 175 additions and 50 deletions
+5 -4
View File
@@ -4,7 +4,6 @@ fun foo() : Int {
val s = ""
val x = 1
when (x) {
is * -> 1
is <error>String</error> -> 1
!is Int -> 1
is Any? -> 1
@@ -16,7 +15,7 @@ fun foo() : Int {
// Commented for KT-621 .<!error>a</!error> -> 1
// Commented for KT-621 .equals(1).<!error>a</!error> -> 1
// Commented for KT-621 <!warning>?.</!warning>equals(1) -> 1
else -> 1
is * -> 1
}
// Commented for KT-621
@@ -39,6 +38,7 @@ fun test() {
x -> 1
is 1 -> 1
is <error>#(1, 1)</error> -> 1
else -> 1
}
val z = #(1, 1)
@@ -51,11 +51,12 @@ fun test() {
is <error>#(1, "1", *)</error> -> 1
is boo #(1, <error>"a"</error>, *) -> 1
is boo <error>#(1, *)</error> -> 1
else -> 1
}
when (z) {
<error>else -> 1</error>
#(1, 1) -> 2
<error>else</error> -> 1
<error>#(1, 1) -> 2</error>
}
when (z) {