Skip to content

Commit 51bf82a

Browse files
committed
Distributed: Remove walk over requirements
1 parent 31f922a commit 51bf82a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/Sema/TypeCheckDistributed.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -897,20 +897,16 @@ GetDistributedActorArgumentDecodingMethodRequest::evaluate(Evaluator &evaluator,
897897

898898
// Let's find out how many serialization requirements does this method cover
899899
// e.g. `Codable` is two requirements - `Encodable` and `Decodable`.
900-
unsigned numSerializationReqsCovered = llvm::count_if(
901-
FD->getGenericRequirements(), [&](const Requirement &requirement) {
902-
if (!(requirement.getFirstType()->isEqual(paramTy) &&
903-
requirement.getKind() == RequirementKind::Conformance))
904-
return 0;
905-
906-
return serializationReqs.count(requirement.getProtocolDecl()) ? 1 : 0;
907-
});
900+
bool okay = llvm::all_of(serializationReqs,
901+
[&](ProtocolDecl *p) -> bool {
902+
return FD->getGenericSignature()->requiresProtocol(paramTy, p);
903+
});
908904

909905
// If the current method covers all of the serialization requirements,
910906
// it's a match. Note that it might also have other requirements, but
911907
// we let that go as long as there are no two candidates that differ
912908
// only in generic requirements.
913-
if (numSerializationReqsCovered == serializationReqs.size())
909+
if (okay)
914910
candidates.push_back(FD);
915911
}
916912

0 commit comments

Comments
 (0)