Skip to content

OrderedImports should create separate group for @_implementationOnly … #1013

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 3 commits into from
May 7, 2025

Conversation

ebgraham
Copy link
Contributor

@ebgraham ebgraham commented May 6, 2025

The OrderedImports rule should create a separate import grouping for @_implementationOnly imports to go with the current @testable group. The code is refactored a bit to enable a future change for public/internal/private import grouping, and to harden again other import attributes like @preconcurrency.

Discussed in #703.

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

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

Can you make sure to run swift-format on the changes, and add the new enum case to api-breakages.txt?

@ahoppen @bnbarham This will likely impact how swift-syntax's sources are formatted. For changes like this, do we just need to fast-follow a change to swift-syntax after this is submitted?

@ahoppen
Copy link
Member

ahoppen commented May 7, 2025

We should have the swift-syntax PR ready to be merged before this one is merged and then merge this PR and the swift-syntax PR at the same time.

Edit: Actually, the formatting of swift-syntax is checked against the latest released Swift toolchain, so swift-syntax doesn’t need to be updated. So, we should be good to merge this one.

@@ -18,3 +18,4 @@ API breakage: func Configuration.MultilineStringReflowBehavior.hash(into:) has b
API breakage: func Configuration.MultilineStringReflowBehavior.encode(to:) has been removed
API breakage: var Configuration.MultilineStringReflowBehavior.hashValue has been removed
API breakage: constructor Configuration.MultilineStringReflowBehavior.init(from:) has been removed
API breakage: enum LineType.implementationOnlyImport has been added as a new enum case
Copy link
Member

Choose a reason for hiding this comment

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

This check is still failing; the message needs to be copied verbatim from the error in the CI log:

API breakage: enumelement LineType.implementationOnlyImport has been added as a new enum case

(enumelement, not enum)

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!

@allevato allevato merged commit ae522f2 into swiftlang:main May 7, 2025
21 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.

3 participants