Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/complexComparison.fir.kt
T
Jinseong Jeon e72ddbcbfe FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00

24 lines
673 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
fun foo(x: String?, y: String?, z: String?, w: String?) {
if (x != null && y != null && (x == z || y == z))
z.length
else
z.<!UNSAFE_CALL!>length<!>
if (x != null || y != null || (x != z && y != z))
z.<!UNSAFE_CALL!>length<!>
else
z.<!UNSAFE_CALL!>length<!>
if (x == null || y == null || (x != z && y != z))
z.<!UNSAFE_CALL!>length<!>
else
z.length
if (x != null && y == x && z == y && w == z)
w.length
else
w.<!UNSAFE_CALL!>length<!>
if ((x != null && y == x) || (z != null && y == z))
y.length
else
y.<!UNSAFE_CALL!>length<!>
}