Differ icon indicating copy to clipboard operation
Differ copied to clipboard

Items that do not move show as being moved

Open Chandlerdea opened this issue 6 years ago • 3 comments

I am seeing some weird behavior when diffing arrays which have contents that do not move. Here is the scenario:

I have two arrays, which look like this:

Old array: ([Int]) $R90 = 20 values {
  [0] = 63
  [1] = 5
  [2] = 112
  [3] = 48
  [4] = 100006
  [5] = 121
  [6] = 33
  [7] = 65
  [8] = 100003
  [9] = 57
  [10] = 100007
  [11] = 117
  [12] = 108
  [13] = 1
  [14] = 118
  [15] = 100688
  [16] = 18
  [17] = 54
  [18] = 116
  [19] = 110
}
New array: ([Int]) $R91 = 20 values {
  [0] = 65
  [1] = 118
  [2] = 110
  [3] = 117
  [4] = 100006
  [5] = 112
  [6] = 1
  [7] = 54
  [8] = 116
  [9] = 100688
  [10] = 48
  [11] = 57
  [12] = 108
  [13] = 63
  [14] = 121
  [15] = 33
  [16] = 18
  [17] = 5
  [18] = 100003
  [19] = 100007
}

One of the patches returned the extendedPatch() function looks like this:

 [13] = move {
    move = (from = 20, to = 16)
  }

This is causing a crash in my app, because there is no item at index 20 in the array. You can see that the object at index 16 doesn't move, but for some reason the library is saying that it has moved.

Chandlerdea avatar Apr 30 '18 18:04 Chandlerdea