Skip to content

Commit

Permalink
refine propagation for idempotent maps
Browse files Browse the repository at this point in the history
For an idempotent map f and a set C, we do not need to propagate x ∈ f(C) back
to C when x comes from f(y) for some y ∈ C.
  • Loading branch information
Linyxus committed Nov 10, 2022
1 parent 7e695fd commit dd88672
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/cc/CaptureSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ object CaptureSet:
else CompareResult.fail(this)
}
.andAlso {
if (origin ne source) && mapIsIdempotent then
if (origin ne source) && (origin ne initial) && mapIsIdempotent then
// `tm` is idempotent, propagate back elems from image set.
// This is sound, since we know that for `r in newElems: tm(r) = r`, hence
// `r` is _one_ possible solution in `source` that would make an `r` appear in this set.
Expand Down

0 comments on commit dd88672

Please sign in to comment.