Skip to content

Fix missing break in nested IfConfig decls. Fixes #779. #780

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
Jul 26, 2024

Conversation

shawnhyam
Copy link
Contributor

No description provided.

@bnbarham bnbarham requested review from allevato and ahoppen July 25, 2024 17:12
@@ -1453,6 +1453,8 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
}

override func visit(_ node: IfConfigDeclSyntax) -> SyntaxVisitorContinueKind {
// there has to be a break after an #endif
after(node.poundEndif, tokens: .break(.same, size: 0))
Copy link
Member

Choose a reason for hiding this comment

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

Out of interest? What does size: 0 mean here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the number of blank spaces that would be inserted, if this break was interpreted as a space instead of a newline. To be honest it feels like this should be a non-discretionary line break, but this is how it's done in a very similar case PostfixIfConfigExpr, so I am following that.

Copy link
Contributor

@dduan dduan left a comment

Choose a reason for hiding this comment

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

🎉

@ahoppen ahoppen merged commit b268009 into swiftlang:main Jul 26, 2024
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.

3 participants