swift
b5759c9f - [Concurrency] Allow overload 'async' with non-async and disambiguate uses.

Commit
5 years ago
[Concurrency] Allow overload 'async' with non-async and disambiguate uses. Allow an 'async' function to overload a non-'async' one, e.g., func performOperation(_: String) throws -> String { ... } func performOperation(_: String) async throws -> String { ... } Extend the scoring system in the type checker to penalize cases where code in an asynchronous context (e.g., an `async` function or closure) references an asychronous declaration or vice-versa, so that asynchronous code prefers the 'async' functions and synchronous code prefers the non-'async' functions. This allows the above overloading to be a legitimate approach to introducing asynchronous functionality to existing (blocking) APIs and letting code migrate over.
Author
Parents
Loading