-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Finish actor inheritance and global actors semantics #38213
Conversation
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)
(cherry picked from commit 83050d6)
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.
@swift-ci please test |
@swift-ci please nominate |
Build failed |
Build failed |
@swift-ci please test |
Build failed |
@swift-ci please test |
Build failed |
@swift-ci please test Linux |
Trying Linux again due to a spurious failure |
Build failed |
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
orfinal
anywhere on actors, bansopen
andrequired
, bans non-final classes from being global actors, implements implicitSendable
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