-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Handle package exportability. #73161
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 smoke test |
There are a few failures in e.g.
This one may need an update to the error message:
Can we also test that we're not allowing package decls in public inlinable code? |
ab17a0f
to
d9dec1f
Compare
@swift-ci smoke test |
This PR treats package access level as exportable, preventing internally imported types from accidentally being declared in package decl signatures. Added package-specific cases to ExportabilityReason and DisallowedOriginKind to track the validity of imported types at use sites with package access scope. Added tests to cover variety of use cases. Resolves rdar://117586046&125050064&124484388&124306642
@swift-ci smoke test |
@swift-ci smoke test |
This now affects projects using |
) The exportability rules around `package` access level are updated in a way that an `@_spi public` can't be bound to a `package` var, similar to how `@_spi public` can't be bound to a `public` var. For reference, see swiftlang/swift#73161. This PR corrects such use case.
@swift-ci smoke test |
@@ -2324,7 +2324,7 @@ bool VarDecl::isLayoutExposedToClients() const { | |||
auto nominalAccess = | |||
parent->getFormalAccessScope(/*useDC=*/nullptr, | |||
/*treatUsableFromInlineAsPublic=*/true); | |||
if (!nominalAccess.isPublic()) return false; | |||
if (!nominalAccess.isPublicOrPackage()) return false; |
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.
nitpick: move return false
to a new line for better debuggability.
) - **Explanation**: Cherry-pick swiftlang/swift#73161 to `releases/6.0` so that SwiftPM 6.0 can be built with a `main` Swift development snapshot - **Scope**: Changes access level of a member from `package` to SPI - **Risk**: Very low, just changes the access lavel - **Testing**: n/a - **Issue**: n/a - **Reviewer**: @MaxDesiatov and @bnbarham on #7525
…iftlang#7525) The exportability rules around `package` access level are updated in a way that an `@_spi public` can't be bound to a `package` var, similar to how `@_spi public` can't be bound to a `public` var. For reference, see swiftlang/swift#73161. This PR corrects such use case.
…iftlang#7525) The exportability rules around `package` access level are updated in a way that an `@_spi public` can't be bound to a `package` var, similar to how `@_spi public` can't be bound to a `public` var. For reference, see swiftlang/swift#73161. This PR corrects such use case.
This PR treats package access level as exportable, preventing
internally imported types from accidentally being declared in
package decl signatures.
Added package-specific cases to ExportabilityReason and
DisallowedOriginKind to track the validity of imported types
at use sites with package access scope. Added tests to cover
variety of use cases.
Resolves rdar://117586046&125050064&124484388&124306642