Skip to content

Commit ff73fe5

Browse files
committed
(fix): Bug where SourceEdit returns a negative length
1 parent 315a2e4 commit ff73fe5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SwiftSyntax/SourceEdit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public struct SourceEdit: Equatable, Sendable {
2121
/// Length of the original source range that this edit applies to. Zero if
2222
/// this is an addition.
2323
public var length: SourceLength {
24-
return SourceLength(utf8Length: range.lowerBound.utf8Offset - range.upperBound.utf8Offset)
24+
return SourceLength(utf8Length: range.upperBound.utf8Offset - range.lowerBound.utf8Offset)
2525
}
2626

2727
/// Create an edit to replace `range` in the original source with

0 commit comments

Comments
 (0)