diff --git a/Sources/PersistentCollections/Node/_Node+isDisjoint.swift b/Sources/PersistentCollections/Node/_Node+isDisjoint.swift index a5a86288..3e1abb92 100644 --- a/Sources/PersistentCollections/Node/_Node+isDisjoint.swift +++ b/Sources/PersistentCollections/Node/_Node+isDisjoint.swift @@ -76,6 +76,20 @@ extension _Node { ) -> Bool { // Beware, self might be on a compressed path assert(isCollisionNode) + if other.isCollisionNode { + return read { l in + other.read { r in + let lh = l.collisionHash + let rh = r.collisionHash + guard lh == rh else { return true } + let litems = l.reverseItems + let ritems = r.reverseItems + return litems.allSatisfy { li in + !ritems.contains { ri in li.key == ri.key } + } + } + } + } return read { let items = $0.reverseItems let hash = $0.collisionHash