Skip to content

[concurrency] warn about future reservation of 'await' as contextual keyword #35153

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

Merged
merged 2 commits into from
Dec 23, 2020

Conversation

kavon
Copy link
Member

@kavon kavon commented Dec 18, 2020

Based on how the reviews of async/await are going, it seems we're slated to reserve await in a future version of Swift for expressions such as await <expr>. This PR provides a warnings and fix-it to help users upgrade / future-proof their code. The fix-it surrounds the use of await with backticks. Other approaches were considered (to, say, emit a note on the declaration to suggest renaming it, or provide a fix-it that fully-qualifies the declaration reference), but in order to not accidentally warn about a backtick'd await, this warning was implemented in the parser, so such information is not available.

Resolves rdar://67000350

TODO:

  • Fix bug where the await in let _ = self.await is still being flagged as being unqualified.
  • Fix bug where references where await was surrounded by backticks are still being warned about.
  • Warn of uses of await as an identifier in local bindings?

@kavon kavon force-pushed the warn-unqualified-await branch from 47f6142 to f7a2e79 Compare December 22, 2020 19:40
@kavon
Copy link
Member Author

kavon commented Dec 22, 2020

@swift-ci please test

@kavon kavon marked this pull request as ready for review December 22, 2020 20:15
@kavon kavon requested a review from DougGregor December 22, 2020 20:15
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - f7a2e7964663a081b141dc682e7d817742ff7587

@kavon
Copy link
Member Author

kavon commented Dec 22, 2020

@swift-ci Please clean test Linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f7a2e7964663a081b141dc682e7d817742ff7587

@kavon kavon force-pushed the warn-unqualified-await branch from f7a2e79 to 22455ba Compare December 22, 2020 22:19
@kavon
Copy link
Member Author

kavon commented Dec 22, 2020

@swift-ci Please clean test

@kavon kavon force-pushed the warn-unqualified-await branch from 22455ba to fa0c01f Compare December 22, 2020 23:51
@kavon
Copy link
Member Author

kavon commented Dec 22, 2020

@swift-ci please smoke test

@kavon kavon merged commit 179474e into swiftlang:main Dec 23, 2020
kavon added a commit to kavon/swift that referenced this pull request Dec 23, 2020
[concurrency] warn about future reservation of 'await' as contextual keyword
@kavon kavon deleted the warn-unqualified-await branch December 24, 2020 00:25
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