Skip to content
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

[concurrency] allow type initializers to be 'async' #35398

Merged
merged 5 commits into from
Apr 15, 2021

Conversation

kavon
Copy link
Member

@kavon kavon commented Jan 13, 2021

Earlier in the design of async/await, we disallowed async initializers for nominal types. There is no fundamental reason for the restriction and it was decided that async initializers would actually be useful (to allow initializers to invoke async functions, for example), and so they appear in the now accepted async/await proposal.

This PR fills in this missing part of the proposal, by allowing initializers to be async.

Resolves rdar://71049563

TODO:

  • Lift restriction in the parser
  • Implement checking missing explicit call to async, zero-arg, designated super initializer
  • Update all existing tests
  • Ensure that asynchronous global-actor-isolated initializers emit the appropriate actor hop.
  • Test coverage
    • typechecker
    • SILGen
    • execution
    • serialization

@kavon
Copy link
Member Author

kavon commented Apr 13, 2021

@swift-ci please test

@kavon kavon marked this pull request as ready for review April 13, 2021 03:04
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 755bbffeb3a5f135464c6c0667de798c220581ef

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Looking very good! I'm glad that the code changes were relatively modest.

lib/ClangImporter/ImportName.cpp Show resolved Hide resolved
@kavon kavon force-pushed the async-initializers branch 4 times, most recently from 42f4795 to b818676 Compare April 15, 2021 03:27
@kavon
Copy link
Member Author

kavon commented Apr 15, 2021

@swift-ci Please smoke test and merge

There's a basic prolog emission function, used by value and class constructors, etc, and then there's the full-blown one for functions and closures, which uses the basic version.
implicit calls to an async super.init are not allowed
types correctly hop to the right global-actor in their
prolog.
new phrasing in the error messages to match up with
other phrasing used in messages.
@kavon
Copy link
Member Author

kavon commented Apr 15, 2021

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit b941835 into swiftlang:main Apr 15, 2021
@kavon kavon deleted the async-initializers branch April 15, 2021 23:54
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.

None yet

3 participants