-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AST] Add a new attribute @hasAsyncAlternative #36027
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
@swift-ci please test |
Build failed |
@swift-ci please test macOS platform |
Build failed |
This attribute marks a function has having an async alternative, optionally providing the name of that function as a string. Intended to be used to allow warnings when using a function with an async alternative in an asynchronous context, to make the async refactorings more accurate, and for documentation.
342947d
to
3a7bf23
Compare
Still an unrelated failure... had to update the module version anyway though (updated on main). @swift-ci please test macOS platform |
@swift-ci please smoke test Linux platform |
Build failed |
@swift-ci please test macOS platform |
Build failed |
@swift-ci please test macOS platform |
@@ -387,6 +387,9 @@ namespace swift { | |||
ASTVerifierOverrideKind ASTVerifierOverride = | |||
ASTVerifierOverrideKind::NoOverride; | |||
|
|||
/// Allow @hasAsyncAlternative attribute | |||
bool EnableExperimentalHasAsyncAlternative = false; |
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.
I don't think we need a flag for this. ConcurrencyOnly
ensures that it can only be used when -enable-experimental-concurrency
is provided.
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.
Thanks, wasn't sure whether it being behind concurrency only was okay :). Good to know!
public: | ||
/// An optional name of the async alternative function, where the name of the | ||
/// attributed function is used otherwise. | ||
const DeclNameRef Name; |
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.
We'll want type checking to resolve this to a Decl*, and serialization to serialize the Decl reference rather than the name (so clients don't have to resolve the Decl again).
This patch removes the feature flag for @hasAsyncAlternative since it's already protected by the experimental concurrency flag and will go in with the concurrency features. This fixes one of Doug's comments on swiftlang#36027.
This attribute marks a function has having an async alternative,
optionally providing the name of that function as a string. Intended to
be used to allow warnings when using a function with an async
alternative in an asynchronous context, to make the async refactorings
more accurate, and for documentation.