Skip to content

[Concurrency] Allow synchronous functions to be a subtype of 'async' functions #34952

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 3 commits into from
Dec 4, 2020

Conversation

DougGregor
Copy link
Member

Implement support for synchronous functions being a subtype of 'async' functions to line up with changes to the async/await proposal. This includes:

  • An implicit conversion from a synchronous function to its async counterpart
  • The ability for a synchronous function to witness an async protocol requirement

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please clean test Windows

@@ -551,6 +551,10 @@ ERROR(throws_functiontype_mismatch,none,
"invalid conversion from throwing function of type %0 to "
"non-throwing function type %1", (Type, Type))

ERROR(async_functiontype_mismatch,none,
"invalid conversion from 'async' function of type %0 to "
"synchronous function type %1", (Type, Type))
Copy link
Contributor

Choose a reason for hiding this comment

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

"of type" maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

I sorts like it this way? We trying to convert to a synchronous function type

@DougGregor DougGregor merged commit 41f74e4 into swiftlang:main Dec 4, 2020
@DougGregor DougGregor deleted the convert-sync-to-async branch December 4, 2020 04:19
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.

2 participants