diff --git a/Sources/SwiftSyntax/SyntaxText.swift b/Sources/SwiftSyntax/SyntaxText.swift index 790553b5264..9360f9d31b3 100644 --- a/Sources/SwiftSyntax/SyntaxText.swift +++ b/Sources/SwiftSyntax/SyntaxText.swift @@ -100,10 +100,10 @@ public struct SyntaxText { guard !self.isEmpty && !other.isEmpty else { return self.isEmpty && other.isEmpty } - let first: Bool = other.baseAddress! <= self.baseAddress! - let second = UnsafePointer(self.baseAddress! + count) - let third = UnsafePointer(other.baseAddress! + other.count) - return (first && second <= third) + let doesOtherIncludeSelfBaseAddress: Bool = other.baseAddress! <= self.baseAddress! + let sendEndBound = UnsafePointer(self.baseAddress! + count) + let otherEndBound = UnsafePointer(other.baseAddress! + other.count) + return (doesOtherIncludeSelfBaseAddress && sendEndBound <= otherEndBound) } /// Returns `true` if `other` is a substring of this ``SyntaxText``.