"!is" now works correctly in when-clauses

This commit is contained in:
Alexander Udalov
2012-06-22 15:51:13 +04:00
parent 3f4e2514ea
commit 28b150892a
2 changed files with 22 additions and 3 deletions
@@ -10,8 +10,7 @@ fun f1(s: Int?): Int {
fun f2(s: Int?): Int {
return when (s) {
is 4 -> s
is null -> <!TYPE_MISMATCH!>s<!>
!is Int -> <!TYPE_MISMATCH!>s<!>
else -> s
}
}
@@ -38,3 +37,17 @@ fun f5(s: Int?): Int {
else -> 0
}
}
fun f6(s: Int?): Int {
return when {
s is Int -> s
else -> <!TYPE_MISMATCH!>s<!>
}
}
fun f7(s: Int?): Int {
return when {
s !is Int -> <!TYPE_MISMATCH!>s<!>
else -> s
}
}