[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

@@ -373,6 +373,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.EnableExperimentalStaticAssert |=
Args.hasArg(OPT_enable_experimental_static_assert);
Opts.EnableExperimentalAsync |=
Args.hasArg(OPT_enable_experimental_async);
Opts.EnableSubstSILFunctionTypesForFunctionValues |=
Args.hasArg(OPT_enable_subst_sil_function_types_for_function_values);