-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Treat @usableFromInline package
decls from interface as public and skip access checks
#75745
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
153d64a
to
a4861ef
Compare
@swift-ci smoke test |
@swift-ci smoke test |
2afcaa2
to
9c3eca9
Compare
@usableFromInline package
decls from interface as public and skip access checks
@swift-ci smoke test |
include/swift/AST/Decl.h
Outdated
/// - Has a @usableFromInline (or other inlinable) attribute | ||
/// - And is defined in a module built from a public or private | ||
/// interface that does not contain package-name. | ||
bool treatAsPublic() const; |
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 name reads a bit too generically to me - if I hadn't read the documentation I wouldn't know what it represents at its use sites. What about something like hasEffectivelyPublicPackageAccess()
?
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.
Sg, probably hasEffectivelyPublicAccess()
.
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 think it should mention package
somehow because it's only meant to be called when you've already determined that the decl has package
level access. I would find it confusing if hasEffectivelyPublicAccess()
returns false
for a decl that is already marked public
for example.
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.
How about isPackageEffectivelyPublic
?
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.
That's better, though it feels like it's missing an And
or a But
, e.g. isPackageButEffectivelyPublic
.
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.
To be more concrete, it could be isInterfacePackageEffectivelyPublic
.
… and skip access checks Resolves rdar://133319906
e7f9433
to
dc1c34d
Compare
@swift-ci smoke test |
Finishes resolving rdar://139236053.
After reverting swiftlang#75745 some expectations needed to change in this test.
If a package decl has a
@usableFromInline
(or other inlinable) attribute, and is defined in a module built from interface, itcan be referenced by another module that imports it even though the defining interface module does not have package-name (such as public or private interface with
-disable-print-package-name-for-non-package-interface
); in such case, type check on the decl fails due to the missing package-name. This PR treats the decl as public and skip type/access checks.Resolves rdar://133319906