mirror of
https://github.com/apple/swift-collections
synced 2026-11-24 04:27:53 +00:00
[Capsule] Add precondition violation error message
This commit is contained in:
1 parent
b4c7f1dd51
commit
68948e1da7
1 file changed
+2
-2
@@ -184,7 +184,7 @@ final class BitmapIndexedMapNode<Key, Value> : MapNode where Key : Hashable {
|
||||
if (!effect.modified) { return self }
|
||||
switch subNodeNew.sizePredicate {
|
||||
case .sizeEmpty:
|
||||
preconditionFailure()
|
||||
preconditionFailure("Sub-node must have at least one element.")
|
||||
case .sizeOne:
|
||||
if (self.payloadArity == 0 && self.bitmapIndexedNodeArity == 1) { // escalate (singleton or empty) result
|
||||
return subNodeNew
|
||||
@@ -219,7 +219,7 @@ final class BitmapIndexedMapNode<Key, Value> : MapNode where Key : Hashable {
|
||||
if (!effect.modified) { return self }
|
||||
switch subNodeNew.sizePredicate {
|
||||
case .sizeEmpty:
|
||||
preconditionFailure()
|
||||
preconditionFailure("Sub-node must have at least one element.")
|
||||
case .sizeOne:
|
||||
// TODO simplify hash-collision compaction (if feasible)
|
||||
if (self.payloadArity == 0 && (self.bitmapIndexedNodeArity + self.hashCollisionNodeArity) == 1) { // escalate (singleton or empty) result
|
||||
|
||||
Reference in new issue
Block a user