Skip to content

Finish actor inheritance and global actors semantics #38213

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 11 commits into from
Jul 2, 2021

Conversation

DougGregor
Copy link
Member

Explanation: Bring the handling of actors and global-actor-qualified classes closer in line with SE-0306 "Actors" and SE-0136 "Global actors" with respect to inheritance. This eliminates the need for required or final anywhere on actors, bans open and required, bans non-final classes from being global actors, implements implicit Sendable for global actors, and closes up a safety hole where classes could have a different global actor from their superclasses.
Scope: Affects Swift code using the new concurrency features.
Radar/SR Issue: rdar://78269551, SR-14785 / rdar://79401150
Risk: Low.
Testing: PR testing and CI on main.
Original PR: #38186 and #38209

Treat actors as being semantically `final` throughout the type checker.
This allows, for example, a non-`required` initializer to satisfy a
protocol requirement.

We're leaving the ABI open for actor inheritance should we need it.

Addresses rdar://78269551.

(cherry picked from commit 9ec2077)
Enable global actors by default. The proposal has been accepted and is
implemented.

(cherry picked from commit f5dc1a1)
Because actors don't have inheritance, ban "open" and "required", which
don't make sense. We will permit "final" which, although it doesn't
have any semantic impact, is still used to determine whether the ABI
of the actor itself might permit subclassing in the future. This
leaves the door slightly ajar for actor inheritance should we need to
revisit that decision.

Fixes SR-14785 / rdar://79401150.

(cherry picked from commit e595b4f)
Close an actor-isolation hole where we permitted a class to have a
different global actor isolation than its superclass.
@DougGregor DougGregor requested a review from a team as a code owner July 1, 2021 23:24
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please nominate

@swift-ci
Copy link
Contributor

swift-ci commented Jul 1, 2021

Build failed
Swift Test Linux Platform
Git Sha - 0c9478c

@swift-ci
Copy link
Contributor

swift-ci commented Jul 2, 2021

Build failed
Swift Test OS X Platform
Git Sha - 0c9478c

@DougGregor
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jul 2, 2021

Build failed
Swift Test Linux Platform
Git Sha - bd7e3ab

@DougGregor
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jul 2, 2021

Build failed
Swift Test Linux Platform
Git Sha - ea9d390

@DougGregor
Copy link
Member Author

@swift-ci please test Linux

@DougGregor
Copy link
Member Author

Trying Linux again due to a spurious failure

@DougGregor DougGregor merged commit 1292972 into swiftlang:release/5.5 Jul 2, 2021
@DougGregor DougGregor deleted the actor-inheritance branch July 2, 2021 16:39
@swift-ci
Copy link
Contributor

swift-ci commented Jul 2, 2021

Build failed
Swift Test Linux Platform
Git Sha - ea9d390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants