Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/comparisonUnderAnd.kt
T
2015-11-25 18:26:15 +03:00

38 lines
1.1 KiB
Kotlin
Vendored

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 == <!DEBUG_INFO_CONSTANT!>y<!>) {
x<!UNSAFE_CALL!>.<!>length
y<!UNSAFE_CALL!>.<!>length
}
else {
// y == null but x != y
<!DEBUG_INFO_SMARTCAST!>x<!>.length
<!DEBUG_INFO_CONSTANT!>y<!><!UNSAFE_CALL!>.<!>length
}
if (y == null && x != <!DEBUG_INFO_CONSTANT!>y<!>) {
// y == null but x != y
<!DEBUG_INFO_SMARTCAST!>x<!>.length
<!DEBUG_INFO_CONSTANT!>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
}
}