Package traits already pass defines with their trait name when building. Instead of adding our own conditional defines based on the traits we can use the trait provided defines directly. I observed that various tooling behaves better with the trait provided defines.
This re-enables the SortedCollections for easi(er) experimentation.
The module remains source unstable — it may go away entirely or it may receive arbitrary source-breaking changes in any new swift-collections release, with no special pre-announcement.
When removing elements from a B-tree, the root node could become empty while still having children. The previous code incorrectly called drop() which deallocated all children, causing massive data loss during removal operations.
This fix implements proper root reduction by moving the single remaining child out of the empty root, then safely dropping the now-empty parent node and promoting the extracted child to become the new root.
This fixes `test_modifySubscriptRemoval` in `SortedDictionaryTests`, so we re-enable SortedDictionary tests which now all pass.
Key Changes:
- Add tests and benchmarks for SortedSet
- Fix bug during _Node.UnsafeHandle.popFirstElement() rebalancing
- Enable _Node.UnsafeHandle.subscript(elementAt:) to work on value-less nodes.
Minor Changes:
- Optimize Codable to use _BTree.Builder and forEach
- Codable now checks for order, not strictly uniqueness
- Add smaller node size for debug builds to easily catch errors
Key Changes:
- Implement Equatable, Hashable for SubSequences
- Implement SortedDictionary initializers
- init(keysWithValues:) and init(sortedKeysAndValues:) with named and unnamed variants.
- Expand benchmark suite for SortedDictionary
- Commit _BTree.Builder
Minor Changes:
- Update documentation
- Expand test suits
- Fix bug where SubSequences did not define subscript(bounds: Range<Index>)
- _Node
- Implement `depth` property for `_Node`
- Packs both `depth`, `count`, and `capacity` within a single UInt64.
- Implement `init(leftChild:seperator:rightChild:capacity:)` for `_Node`
- Implement `concatenateWith(node:seperatedBy:)` to `_Node.UnsafeHandle`
- Remove bad invariant check on `_Node.UnsafeHandle` deletion subroutines
- _BTree
- Add invariant checks as `_BTree.checkInvariants()`
- Separate `_BTree.*capacity` into `*size` and `*capacity`
- Make _FixedSizeArray top-level
- Remove deque behavior.
Documentation:
- Update complexity documentation style from 'n' to `self.count`
Testing:
- Expand tests for SortedDictionary
- Add tests for SortedDictionary.Keys
- Add tests for _Node.join(...) routines
- Add tests for _BTree.Builder
- Restore checkBidirectionalCollection tests for _BTree
Major Changes:
- Implement Sequence for SortedSet
Minor Changes:
- Fix bug within _Node.UnsafeHandle.pointerToChild(atSlot:)
- Cleanup cursor implementation and fix bugs.
- Fix various bugs in _BTree.FixedSizeArray