Skip to content

Cherrypick recent changes into swift-5.2-branch. #171

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 6 commits into from
Apr 1, 2020

Conversation

allevato
Copy link
Member

@allevato allevato commented Apr 1, 2020

No description provided.

dylansturg and others added 6 commits April 1, 2020 13:07
Repeat-while-stmt is intended to keep the right brace next to the `while` token, like if-else statements. Previously, there wasn't a group so the pretty printer was allowing the repeat body to not have any breaks when the while condition overflowed the line.
These don't receive any special treatment, and instead are sorted as code blocks. That's done intentionally because the code block in a conditional can be complex, containing multiple imports or even non-import code (e.g. a typealias). Sorting them in with other imports would only be a sepcial case for the simplest conditional blocks.

I considered treating these like ignored imports, which are kept as-is. That has the drawback of forcing all imports before and after the conditional to be kept in place, which prevents sorting.
TSC was mostly used for its argument parser. Now that
we've migrated to swift-argument-parser, the remaining
file system and path APIs in TSC are only used by the
Format command and can be fairly easily replaced by
Foundation APIs instead.
When the author inserts a newline between the `import` token and the imported path, that newline shouldn't be considered when sorting the paths.
This ensures that the test function always exists, even if the
symbol is not defined, so that `--generate-linuxmain` contains
the symbol in both cases. When the symbol is undefined, the
empty test will vacuously succeed.
@allevato allevato merged commit 1fda398 into swiftlang:swift-5.2-branch Apr 1, 2020
aaditya-chandrasekhar pushed a commit to val-verde/swift-format that referenced this pull request May 20, 2021
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.

2 participants