-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Sema: Omit internal
from MemberImportVisibility
fix-its when appropriate
#81781
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
Sema: Omit internal
from MemberImportVisibility
fix-its when appropriate
#81781
Conversation
cb75108
to
5c9cad5
Compare
@swift-ci please smoke test |
…opriate. Omit an explicit access level from `MemberImportVisibility` fix-its under the following conditions: - `InternalImportsByDefault` is enabled. - The required import needs an `internal` access level or lower. - The module is not yet imported explicitly in any other file. Resolves rdar://149577615.
5c9cad5
to
dbb1d78
Compare
@swift-ci please smoke test |
@swift-ci please smoke test Windows |
auto accessLevelForImport = [&]() -> std::optional<AccessLevel> { | ||
auto maxAccessLevel = sf.getMaxAccessLevelUsingImport(mod); | ||
if (internalImportsByDefaultEnabled) { | ||
if (!foundImport && maxAccessLevel <= AccessLevel::Internal) |
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.
Do we need to check for imports in other files here? In internal-imports-by-default mode the access-level in other files shouldn't mater, the inconsistency diagnostics is disabled in that mode.
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.
My thinking is that we should follow the style that the developer is already using. If they write explicit access levels on imports of the module in other files, then the fix-it should too (which is handled by the logic below).
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.
Ah ok, that makes sense.
Omit an explicit access level from
MemberImportVisibility
fix-its under the following conditions:InternalImportsByDefault
is enabled.internal
access level or lower.Resolves rdar://149577615.