[FIR] RHS assignment during equality comparison should invalidate DFA
If the right-hand side of an equality comparison contains an assignment to the variable used in the left-hand side, then implications about the equality comparison within data-flow analysis cannot be applied, as the value of the variable will be different after the comparison. ^KT-55096 Fixed
This commit is contained in:
+3
-3
@@ -27,9 +27,9 @@ fun unoverriddenEquals(a: Any?) {
|
||||
var b: Any?
|
||||
b = c
|
||||
if (b == c.also { b = a }) {
|
||||
a.x // bad (b#0 is C, b#1 = a)
|
||||
b.x // bad (b#0 is C, this is b#1)
|
||||
if (<!USELESS_IS_CHECK!>b is C<!>) { // b#1
|
||||
a.<!UNRESOLVED_REFERENCE!>x<!> // bad (b#0 is C, b#1 = a)
|
||||
b.<!UNRESOLVED_REFERENCE!>x<!> // bad (b#0 is C, this is b#1)
|
||||
if (b is C) { // b#1
|
||||
a.x // ok (b#1 = a)
|
||||
b.x // ok
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user