-
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
[NFC] Add 'package' access modifier to AccessLevel #62652
Conversation
@swift-ci test |
This PR contains changes in #62704, which will be rebased after it merges. |
@swift-ci test |
f324a65
to
169cb0f
Compare
@swift-ci test |
Could you also add a test case in the new parser to make sure we parse it correctly there as well? |
@elsh already did swift-syntax: swiftlang/swift-syntax#1156 and swiftlang/swift-syntax#1163 |
Oh, nice. I didn’t remember those PRs. |
Resolves rdar://103534243
Resolves rdar://104198440
@swift-ci test |
@swift-ci test |
@@ -1742,6 +1742,7 @@ SDKContext::shouldIgnore(Decl *D, const Decl* Parent) const { | |||
case AccessLevel::Private: | |||
case AccessLevel::FilePrivate: | |||
return true; | |||
case AccessLevel::Package: | |||
case AccessLevel::Public: | |||
case AccessLevel::Open: | |||
break; |
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.
We may want to revisit this later. I believe this logic is used by the ABI checker to report changes that would break clients that were built against an old ABI and couldn't use the new ABI at runtime. Package clients should always be version locked, the ABI checker can likely ignore package ABI breaks.
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.
As is it's more restrictive, so making it more permissive later shouldn't be a problem.
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 to know. Will add a note to keep track.
@@ -1516,6 +1517,7 @@ SubclassScope SILDeclRef::getSubclassScope() const { | |||
// SILModule, so we don't need to do anything. | |||
return SubclassScope::NotApplicable; | |||
case AccessLevel::Internal: | |||
case AccessLevel::Package: | |||
case AccessLevel::Public: | |||
// If the class is internal or public, it can only be subclassed from | |||
// the same AST Module, but possibly a different SILModule. |
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 whole function is interesting for what we discussed about packageopen
.
🎉 |
This PR adds a new access modifier
package
but doesn't do anything with it yet.Ref: swiftlang/swift-evolution#1877
The
package
access level will be similar topublic
in that it's accessible from other modules and subclassable only within the defining module as long as the modules are in the same package.The upcoming PRs will address properly type-checking with the
package
access modifier.Resolves rdar://103462581, rdar://104198440