File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -199,11 +199,19 @@ public enum Diff {
199
199
dictionary [ key] = i
200
200
}
201
201
202
+ var finalKeys = Set < OptimizedIdentity < Identity > > ( )
203
+
202
204
for (i, items) in finalItemCache. enumerated ( ) {
203
205
for j in 0 ..< items. count {
204
206
let item = items [ j]
205
207
var identity = item. identity
206
208
let key = OptimizedIdentity ( & identity)
209
+
210
+ if finalKeys. contains ( key) {
211
+ throw Error . duplicateItem ( item: item)
212
+ }
213
+ finalKeys. insert ( key)
214
+
207
215
guard let initialItemPathIndex = dictionary [ key] else {
208
216
continue
209
217
}
@@ -518,8 +526,16 @@ public enum Diff {
518
526
var initialSectionData = ContiguousArray < SectionAssociatedData > ( repeating: SectionAssociatedData . initial, count: initialSections. count)
519
527
var finalSectionData = ContiguousArray < SectionAssociatedData > ( repeating: SectionAssociatedData . initial, count: finalSections. count)
520
528
529
+ var finalSectionIdentities = Set < Section . Identity > ( )
530
+
521
531
for (i, section) in finalSections. enumerated ( ) {
522
532
finalSectionData [ i] . itemCount = finalSections [ i] . items. count
533
+
534
+ if finalSectionIdentities. contains ( section. identity) {
535
+ throw Error . duplicateSection ( section: section)
536
+ }
537
+ finalSectionIdentities. insert ( section. identity)
538
+
523
539
guard let initialSectionIndex = initialSectionIndexes [ section. identity] else {
524
540
continue
525
541
}
You can’t perform that action at this time.
0 commit comments