-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[6.0] Sema: Improve warnings and notes related to access-level on imports #73203
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
xymus
merged 7 commits into
swiftlang:release/6.0
from
xymus:access-level-import-diags-6.0
Apr 24, 2024
Merged
[6.0] Sema: Improve warnings and notes related to access-level on imports #73203
xymus
merged 7 commits into
swiftlang:release/6.0
from
xymus:access-level-import-diags-6.0
Apr 24, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The warnings on superfluously public/package imports has a hole where it could report a package import as not being used by package decls even if it provides a type extended by a package extension. This is caused by the exportability checker not being enabled for package decls, thus not triggering the usual logic registering this reference. Address this issue by adding a check specifically for package extensions. We can remove this check once we have exportability checking for package decls. rdar://126712864
…ings Adoption InternalImportsByDefault provides a safe access-level by default to imports, as such ambiguities are not a risk and showing this warning is superflous. When this warning is shown, make sure we note this alternative.
Report uses of `@_implementationOnly` in resilient modules as deprecated. With a fixit to replace it with `internal` or delete it when imports are internal by default. Uses of `@_implementationOnly` in non-resilient modules is already reported as being unsafe.
Access-level on imports limit where decls from the target module can be referenced. This is reported by the typical error about and a note on the import. However, when using an IDE and editing a large file, the note on the import is easy to miss. Address this by duplicating the information on the error line as well so it's never out of the current viewport. rdar://119438201
@swift-ci Please test |
nkcsgexi
approved these changes
Apr 23, 2024
@swift-ci Please test Linux |
Both macOS and Linux failed under the SourceKitLSPPackageTests. @swift-ci Please test macOS |
@swift-ci Please test Linux |
It looks like infrastructure issues around SourceKitLSPPackageTests and SwiftPMWorkspaceTests. @swift-ci Please test macOS |
@swift-ci Please test Linux |
It should have been fixed. @swift-ci Please test macOS |
@swift-ci Please test Linux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
General improvements to diagnostics around access-level on imports:
internal import
.Scope: Users of access-level on imports.
Risk: Low, this only adds and removes warnings and notes.
Reviewed by @tshortli and @nkcsgexi
Cherry-pick of #73125, #73176, #73179 and #73183
Resolves rdar://126712864&119438201