@@ -635,60 +635,72 @@ AbstractFunctionDecl::isDistributedTargetInvocationEncoderRecordArgument() const
635635
636636 // === Check all parameters
637637 auto params = getParameters ();
638- if (params->size () != 1 ) {
638+ if (params->size () != 2 ) {
639639 return false ;
640640 }
641641
642- // --- Check parameter: _ argument
643- auto argumentParam = params->get (0 );
644- if (!argumentParam->getArgumentName ().is (" " )) {
645- return false ;
646- }
642+ // --- Check parameter: label
643+ auto labelParam = params->get (0 );
644+ if (!labelParam->getArgumentName ().is (" name" )) {
645+ return false ;
646+ }
647+ if (!labelParam->getInterfaceType ()->isEqual (C.getStringType ())) {
648+ return false ;
649+ }
647650
648- // === Check generic parameters in detail
649- // --- Check: Argument: SerializationRequirement
650- GenericTypeParamDecl *ArgumentParam = genericParams->getParams ()[0 ];
651+ // --- Check parameter: _ argument
652+ auto argumentParam = params->get (1 );
653+ if (!argumentParam->getArgumentName ().is (" " )) {
654+ return false ;
655+ }
651656
652- auto sig = getGenericSignature ();
653- auto requirements = sig.getRequirements ();
657+ // === Check generic parameters in detail
658+ // --- Check: Argument: SerializationRequirement
659+ GenericTypeParamDecl *ArgumentParam = genericParams->getParams ()[0 ];
654660
655- if (requirements.size () != expectedRequirementsNum) {
656- return false ;
657- }
661+ auto sig = getGenericSignature ();
662+ auto requirements = sig.getRequirements ();
658663
659- // --- Check the expected requirements
660- // --- all the Argument requirements ---
661- // conforms_to: Argument Decodable
662- // conforms_to: Argument Encodable
663- // ...
664+ if (requirements.size () != expectedRequirementsNum) {
665+ return false ;
666+ }
664667
665- auto func = dyn_cast<FuncDecl>(this );
666- if (!func) {
667- return false ;
668- }
668+ // --- Check the expected requirements
669+ // --- all the Argument requirements ---
670+ // e.g.
671+ // conforms_to: Argument Decodable
672+ // conforms_to: Argument Encodable
673+ // ...
669674
670- auto resultType = func->mapTypeIntoContext (argumentParam->getInterfaceType ())
671- ->getDesugaredType ();
672- auto resultParamType = func->mapTypeIntoContext (
673- ArgumentParam->getInterfaceType ()->getMetatypeInstanceType ());
674- // The result of the function must be the `Res` generic argument.
675- if (!resultType->isEqual (resultParamType)) {
676- return false ;
677- }
675+ auto func = dyn_cast<FuncDecl>(this );
676+ if (!func) {
677+ return false ;
678+ }
678679
679- for (auto requirementProto : requirementProtos) {
680- auto conformance = module ->lookupConformance (resultType, requirementProto);
681- if (conformance.isInvalid ()) {
680+ auto resultType =
681+ func->mapTypeIntoContext (argumentParam->getInterfaceType ())
682+ ->getDesugaredType ();
683+ auto resultParamType = func->mapTypeIntoContext (
684+ ArgumentParam->getInterfaceType ()->getMetatypeInstanceType ());
685+ // The result of the function must be the `Res` generic argument.
686+ if (!resultType->isEqual (resultParamType)) {
682687 return false ;
683688 }
684- }
685689
686- // === Check result type: Void
687- if (!func->getResultInterfaceType ()->isVoid ()) {
688- return false ;
689- }
690+ for (auto requirementProto : requirementProtos) {
691+ auto conformance =
692+ module ->lookupConformance (resultType, requirementProto);
693+ if (conformance.isInvalid ()) {
694+ return false ;
695+ }
696+ }
690697
691- return true ;
698+ // === Check result type: Void
699+ if (!func->getResultInterfaceType ()->isVoid ()) {
700+ return false ;
701+ }
702+
703+ return true ;
692704}
693705
694706bool
@@ -879,8 +891,8 @@ AbstractFunctionDecl::isDistributedTargetInvocationEncoderRecordErrorType() cons
879891 }
880892
881893 // --- Check parameter: _ errorType
882- auto argumentParam = params->get (0 );
883- if (!argumentParam ->getArgumentName ().is (" " )) {
894+ auto errorTypeParam = params->get (0 );
895+ if (!errorTypeParam ->getArgumentName ().is (" " )) {
884896 return false ;
885897 }
886898
0 commit comments