mirror of
https://github.com/apple/swift-collections
synced 2026-11-29 05:14:20 +00:00
`_toUInt()` returns nil whenever a bound is negative, and the guard maps that straight to `false`. That is right for a nonempty range -- a bit set can never hold a negative value -- but an empty range equals the empty set regardless of where its bounds sit, so `BitSet().isEqualSet(to: -5 ..< -5)` answered false. Five of the six `Range<Int>` predicates already handle this: isSubset and isDisjoint clamp, isStrictSubset composes those two, and isSuperset and isStrictSuperset test `other.isEmpty` before converting. isEqualSet was the one that did not, which let a bit set be both a subset and a superset of a range while reporting that it was not equal to it.
Unit tests
Beware! The contents of this directory are not source stable. They are provided as is, with no compatibility promises across package releases. Future versions of this package can arbitrarily change these files or remove them, without any advance notice. (This can include patch releases.)