-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Rename ExtensionImportVisibility to MemberImportVisibility and fix bugs #73063
Rename ExtensionImportVisibility to MemberImportVisibility and fix bugs #73063
Conversation
e6c75ca
to
d875291
Compare
This feature controls lookup behavior for members in general, not just extension members. Resolves rdar://126491324
- Reorganize test cases - Add tests cases for multi-file and contextual base lookup - Verify behavior without `MemberImportVisibility` feature NFC.
Make sure suggested imports are consistent with imports in other files. Also, make sure the underlying clang module is always imported `@_exported`.
This results in clearer source locations for diagnostics.
d875291
to
865c26c
Compare
@swift-ci please smoke test |
@@ -167,9 +167,9 @@ ERROR(init_candidate_inaccessible,none, | |||
|
|||
ERROR(candidate_from_missing_import,none, | |||
"%0 %1 is not available due to missing import of defining module %2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment as this wasn't introduced in this PR. Should we try to avoid available
here as it points to the availability system, maybe reachable
or visible
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's good feedback. Perhaps we should use the word "inaccessible" which would match the wording of diagnostics about declarations that are unavailable due to access levels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect to continue refining this implementation, so I'll track this as something to re-evaluate in the next PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this should not block this PR. And "inaccessible" sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you!
Rename the
ExtensionImportVisibility
experimental feature introduced in #72060 toMemberImportVisibility
. Although extension members are the members that are most often accidentally visible via transitive imports, the effects of enabling the feature are not limited to lookup of members on extensions. The test cases added in this PR provide examples of additional situations where these diagnostics will take effect.In addition to renaming the experimental feature, this PR also refines the implementation, increases test coverage, and fixes a couple of bugs:
@_implementationOnly
or@_exported
) are now prepended to theimport Module
fix-it.Resolves rdar://126491324 and #46493.