FIR CFG: handle reassignments with explicit receivers more precisely

When a looping control structure has a reassignment with an explicit
receiver, we don't need to erase its smartcast info as it has to be a
non-local property and is thus automatically unstable anyway. However,
we should still do that upon reaching the assignment itself for slightly
more precise error messages (as the property not just "could be"
reassigned, but *has been* reassigned already).
This commit is contained in:
pyos
2022-09-28 14:36:47 +02:00
committed by teamcity
parent 77c2601382
commit d054617b8e
4 changed files with 21 additions and 13 deletions
@@ -10,7 +10,7 @@ fun Box.test() {
other.item = null
take<String>(<!SMARTCAST_IMPOSSIBLE!>item<!>)
this.item = null
take<String>(<!SMARTCAST_IMPOSSIBLE!>item<!>)
take<String>(<!ARGUMENT_TYPE_MISMATCH!>item<!>)
}
}
@@ -18,7 +18,7 @@ fun Box.test() {
myRun {
if (item != null) {
this.item = null
take<String>(<!SMARTCAST_IMPOSSIBLE!>item<!>)
take<String>(item)
}
}
}