Skip to content

Commit d07282d

Browse files
committed
Fix CaptureSet's --
1 parent 5c80127 commit d07282d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,11 @@ sealed abstract class CaptureSet extends Showable:
210210
* any of the elements in the constant capture set `that`
211211
*/
212212
def -- (that: CaptureSet.Const)(using Context): CaptureSet =
213-
val elems1 = elems.filter(!that.accountsFor(_))
214-
if elems1.size == elems.size then this
215-
else if this.isConst then Const(elems1)
216-
else Diff(asVar, that)
213+
if this.isConst then
214+
val elems1 = elems.filter(!that.accountsFor(_))
215+
if elems1.size == elems.size then this else Const(elems1)
216+
else
217+
if that.isAlwaysEmpty then this else Diff(asVar, that)
217218

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

0 commit comments

Comments
 (0)