-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-0466] Don't infer @MainActor on types conforming to Sendable #81468
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
[SE-0466] Don't infer @MainActor on types conforming to Sendable #81468
Conversation
@swift-ci please smoke test |
Intentionally not merging because this need more discussion and experimentation |
(I'm going to put this behind an experimental flag so we can play with it more) |
3a14322
to
54f057a
Compare
Fixes rdar://154373088 / issue swiftlang#82523
54f057a
to
6e2306f
Compare
@swift-ci please smoke test |
When the default isolation is main-actor, don't infer @mainactor for a type that conforms to a protocol P in its primary definition when P inherits from Sendable. Such types should remain non-isolated because they're highly unlikely to be able to implement the P conformance (which cannot be isolated). Put this feature behind a new experimental flag, SendableProhibitsMainActorInference. Implements rdar://151029300
6e2306f
to
ee9f6f8
Compare
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
@swift-ci please smoke test Linux |
@swift-ci please smoke test Linux |
@swift-ci please smoke test Windows |
Hello, This is a very welcome change 👍. It is good that libraries can influence the default MainActor isolation. I add this comment because |
When the default isolation is main-actor, don't infer @mainactor for a type that conforms to a protocol P in its primary definition when P inherits from Sendable. Such types should remain non-isolated because they're highly unlikely to be able to implement the P conformance (which cannot be isolated).
Implements rdar://151029300