mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +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.