@@ -701,24 +701,17 @@ object CaptureSet:
701
701
if mapped.isConst then CompareResult .OK
702
702
else if mapped.asVar.recordDepsState() then { addAsDependentTo(mapped); CompareResult .OK }
703
703
else CompareResult .Fail (this :: Nil )
704
- else if ! isFixpoint then
705
- // We did not yet observe the !isFixpoint condition in our tests, but it's a
706
- // theoretical possibility. In that case, it would be inconsistent to both
707
- // add `elem` to the set and back-propagate it. But if `{elem} <:< tm(elem)`
708
- // and the variance of the set is positive, we can soundly add `tm(ref)` to
709
- // the set while back-propagating `ref` as before. Otherwise there's nothing
710
- // obvious left to do except fail (which is always sound).
711
- if variance > 0
712
- && elem.singletonCaptureSet.subCaptures(mapped, frozen = true ).isOK then
713
- // widen to fixpoint. mapped is known to be a fixpoint since tm is idempotent.
714
- // The widening is sound, but loses completeness.
715
- addMapped
716
- else
717
- failNoFixpoint
718
704
else if accountsFor(elem) then
719
705
CompareResult .OK
720
- else
706
+ else if variance > 0 then
707
+ // we can soundly add nothing to source and `x` to this set
708
+ addNewElem(elem)
709
+ else if isFixpoint then
710
+ // We can soundly add `x` to both this set and source since `f(x) = x`
721
711
addNewElem(elem).andAlso(propagate)
712
+ else
713
+ // we are out of options; fail (which is always sound).
714
+ failNoFixpoint
722
715
end tryInclude
723
716
724
717
override def computeApprox (origin : CaptureSet )(using Context ): CaptureSet =
0 commit comments