Skip to content

Conversation

dylansturg
Copy link
Contributor

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.

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.
@allevato allevato merged commit 3a45df0 into swiftlang:master Mar 26, 2020
@dylansturg dylansturg deleted the conditional_import_tests branch April 15, 2020 20:36
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