mirror of
https://github.com/apple/swift-collections
synced 2026-11-22 04:20:40 +00:00
Two keys with equal hashes whose hash also agrees with a third key on every level except the last end up in a collision node that sits below the last hash level. Removing one of the colliding keys (remove, removeValue, subscript setter/_modify to nil, subtracting, filter, symmetricDifference, ...) computed `hash[level]` for that node, which trips the `assert(!level.isAtBottom)` in `_Hash.subscript` in debug builds. Collision nodes don't use buckets, and parents replace the bucket of an inlined child item with their own, so release builds were not affected. Skip the bucket lookup at the bottom level, the same way lookups in `_findInCollision` already do.