@@ -422,13 +422,10 @@ enum class BuiltinThrowsKind : uint8_t {
422422}
423423
424424// / Build a builtin function declaration.
425- static FuncDecl *
426- getBuiltinGenericFunction (Identifier Id,
427- ArrayRef<AnyFunctionType::Param> ArgParamTypes,
428- Type ResType,
429- GenericParamList *GenericParams,
430- GenericSignature Sig,
431- bool Async, BuiltinThrowsKind Throws) {
425+ static FuncDecl *getBuiltinGenericFunction (
426+ Identifier Id, ArrayRef<AnyFunctionType::Param> ArgParamTypes, Type ResType,
427+ GenericParamList *GenericParams, GenericSignature Sig, bool Async,
428+ BuiltinThrowsKind Throws, bool SendingResult) {
432429 assert (GenericParams && " Missing generic parameters" );
433430 auto &Context = ResType->getASTContext ();
434431
@@ -460,6 +457,7 @@ getBuiltinGenericFunction(Identifier Id,
460457 Throws != BuiltinThrowsKind::None, /* thrownType=*/ Type (),
461458 GenericParams, paramList, ResType, DC);
462459
460+ func->setSendingResult (SendingResult);
463461 func->setAccess (AccessLevel::Public);
464462 func->setGenericSignature (Sig);
465463 if (Throws == BuiltinThrowsKind::Rethrows)
@@ -681,6 +679,7 @@ namespace {
681679 Type InterfaceResult;
682680 bool Async = false ;
683681 BuiltinThrowsKind Throws = BuiltinThrowsKind::None;
682+ bool SendingResult = false ;
684683
685684 // Accumulate params and requirements here, so that we can call
686685 // `buildGenericSignature()` when `build()` is called.
@@ -745,16 +744,17 @@ namespace {
745744 Throws = BuiltinThrowsKind::Rethrows;
746745 }
747746
747+ void setSendingResult () { SendingResult = true ; }
748+
748749 FuncDecl *build (Identifier name) {
749750 auto GenericSig = buildGenericSignature (
750751 Context, GenericSignature (),
751752 std::move (genericParamTypes),
752753 std::move (addedRequirements),
753754 /* allowInverses=*/ false );
754- return getBuiltinGenericFunction (name, InterfaceParams,
755- InterfaceResult,
756- TheGenericParamList, GenericSig,
757- Async, Throws);
755+ return getBuiltinGenericFunction (name, InterfaceParams, InterfaceResult,
756+ TheGenericParamList, GenericSig, Async,
757+ Throws, SendingResult);
758758 }
759759
760760 // Don't use these generator classes directly; call the make{...}
@@ -2073,6 +2073,7 @@ static ValueDecl *getWithUnsafeContinuation(ASTContext &ctx,
20732073 builder.setAsync ();
20742074 if (throws)
20752075 builder.setThrows ();
2076+ builder.setSendingResult ();
20762077
20772078 return builder.build (id);
20782079}
0 commit comments