Skip to content

Adding optional message to _unavailableFromAsync #40378

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

etcwilde
Copy link
Member

@etcwilde etcwilde commented Dec 2, 2021

I'm adding an optional message field to the _unavailableFromAsync attribute so that API devs can provide more information about how to proceed. Not all API necessarily have a replacement so this is an optional parameter.

Something like a "renamed" declaration would be nice, though renamed doesn't make sense since we aren't renaming the API.

Commits will get cleaned up once #40149 merges.

@etcwilde etcwilde requested a review from DougGregor December 2, 2021 21:07
@etcwilde
Copy link
Member Author

etcwilde commented Dec 2, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 3, 2021

Build failed
Swift Test Linux Platform
Git Sha - e3deaca9d1ae41c0899a62ce51aa5e9468ffb6cc

@etcwilde
Copy link
Member Author

etcwilde commented Dec 3, 2021

@swift-ci please clean test Linux

@etcwilde etcwilde force-pushed the ewilde/concurrency/unavailablefromasync-messages branch from e3deaca to 043d391 Compare December 6, 2021 22:11
@etcwilde
Copy link
Member Author

etcwilde commented Dec 6, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 7, 2021

Build failed
Swift Test Linux Platform
Git Sha - 043d391cc9966ab1be4d39c6174b9b76d0510da8

@etcwilde
Copy link
Member Author

etcwilde commented Dec 7, 2021

@swift-ci please clean test Linux

@etcwilde etcwilde marked this pull request as ready for review December 7, 2021 18:35
@etcwilde
Copy link
Member Author

etcwilde commented Dec 7, 2021

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Dec 7, 2021

@swift-ci please clean test Linux

@@ -4719,7 +4719,7 @@ ERROR(async_named_decl_must_be_available_from_async,none,
"asynchronous %0 %1 must be available from asynchronous contexts",
(DescriptiveDeclKind, DeclName))
ERROR(async_unavailable_decl,none,
"%0 %1 is unavailable from asynchronous contexts", (DescriptiveDeclKind, DeclBaseName))
" %0 %1 is unavailable from asynchronous contexts%select{|; %3}2", (DescriptiveDeclKind, DeclBaseName, bool, StringRef))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hate to point it out, but there's an extra space at the beginning here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's where that space went. Nice catch. Thanks.

Adding the ability to add an optional message to the unavailable from
async attribute. This can be used to indicate other possible API to use,
or help explain why it's unavailable.
Adding nice error messages for when things go wrong.
@etcwilde etcwilde force-pushed the ewilde/concurrency/unavailablefromasync-messages branch from eba737a to 34fc8cd Compare December 8, 2021 19:40
@etcwilde
Copy link
Member Author

etcwilde commented Dec 8, 2021

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Dec 8, 2021

@swift-ci please clean test Linux

@etcwilde etcwilde merged commit a3cc692 into swiftlang:main Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants