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:
+13
@@ -0,0 +1,13 @@
|
||||
// KT-7857: when exhaustiveness does not take previous nullability checks into account
|
||||
fun foo(arg: Boolean?): Int {
|
||||
if (arg != null) {
|
||||
return when (<!DEBUG_INFO_SMARTCAST!>arg<!>) {
|
||||
true -> 1
|
||||
false -> 0
|
||||
// else or null branch should not be required here!
|
||||
}
|
||||
}
|
||||
else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user