When now tries to smart cast subject to not-null if contains no null case #KT-7857 Fixed

Some new tests + some fixed tests
This commit is contained in:
Mikhail Glukhikh
2015-06-01 10:40:44 +03:00
parent de12771c0f
commit dea2ec9da6
15 changed files with 297 additions and 9 deletions
@@ -0,0 +1,14 @@
// KT-7857: when exhaustiveness does not take previous nullability checks into account
enum class X { A, B }
fun foo(arg: X?): Int {
if (arg != null) {
return when (<!DEBUG_INFO_SMARTCAST!>arg<!>) {
X.A -> 1
X.B -> 2
// else or null branch should not be required here!
}
}
else {
return 0
}
}