-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Sema: Report public conformances to non-publicly imported protocols #74142
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
Conversation
@swift-ci Please smoke test |
@@ -3645,7 +3645,8 @@ ERROR(decl_from_hidden_module,none, | |||
"in an extension with public or '@usableFromInline' members|" | |||
"in an extension with conditional conformances|" | |||
"in an extension with public, package, or '@usableFromInline' members|" | |||
"in an extension with conditional conformances}1; " | |||
"in an extension with conditional conformances|" | |||
"in an exported conformance}1; " |
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 diagnostic text is not ideal but I'd rather keep it simple until this is merged back to 6.0 to avoid complications.
Thank you! |
@swift-ci Please smoke test |
lib/Sema/ResilienceDiagnostics.cpp
Outdated
reason != ExportabilityReason::ExtensionWithPackageMembers && | ||
reason != ExportabilityReason::ExtensionWithConditionalConformances && | ||
reason != ExportabilityReason::ExtensionWithPackageConditionalConformances) | ||
bool reportHere = |
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.
Would it maybe make sense to use a switch
to cover ExportabilityReason
? It seems like it could clean this up a bit.
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.
Good idea. I was trying to find ways to simplify this logic and didn't consider this alternative. It's updated.
@swift-ci Please smoke test |
Exportability checking for non-public imports relies on classic access-level checks for some of the work. However while conforming to a local internal protocol from a public type is allow we should disallow it for imported types, even when imported as internal. Track exportability issues on conformances to protocols separately from the general category. Use that information to improve the diagnostics and report these issues for access-level on imports. rdar://128420980
6ae12d7
to
275c534
Compare
275c534
to
e5bc35b
Compare
@swift-ci Please smoke test |
Exportability checking for non-public imports relies on classic access-level checks for some of the work. However while conforming to a local internal protocol from a public type is allow we should disallow it for imported types, even when imported as internal.
Track exportability issues on conformances to protocols separately from the general category. Use that information to improve the diagnostics and report these issues for access-level on imports.
rdar://128420980