Skip to content

Implementing parsing and printing for 'reasync' functions #35986

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 6 commits into from
Feb 16, 2021

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Feb 16, 2021

This is the first part of rdar://problem/71098795. We can parse the attribute, serialize it and print it in module interfaces, but it doesn't do anything yet.

A reasync function is one where the only suspension points are from calling an async-typed function value parameter. The goal is that you should be able to call it with non-async function value arguments without an await, from a non-async context:

func reasyncFunction(_ fn: () async -> ()) reasync {
  await fn()
}

func syncFunction() {
  reasyncFunction {
    print("Hello world")
  }
}

This is entirely analogous to rethrows.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 1d6726a into swiftlang:main Feb 16, 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.

1 participant