mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
`BitSet[members:]` resolved range expressions against `Int.min ..< Int.max`. A closed range ending at `Int.max` (`bits[members: ...Int.max]`, `bits[members: 0 ... Int.max]`) needs the index after `Int.max`, so it trapped with "Index out of bounds", while `..<Int.max` and `0...` worked. Resolve against a small internal collection of all `Int` values whose `index(after:)` saturates at `Int.max`. `Int.max` can never be a bit set member, so `lower ... Int.max` resolving to `lower ..< Int.max` doesn't change which members are selected. `BitSet.Counted[members:]` forwards to `BitSet`, so it's fixed too.
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.)