@@ -6858,63 +6858,12 @@ ProtocolDecl::getProtocolDependencies() const {
68586858 std::nullopt );
68596859}
68606860
6861- // / If we hit a request cycle, give the protocol a requirement signature that
6862- // / still has inherited protocol requirements on Self, and also conformances
6863- // / to Copyable and Escapable for all associated types. Otherwise, we'll see
6864- // / invariant violations from the inheritance clause mismatch, as well as
6865- // / spurious downstream diagnostics concerning move-only types.
6866- static RequirementSignature getPlaceholderRequirementSignature (
6867- const ProtocolDecl *proto) {
6868- auto &ctx = proto->getASTContext ();
6869-
6870- SmallVector<ProtocolDecl *, 2 > inheritedProtos;
6871- for (auto *inheritedProto : proto->getInheritedProtocols ()) {
6872- inheritedProtos.push_back (inheritedProto);
6873- }
6874-
6875- if (ctx.LangOpts .hasFeature (Feature::NoncopyableGenerics)) {
6876- for (auto ip : InvertibleProtocolSet::full ()) {
6877- auto *otherProto = ctx.getProtocol (getKnownProtocolKind (ip));
6878- inheritedProtos.push_back (otherProto);
6879- }
6880- }
6881-
6882- ProtocolType::canonicalizeProtocols (inheritedProtos);
6883-
6884- SmallVector<Requirement, 2 > requirements;
6885-
6886- for (auto *inheritedProto : inheritedProtos) {
6887- requirements.emplace_back (RequirementKind::Conformance,
6888- proto->getSelfInterfaceType (),
6889- inheritedProto->getDeclaredInterfaceType ());
6890- }
6891-
6892- if (ctx.LangOpts .hasFeature (Feature::NoncopyableGenerics)) {
6893- for (auto *assocTypeDecl : proto->getAssociatedTypeMembers ()) {
6894- for (auto ip : InvertibleProtocolSet::full ()) {
6895- auto *otherProto = ctx.getProtocol (getKnownProtocolKind (ip));
6896- requirements.emplace_back (RequirementKind::Conformance,
6897- assocTypeDecl->getDeclaredInterfaceType (),
6898- otherProto->getDeclaredInterfaceType ());
6899- }
6900- }
6901- }
6902-
6903- // Maintain invariants.
6904- llvm::array_pod_sort (requirements.begin (), requirements.end (),
6905- [](const Requirement *lhs, const Requirement *rhs) -> int {
6906- return lhs->compare (*rhs);
6907- });
6908-
6909- return RequirementSignature (ctx.AllocateCopy (requirements),
6910- ArrayRef<ProtocolTypeAlias>());
6911- }
6912-
69136861RequirementSignature ProtocolDecl::getRequirementSignature () const {
69146862 return getASTContext ().evaluator (
6915- RequirementSignatureRequest { const_cast <ProtocolDecl *>(this ) },
6863+ RequirementSignatureRequest{ const_cast <ProtocolDecl *>(this )},
69166864 [this ]() {
6917- return getPlaceholderRequirementSignature (this );
6865+ return RequirementSignature::getPlaceholderRequirementSignature (
6866+ this , GenericSignatureErrors ());
69186867 });
69196868}
69206869
0 commit comments