Skip to content

Commit 3d79237

Browse files
authored
Merge pull request #796 from ahoppen/fix-warnings
Fix build warnings
2 parents 021a5ab + 6e0e645 commit 3d79237

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
527527
/// Arranges the `async` and `throws` effect specifiers of a function or accessor declaration.
528528
private func arrangeEffectSpecifiers<Node: EffectSpecifiersSyntax>(_ node: Node) {
529529
before(node.asyncSpecifier, tokens: .break)
530-
before(node.throwsSpecifier, tokens: .break)
530+
before(node.throwsClause?.throwsSpecifier, tokens: .break)
531531
// Keep them together if both `async` and `throws` are present.
532-
if let asyncSpecifier = node.asyncSpecifier, let throwsSpecifier = node.throwsSpecifier {
532+
if let asyncSpecifier = node.asyncSpecifier, let throwsSpecifier = node.throwsClause?.throwsSpecifier {
533533
before(asyncSpecifier, tokens: .open)
534534
after(throwsSpecifier, tokens: .close)
535535
}
@@ -2302,9 +2302,11 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
23022302

23032303
override func visit(_ node: AttributedTypeSyntax) -> SyntaxVisitorContinueKind {
23042304
arrangeAttributeList(node.attributes)
2305-
after(
2306-
node.specifier,
2307-
tokens: .break(.continue, newlines: .elective(ignoresDiscretionary: true)))
2305+
for specifier in node.specifiers {
2306+
after(
2307+
specifier.firstToken(viewMode: .sourceAccurate),
2308+
tokens: .break(.continue, newlines: .elective(ignoresDiscretionary: true)))
2309+
}
23082310
return .visitChildren
23092311
}
23102312

Sources/SwiftFormat/Rules/UseSynthesizedInitializer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public final class UseSynthesizedInitializer: SyntaxLintRule {
3636
// Collect any possible redundant initializers into a list
3737
} else if let initDecl = member.as(InitializerDeclSyntax.self) {
3838
guard initDecl.optionalMark == nil else { continue }
39-
guard initDecl.signature.effectSpecifiers?.throwsSpecifier == nil else { continue }
39+
guard initDecl.signature.effectSpecifiers?.throwsClause == nil else { continue }
4040
initializers.append(initDecl)
4141
}
4242
}

Sources/SwiftFormat/Rules/ValidateDocumentationComments.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public final class ValidateDocumentationComments: SyntaxLintRule {
6262
}
6363

6464
validateThrows(
65-
signature.effectSpecifiers?.throwsSpecifier,
65+
signature.effectSpecifiers?.throwsClause?.throwsSpecifier,
6666
name: name,
6767
throwsDescription: docComment.throws,
6868
node: node)

Sources/generate-swift-format/FileGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extension FileGenerator {
3535
}
3636
}
3737

38-
extension FileHandle: TextOutputStream {
38+
extension FileHandle {
3939
/// Writes the provided string as data to a file output stream.
4040
public func write(_ string: String) {
4141
guard let data = string.data(using: .utf8) else { return }

0 commit comments

Comments
 (0)