FIR/FIR IDE: Use entire FirVariableAssignment when reporting UNSAFE_CALL

(e.g., `nullable.a = b`), and use positioning strategies to locate the
dot in the LHS expression.

Without it, only the callee reference is reported on, which makes the
highlighting of the error and application of quickfixes incorrect in the
IDE.

Also fixed issue with annotated and/or labeled expressions on LHS of
assignment (e.g., `(@Ann label@ i) = 34`).
This commit is contained in:
Mark Punzalan
2021-05-13 09:24:29 +00:00
committed by Ilya Kirillov
parent 1d9247ae0f
commit d2b8204fdc
28 changed files with 342 additions and 92 deletions
@@ -1,6 +1,7 @@
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
class Foo {
fun foo(a: Foo): Foo = a
var f: Foo? = null
}
fun main() {
@@ -27,4 +28,14 @@ fun main() {
val z: Foo? = null
z!!.foo(z<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
val w: Foo? = null
w<!UNSAFE_CALL!>.<!>f = z
(w<!UNSAFE_CALL!>.<!>f) = z
(label@ w<!UNSAFE_CALL!>.<!>f) = z
w!!.f = z
w.f = z
w<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.f = z
<!SMARTCAST_IMPOSSIBLE!>w.f<!>.f = z
w.f!!.f = z
}