Skip to content

Commit fde0cde

Browse files
slavapestovktoso
authored andcommitted
Distributed: Remove walk over requirements
1 parent c71564d commit fde0cde

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
@@ -921,20 +921,16 @@ GetDistributedActorArgumentDecodingMethodRequest::evaluate(Evaluator &evaluator,
921921

922922
// Let's find out how many serialization requirements does this method cover
923923
// e.g. `Codable` is two requirements - `Encodable` and `Decodable`.
924-
unsigned numSerializationReqsCovered = llvm::count_if(
925-
FD->getGenericRequirements(), [&](const Requirement &requirement) {
926-
if (!(requirement.getFirstType()->isEqual(paramTy) &&
927-
requirement.getKind() == RequirementKind::Conformance))
928-
return 0;
929-
930-
return serializationReqs.count(requirement.getProtocolDecl()) ? 1 : 0;
931-
});
924+
bool okay = llvm::all_of(serializationReqs,
925+
[&](ProtocolDecl *p) -> bool {
926+
return FD->getGenericSignature()->requiresProtocol(paramTy, p);
927+
});
932928

933929
// If the current method covers all of the serialization requirements,
934930
// it's a match. Note that it might also have other requirements, but
935931
// we let that go as long as there are no two candidates that differ
936932
// only in generic requirements.
937-
if (numSerializationReqsCovered == serializationReqs.size())
933+
if (okay)
938934
candidates.push_back(FD);
939935
}
940936

0 commit comments

Comments
 (0)