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:
+2
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user