Condition analysis: left part of and (true condition) / or (false condition) is used for right part analysis #KT-8780 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-10-28 20:11:04 +03:00
parent 12103d19d2
commit dd1196ae6b
6 changed files with 82 additions and 1 deletions
@@ -0,0 +1,38 @@
fun foo(x : String?, y : String?) {
if (y != null && x == y) {
// Both not null
<!DEBUG_INFO_SMARTCAST!>x<!>.length
<!DEBUG_INFO_SMARTCAST!>y<!>.length
}
else {
x<!UNSAFE_CALL!>.<!>length
y<!UNSAFE_CALL!>.<!>length
}
if (y != null || x == y) {
x<!UNSAFE_CALL!>.<!>length
y<!UNSAFE_CALL!>.<!>length
}
else {
// y == null but x != y
<!DEBUG_INFO_SMARTCAST!>x<!>.length
y<!UNSAFE_CALL!>.<!>length
}
if (y == null && x != y) {
// y == null but x != y
<!DEBUG_INFO_SMARTCAST!>x<!>.length
y<!UNSAFE_CALL!>.<!>length
}
else {
x<!UNSAFE_CALL!>.<!>length
y<!UNSAFE_CALL!>.<!>length
}
if (y == null || x != y) {
x<!UNSAFE_CALL!>.<!>length
y<!UNSAFE_CALL!>.<!>length
}
else {
// Both not null
<!DEBUG_INFO_SMARTCAST!>x<!>.length
<!DEBUG_INFO_SMARTCAST!>y<!>.length
}
}