The replacement callback took a single span and then required the source count to be exhausted, so a container stored in more than one span trapped.
Fixes#751
Co-authored-by: Cursor <cursoragent@cursor.com>
The generic `isEqualSet(to: some Sequence<Int>)` overload returned false
whenever `other.underestimatedCount` exceeded `count`. A sequence with
duplicate items can be longer than the set it equals, so
`([1, 2, 3, 4] as BitSet.Counted).isEqualSet(to: [4, 1, 1, 2, 3, 3, 4] as [Int])`
returned false, contradicting the documented behavior.
Forward straight to `BitSet.isEqualSet(to:)`, which already handles
duplicates and keeps the count shortcut for unique collections.
It would take too much effort to try to mitigate stdlib differences.
Fix low-hanging warnings, but turn off `.strictMemorySafety` on older toolchains by splitting the package manifest.
SortedSet's set operations only accepted another SortedSet, so
SortedSet([1, 2]).union(0 ..< 10) did not compile and the type could
not conform to SetAPIChecker.
Add the customary Sequence generalizations for all 13 operations,
keeping the existing Self overloads as the fast path (concrete beats
generic in overload resolution). Arbitrary sequences fall back through
a temporary SortedSet or, for the membership predicates, allSatisfy.
Fixes#743.
Signed-off-by: Aniket <aniketkomailkro@gmail.com>
test_subSequence_Equatable only compared three single-leaf slices with
expectEqual and expectNotEqual. Also run checkHashable, adding empty
slices, equal slices cut from bulk-built and inserted dictionaries, and
ones that differ from them only in a value or only in their keys.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_values_Equatable only ran checkEquatable over single-leaf
dictionaries. Run checkHashable instead, and add a multi-level class
built in bulk and by insertion with different keys but the same values,
plus one that differs in a single value past the first leaf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_keys_Equatable only ran checkEquatable over single-leaf
dictionaries. Run checkHashable instead, and add a multi-level class
built in bulk and by insertion with different values, plus one that
differs in a single key past the first leaf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SortedDictionary conforms to Hashable but was never run through
checkHashable. The multi-level dictionary is built both in bulk and by
insertion, so equal dictionaries with different tree layouts must
compare and hash equal; the last two classes differ from it in one key
or one value past the first leaf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SortedSet.SubSequence has its own copy of SortedSet's == and
hash(into:), and neither was tested. Equal slices are taken from
bulk-built and inserted sets, so they start at different leaf offsets;
the last two classes match the evens slice in count and endpoints and
differ only past the first leaf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SortedSet conforms to Hashable but was never run through checkHashable.
Multi-level sets are built both in bulk and by insertion, so equal sets
with different tree layouts must compare and hash equal. The last two
classes match the evens in count and endpoints and differ only past the
first leaf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SortedSet conforms to BidirectionalCollection but was never run through
checkBidirectionalCollection. The counts sit on either side of the sizes
where a debug-build tree gains a level, and each is checked both
bulk-built and built by insertion, since the two give differently shaped
trees.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>