Skip to content

Sema: ignore inconsistent imports from a file generated by Xcode #71559

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
Feb 13, 2024

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Feb 12, 2024

In Swift 5 mode, the compiler reports when two different files import the same module, where one file has a default/bare import and the other an access-level import. This prevents unintentionally promoting the import to public when preexisting code marked it otherwise.

Exempt a file generated by Xcode from this check as it's not user modifiable and the generated code cannot know if the rest of the module is using access-level on imports or not. This is an issue only in Swift 5 mode, the import visibility defaulting to internal in Swift 6 mode should handle this use case properly.

In the future, we should identify such generated files properly. Either with a new attribute or in the way they are passed to the compiler.

rdar://122032472

In Swift 5 mode, the compiler reports when two files import the same
module, where one file has a bare import and the other an access-level
import. This avoids unintentionally promoting the import to public when
preexisting code marked it otherwise.

Exempt a file generated by Xcode from this check as it's not user
modifiable.

In the future, we should identify such generated files properly. Either
with a new attribute or in the way they are passed to the compiler.

rdar://122032472
@xymus
Copy link
Contributor Author

xymus commented Feb 12, 2024

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Feb 12, 2024

@swift-ci Please smoke test Windows

@xymus xymus merged commit 9f45a4d into swiftlang:main Feb 13, 2024
@xymus xymus deleted the ambiguous-generated branch February 13, 2024 00:43
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