Skip to content

Commit 6b9cdc0

Browse files
committed
Use setCellAtIndex in add and mutableAdd functions
Because adding new element won't cause canonicalization.
1 parent 84e69d1 commit 6b9cdc0

File tree

1 file changed

+2
-2
lines changed
  • core/commonMain/src/implementations/immutableSet

1 file changed

+2
-2
lines changed

core/commonMain/src/implementations/immutableSet/TrieNode.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ internal class TrieNode<E>(
760760
targetNode.add(elementHash, element, shift + LOG_MAX_BRANCHING_FACTOR)
761761
}
762762
if (targetNode === newNode) return this
763-
return updateNodeAtIndex(cellIndex, newNode)
763+
return setCellAtIndex(cellIndex, newNode, owner = null)
764764
}
765765
// element is directly in buffer
766766
if (element == buffer[cellIndex]) return this
@@ -784,7 +784,7 @@ internal class TrieNode<E>(
784784
targetNode.mutableAdd(elementHash, element, shift + LOG_MAX_BRANCHING_FACTOR, mutator)
785785
}
786786
if (targetNode === newNode) return this
787-
return mutableUpdateNodeAtIndex(cellIndex, newNode, mutator.ownership)
787+
return setCellAtIndex(cellIndex, newNode, mutator.ownership)
788788
}
789789
// element is directly in buffer
790790
if (element == buffer[cellIndex]) return this

0 commit comments

Comments
 (0)