Skip to content

Sema: Diagnose global actor attribute access and availability #60672

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

Merged
merged 3 commits into from
Aug 24, 2022

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Aug 20, 2022

When visiting declarations in the availability and accessibility checkers, check the global actor attribute of the declaration, too. Failing to do so allows module authors to construct broken APIs involving global actors.

Resolves: #60420 and rdar://98200658

…ation is inconsistent with the access level of the declaration.

Resolves rdar://98200658 and swiftlang#60420.
@tshortli tshortli force-pushed the global-actor-access-control branch from 2282bba to c13dd18 Compare August 21, 2022 00:57
@tshortli
Copy link
Contributor Author

@swift-ci please test


@available(SwiftStdlib 5.1, *)
@inlinable public func testNestedFuncs() {
// FIXME: Functions isolated to non-resilient global actors nested in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to defer addressing these test cases to a follow up. In my testing it seems that we failed to diagnose these inline function decls because their global actor CustomAttrs are not yet bound to a type when the availability checker runs.

@tshortli tshortli marked this pull request as ready for review August 22, 2022 15:25
@tshortli tshortli merged commit e121dd3 into swiftlang:main Aug 24, 2022
@tshortli tshortli deleted the global-actor-access-control branch August 24, 2022 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Private global actor type can be used to isolated public entities
1 participant