@@ -384,6 +384,39 @@ bool swift::checkDistributedSerializationRequirementIsExactlyCodable(
384
384
/* ******************** Ad-hoc protocol requirement checks *********************/
385
385
/* *****************************************************************************/
386
386
387
+ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCallRequirement (
388
+ bool withResult) const {
389
+ auto &ctx = getASTContext ();
390
+ auto *DC = getDeclContext ();
391
+
392
+ auto expectedName =
393
+ withResult ? DeclName (ctx, ctx.Id_remoteCall ,
394
+ {ctx.Id_on , ctx.Id_target , ctx.Id_invocation ,
395
+ ctx.Id_throwing , ctx.Id_returning })
396
+ : DeclName (ctx, ctx.Id_remoteCallVoid ,
397
+ {ctx.Id_on , ctx.Id_target , ctx.Id_invocation ,
398
+ ctx.Id_throwing });
399
+
400
+ if (getName () != expectedName)
401
+ return false ;
402
+
403
+ if (!DC->isTypeContext () || !isGeneric ())
404
+ return false ;
405
+
406
+ auto declaredIn = DC->getSelfProtocolDecl ();
407
+ if (!(declaredIn && declaredIn == ctx.getDistributedActorSystemDecl ()))
408
+ return false ;
409
+
410
+ auto genericParams = getGenericParams ();
411
+ if (genericParams->size () != (withResult ? 3 : 2 ))
412
+ return false ;
413
+
414
+ if (!hasThrows () || !hasAsync ())
415
+ return false ;
416
+
417
+ return true ;
418
+ }
419
+
387
420
bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall (bool isVoidReturn) const {
388
421
auto &C = getASTContext ();
389
422
auto module = getParentModule ();
0 commit comments