FIR: Report UNSAFE_CALL instead of SMARTCAST_IMPOSSIBLE when smartcast

to null.

Currently the error message shows the expression is impossible to
smartcast to the nullable type, which is nonsensical since it's already
that type.
This commit is contained in:
Mark Punzalan
2021-07-29 18:52:36 +00:00
committed by teamcityserver
parent 0627dbcb78
commit 504449f03e
4 changed files with 71 additions and 0 deletions
@@ -175,3 +175,10 @@ fun test_13(q: QImplMutable?) {
<!SMARTCAST_IMPOSSIBLE!>q.data<!>.s.inc() // should be bad
}
}
fun test_14(q: Q) {
// `q.data` is a property that has an open getter
if (q.data == null) {
q.data<!UNSAFE_CALL!>.<!>s // should be UNSAFE_CALL and NOT SMARTCAST_IMPOSSIBLE
}
}