The diff() method should return the difference of two sets, but it returns a wrong (empty) result in some cases, e.g.
Welcome to Scala 3.2.2 (11.0.18, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> import scala.collection.mutable.BitSet
scala> val expected = BitSet(63, 128) diff BitSet(128)
val expected: scala.collection.mutable.BitSet = BitSet(63)
scala> import scala.collection.immutable.BitSet
scala> val wrong = BitSet(63, 128) diff BitSet(128)
val wrong: scala.collection.immutable.BitSet = BitSet()
Problem
wrong should not be empty but like expected.
The behavior under Scala 2.13.10 is identically wrong, as expected, since it is based on the same sources.
Reproduction steps
Scala versions: 2.13.10, 3.2.2
The
diff()
method should return the difference of two sets, but it returns a wrong (empty) result in some cases, e.g.Problem
wrong
should not be empty but likeexpected
. The behavior under Scala 2.13.10 is identically wrong, as expected, since it is based on the same sources.