[Concurrency] Add async to the Swift type system.

Add `async` to the type system. `async` can be written as part of a
function type or function declaration, following the parameter list, e.g.,

  func doSomeWork() async { ... }

`async` functions are distinct from non-`async` functions and there
are no conversions amongst them. At present, `async` functions do not
*do* anything, but this commit fully supports them as a distinct kind
of function throughout:

* Parsing of `async`
* AST representation of `async` in declarations and types
* Syntactic type representation of `async`
* (De-/re-)mangling of function types involving 'async'
* Runtime type representation and reconstruction of function types
involving `async`.
* Dynamic casting restrictions for `async` function types
* (De-)serialization of `async` function types
* Disabling overriding, witness matching, and conversions with
differing `async`
This commit is contained in:
Doug Gregor
2020-07-27 18:12:04 -07:00
parent 8a45c9c62f
commit f6e9f352f0
62 changed files with 555 additions and 151 deletions

View File

@@ -55,7 +55,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 565; // #fileID
const uint16_t SWIFTMODULE_VERSION_MINOR = 566; // async
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -963,6 +963,7 @@ namespace decls_block {
FunctionTypeRepresentationField, // representation
ClangTypeIDField, // type
BCFixed<1>, // noescape?
BCFixed<1>, // async?
BCFixed<1>, // throws?
DifferentiabilityKindField // differentiability kind
@@ -1038,6 +1039,7 @@ namespace decls_block {
GENERIC_FUNCTION_TYPE,
TypeIDField, // output
FunctionTypeRepresentationField, // representation
BCFixed<1>, // async?
BCFixed<1>, // throws?
DifferentiabilityKindField, // differentiability kind
GenericSignatureIDField // generic signture
@@ -1292,6 +1294,7 @@ namespace decls_block {
BCFixed<1>, // isObjC?
SelfAccessKindField, // self access kind
BCFixed<1>, // has forced static dispatch?
BCFixed<1>, // async?
BCFixed<1>, // throws?
GenericSignatureIDField, // generic environment
TypeIDField, // result interface type