AntiAliasing#mapApplication used to "rebuild" the mutated object(s) from function calls where a reassignment could be possible.
For instance, if we have:
case class Ref(var x: Int, var y: Int)
case class RefRef(var lhs: Ref, var rhs: Ref)
def modifyLhs(rr: RefRef, v: Int): Unit = {
rr.lhs.x = v
rr.lhs.y = v
}
def test(testRR: RefRef): Unit = {
val rrAlias = testRR
val lhsAlias = testRR.lhs
modifyLhs(testRR, 123)
// ...
}
Then before this PR, mapApplication would transform test as follows:
This in part resolves the issue when an @opaque function mutates an argument and uses the mutated argument in a ensuring, causing a discrepancy between the "updated" object used in the ensuring and the "rebuilt" object (for which we would like to use the ensuring property, but fail to do so; see valid/OpaqueMutation which used to fail).
AntiAliasing#mapApplication
used to "rebuild" the mutated object(s) from function calls where a reassignment could be possible. For instance, if we have:Then before this PR,
mapApplication
would transformtest
as follows:This is due to applying each effect individually. With this PR,
test
is transformed as follows:This in part resolves the issue when an
@opaque
function mutates an argument and uses the mutated argument in aensuring
, causing a discrepancy between the "updated" object used in theensuring
and the "rebuilt" object (for which we would like to use theensuring
property, but fail to do so; seevalid/OpaqueMutation
which used to fail).