Skip to content

Commit 653b68c

Browse files
committed
[stdlib] Fix crucial thinko
1 parent 715ccd7 commit 653b68c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/public/core/Dictionary.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,10 +796,11 @@ extension Dictionary {
796796

797797
// Prepare storage.
798798
// If `key` isn't in the dictionary yet, assume that this access will end
799-
// up inserting it. Otherwise this can only be a removal or an in-place
800-
// mutation. (If we guess wrong, we might needlessly rehash; that's fine.)
799+
// up inserting it. (If we guess wrong, we might needlessly expand
800+
// storage; that's fine.) Otherwise this can only be a removal or an
801+
// in-place mutation.
801802
let (_, rehashed) = _variant.ensureUniqueNative(
802-
withCapacity: self.capacity + (found ? 0 : 1),
803+
withCapacity: self.count + (found ? 0 : 1),
803804
isUnique: isUnique)
804805
// FIXME: we should be able to make this a let; however, some of the
805806
// low-level operations below are (incorrectly) marked as mutating.

0 commit comments

Comments
 (0)