Skip to content

Commit 24094ef

Browse files
committed
Consdider empty string segments as present
String segments can be empty if they occur in an empty string literal or in between two interpolation segments.
1 parent 0e2b31e commit 24094ef

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)