Skip to content

Commit

Permalink
Fix CaptureSet's --
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jul 4, 2023
1 parent 5c80127 commit d07282d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compiler/src/dotty/tools/dotc/cc/CaptureSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ sealed abstract class CaptureSet extends Showable:
* any of the elements in the constant capture set `that`
*/
def -- (that: CaptureSet.Const)(using Context): CaptureSet =
val elems1 = elems.filter(!that.accountsFor(_))
if elems1.size == elems.size then this
else if this.isConst then Const(elems1)
else Diff(asVar, that)
if this.isConst then
val elems1 = elems.filter(!that.accountsFor(_))
if elems1.size == elems.size then this else Const(elems1)
else
if that.isAlwaysEmpty then this else Diff(asVar, that)

/** The largest subset (via <:<) of this capture set that does not account for `ref` */
def - (ref: CaptureRef)(using Context): CaptureSet =
Expand Down

0 comments on commit d07282d

Please sign in to comment.