mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
[PersistentCollections] Fix up code added since c73a8caa originally landed
(cherry picked from commit 4c842df1b8)
This commit is contained in:
1 parent
bceadab267
commit
25fd503fac
5 files changed
+7
-5
No files matched your search
@@ -18,7 +18,9 @@ extension PersistentSet {
|
||||
public mutating func remove(at position: Index) -> Element {
|
||||
precondition(_isValid(position))
|
||||
_invalidateIndices()
|
||||
return _root.remove(.top, at: position._path).key
|
||||
let r = _root.remove(.top, at: position._path)
|
||||
precondition(r.remainder == nil)
|
||||
return r.removed.key
|
||||
}
|
||||
|
||||
/// Replace the member at the given index with a new value that compares equal
|
||||
|
||||
@@ -102,7 +102,7 @@ extension PersistentSet {
|
||||
}
|
||||
|
||||
// FIXME: Would making this a BitSet of seen positions be better?
|
||||
var seen: _Node? = ._empty()
|
||||
var seen: _Node? = ._emptyNode()
|
||||
var it = other.makeIterator()
|
||||
while let item = it.next() {
|
||||
let hash = _Hash(item)
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ extension PersistentSet {
|
||||
}
|
||||
|
||||
// FIXME: Would making this a BitSet of seen positions be better?
|
||||
var seen: _Node = ._empty()
|
||||
var seen: _Node = ._emptyNode()
|
||||
var doneCollecting = false
|
||||
var isStrict = false
|
||||
var it = other.makeIterator()
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ extension PersistentSet {
|
||||
}
|
||||
|
||||
// FIXME: Would making this a BitSet of seen positions be better?
|
||||
var seen: _Node = ._empty()
|
||||
var seen: _Node = ._emptyNode()
|
||||
for item in other {
|
||||
let hash = _Hash(item)
|
||||
guard self._root.containsKey(.top, item, hash) else { return false }
|
||||
|
||||
@@ -99,7 +99,7 @@ extension PersistentSet {
|
||||
}
|
||||
|
||||
// FIXME: Would making this a BitSet of seen positions be better?
|
||||
var seen: _Node = ._empty()
|
||||
var seen: _Node = ._emptyNode()
|
||||
for item in other {
|
||||
let hash = _Hash(item)
|
||||
guard _root.containsKey(.top, item, hash) else { continue }
|
||||
|
||||
Reference in new issue
Block a user