Skip to content

Fix line breaking for attributes in inheritance clauses by grouping them with their type #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

TTOzzi
Copy link
Member

@TTOzzi TTOzzi commented Jun 22, 2025

Resolve #1032

@@ -2357,7 +2357,9 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
}

override func visit(_ node: InheritedTypeSyntax) -> SyntaxVisitorContinueKind {
before(node.firstToken(viewMode: .sourceAccurate), tokens: .open)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this new logic into the visit method for AttributedTypeSyntax instead? Then it we'll get the grouping in a bunch of other places that we have attributed/modified types, like @Sendable () -> Void or consuming T, not just in inheritance lists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback! I've applied the changes.

@TTOzzi TTOzzi force-pushed the encapsulating-inherited-type branch from 6b77fa9 to 3041452 Compare June 26, 2025 15:18
cmp: @escaping (R) ->
()
cmp:
@escaping (R) -> ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I was hoping we'd find some others with that change.

@allevato allevato merged commit c2b33f2 into swiftlang:main Jun 26, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor line breaking around @unchecked Sendable
2 participants