[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:
@@ -109,6 +109,10 @@ abstract class LogicSystem(private val context: ConeInferenceContext) {
|
||||
fun isSameValueIn(a: PersistentFlow, b: PersistentFlow, variable: RealVariable): Boolean =
|
||||
a.assignmentIndex[variable] == b.assignmentIndex[variable]
|
||||
|
||||
fun isSameValueIn(a: PersistentFlow, b: MutableFlow, variable: RealVariable): Boolean {
|
||||
return a.assignmentIndex[variable] == b.assignmentIndex[variable]
|
||||
}
|
||||
|
||||
private fun MutableFlow.mergeAssignments(flows: Collection<PersistentFlow>) {
|
||||
// If a variable was reassigned in one branch, it was reassigned at the join point.
|
||||
val reassignedVariables = mutableMapOf<RealVariable, Int>()
|
||||
|
||||
Reference in New Issue
Block a user