Skip to content

Sema: Diagnose global actor attribute access and availability#60672

Merged
tshortli merged 3 commits intoswiftlang:mainfrom
tshortli:global-actor-access-control
Aug 24, 2022
Merged

Sema: Diagnose global actor attribute access and availability#60672
tshortli merged 3 commits intoswiftlang:mainfrom
tshortli:global-actor-access-control

Conversation

@tshortli
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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