-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] Implement an experimental feature for setting default actor isolation per file using a typealias. #80572
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
Conversation
ad394f8
to
734ce1a
Compare
@swift-ci please smoke test |
734ce1a
to
d634254
Compare
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
include/swift/AST/KnownSDKTypes.def
Outdated
@@ -40,6 +40,7 @@ KNOWN_SDK_TYPE_DECL(ObjectiveC, ObjCBool, StructDecl, 0) | |||
KNOWN_SDK_TYPE_DECL(Concurrency, CheckedContinuation, NominalTypeDecl, 2) | |||
KNOWN_SDK_TYPE_DECL(Concurrency, UnsafeContinuation, NominalTypeDecl, 2) | |||
KNOWN_SDK_TYPE_DECL(Concurrency, MainActor, NominalTypeDecl, 0) | |||
KNOWN_SDK_TYPE_DECL(Concurrency, nonisolated, NominalTypeDecl, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't think we should be pulling such sneaky tricks. It's adding more confusion to an already complex world of keywords, attributes and now there'd be a type with the same name as a keyword as well but ofc not interchangable. Let's acknnowladge it's a type and follow usual Swift naming conventions, so Nonisolated
for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line of code isn't doing anything other than generating some compiler API to easily get a known type in the Concurrency library. The actual part of this I think you object to is the type I added to stdlib/public/Concurrency/Actor.swift
:
@available(SwiftStdlib 6.2, *)
public struct nonisolated {}
But yes, let's discuss this on the forum thread because that's design feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM :) Just unsure about the nonisolated
type name, but let's leave that for evolution discussion
actor isolation per file using a typealias. This feature is gated behind the `DefaultIsolationTypealias` experimental feature flag.
d634254
to
ef24f35
Compare
@swift-ci please smoke test |
Superseded by #81863 |
This feature is gated behind the
DefaultIsolationTypealias
experimental feature flag.Pitch discussion is at https://forums.swift.org/t/pitch-a-typealias-for-per-file-default-actor-isolation/79150. Please leave design feedback on the forums!