swift-syntax icon indicating copy to clipboard operation
swift-syntax copied to clipboard

Merge `IncrementalEdit` and `SourceEdit`

Open ahoppen opened this issue 1 year ago • 1 comments

After https://github.com/apple/swift-syntax/pull/2527, IncrementalEdit and SourceEdit are more or less equivalent types. Both store a replacement range and a replacement. The only meaningful difference is that SourceEdit has String as a replacement and IncrementalEdit has an array of bytes as a replacement and can thus also represent invalid UTF-8. We should merge them, ideally into a type that is byte-based (because it’s more versatile) but that offers String-based accessors.

The best outcome would be if SourceEdit could be the type that’s used to represent the edits, IncrementalEdit becomes a deprecated typealias to SourceEdit and SourceEdit gains (possibly deprecated) members for all the members that IncrementalEdit had, for API compatibility.

ahoppen avatar Mar 06 '24 05:03 ahoppen

Tracked in Apple’s issue tracker as rdar://124118127

ahoppen avatar Mar 06 '24 06:03 ahoppen