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 @@ -103,7 +103,15 @@ public enum FixItApplier {
103
103
return edit == remainingEdit
104
104
}
105
105
106
- return remainingEdit. range. overlaps ( edit. range)
106
+ // Edits conflict in the following cases:
107
+ //
108
+ // - Their ranges have a common element.
109
+ // - One's range is empty and its lower bound is strictly within the
110
+ // other's range. So 0..<2 also conflicts with 1..<1, but not with
111
+ // 0..<0 or 2..<2.
112
+ //
113
+ return edit. endUtf8Offset > remainingEdit. startUtf8Offset
114
+ && edit. startUtf8Offset < remainingEdit. endUtf8Offset
107
115
}
108
116
109
117
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