Skip to content

Commit f753b75

Browse files
authored
Merge pull request #599 from ahoppen/pr/string-segment-can-be-empty
2 parents ccb69f6 + 24094ef commit f753b75

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SwiftSyntax/RawSyntax.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,10 @@ extension RawSyntax {
260260
// We always consider collections 'present' because they can just be empty.
261261
return .present
262262
}
263-
if isToken && self.rawTokenKind == .eof {
263+
if isToken && (self.rawTokenKind == .eof || self.rawTokenKind == .stringSegment) {
264264
// The end of file token never has source code associated with it but we
265265
// still consider it valid.
266+
// String segments can be empty if they occur in an empty string literal or in between two interpolation segments.
266267
return .present
267268
}
268269

0 commit comments

Comments
 (0)