We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b895e1 commit 875deacCopy full SHA for 875deac
1 file changed
Sources/SwiftSyntax/Trivia+commentValue.swift
@@ -68,8 +68,11 @@ extension Trivia {
68
// because it won't have any indentation since it starts with /**
69
let indentation = lines.dropFirst()
70
.map { $0.prefix(while: { $0 == " " || $0 == "\t" }) }
71
- .reduce(nil as Substring?) { (acc: Substring?, element: Substring.SubSequence) in
72
- acc.map { commonPrefix($0, element) } ?? element
+ .reduce(nil as Substring?) { (acc: Substring?, element: Substring) in
+ guard let acc else {
73
+ return element
74
+ }
75
+ return commonPrefix(acc, element)
76
}
77
78
guard let firstLine = lines.first else {
0 commit comments