[Typed throws] Type system support for typed throws.

Add the thrown type into the AST representation of function types,
mapping from function type representations and declarations into the
appropriate thrown type. Add tests for serialization, printing, and
basic equivalence of function types that have thrown errors.
This commit is contained in:
Doug Gregor
2023-09-18 22:29:56 -07:00
parent ef642098f2
commit 51eed19d4b
34 changed files with 526 additions and 117 deletions

View File

@@ -5344,6 +5344,7 @@ public:
fnTy->isSendable(),
fnTy->isAsync(),
fnTy->isThrowing(),
S.addTypeRef(fnTy->getThrownError()),
getRawStableDifferentiabilityKind(fnTy->getDifferentiabilityKind()),
globalActor);
@@ -5359,6 +5360,7 @@ public:
S.addTypeRef(fnTy->getResult()),
getRawStableFunctionTypeRepresentation(fnTy->getRepresentation()),
fnTy->isSendable(), fnTy->isAsync(), fnTy->isThrowing(),
S.addTypeRef(fnTy->getThrownError()),
getRawStableDifferentiabilityKind(fnTy->getDifferentiabilityKind()),
S.addTypeRef(fnTy->getGlobalActor()),
S.addGenericSignatureRef(genericSig));