Skip to content

Commit 068ca50

Browse files
committed
Distributed: Remove walk over requirements
1 parent 0d7b6ac commit 068ca50

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

953953
// Let's find out how many serialization requirements does this method cover
954954
// e.g. `Codable` is two requirements - `Encodable` and `Decodable`.
955-
unsigned numSerializationReqsCovered = llvm::count_if(
956-
FD->getGenericRequirements(), [&](const Requirement &requirement) {
957-
if (!(requirement.getFirstType()->isEqual(paramTy) &&
958-
requirement.getKind() == RequirementKind::Conformance))
959-
return 0;
960-
961-
return serializationReqs.count(requirement.getProtocolDecl()) ? 1 : 0;
962-
});
955+
bool okay = llvm::all_of(serializationReqs,
956+
[&](ProtocolDecl *p) -> bool {
957+
return FD->getGenericSignature()->requiresProtocol(paramTy, p);
958+
});
963959

964960
// If the current method covers all of the serialization requirements,
965961
// it's a match. Note that it might also have other requirements, but
966962
// we let that go as long as there are no two candidates that differ
967963
// only in generic requirements.
968-
if (numSerializationReqsCovered == serializationReqs.size())
964+
if (okay)
969965
candidates.push_back(FD);
970966
}
971967

0 commit comments

Comments
 (0)