File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,15 @@ public enum FixItApplier {
107
107
return edit == remainingEdit
108
108
}
109
109
110
- return remainingEdit. range. overlaps ( edit. range)
110
+ // Edits conflict in the following cases:
111
+ //
112
+ // - Their ranges have a common element.
113
+ // - One's range is empty and its lower bound is strictly within the
114
+ // other's range. So 0..<2 also conflicts with 1..<1, but not with
115
+ // 0..<0 or 2..<2.
116
+ //
117
+ return edit. endUtf8Offset > remainingEdit. startUtf8Offset
118
+ && edit. startUtf8Offset < remainingEdit. endUtf8Offset
111
119
}
112
120
113
121
guard !shouldDropRemainingEdit( ) else {
Original file line number Diff line number Diff line change @@ -232,9 +232,8 @@ class FixItApplierApplyEditsTests: XCTestCase {
232
232
. init( range: 0 ..< 5 , replacement: " _ " ) , // Replacement
233
233
. init( range: 2 ..< 2 , replacement: " a " ) , // Insertion
234
234
] ,
235
- // FIXME: This behavior where these edits are not considered overlapping doesn't feel desirable
236
235
outputs: [
237
- . init( oneOf: " _x = 1" , " _ a = 1" )
236
+ . init( oneOf: " _ = 1" , " vaar x = 1" )
238
237
]
239
238
)
240
239
}
You can’t perform that action at this time.
0 commit comments