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