@@ -1643,8 +1643,7 @@ bool GenericContext::isComputingGenericSignature() const {
16431643
16441644// / If we hit a cycle while building the generic signature, we can't return
16451645// / nullptr, since this breaks invariants elsewhere. Instead, build a dummy
1646- // / signature where everything is Copyable and Escapable, to avoid spurious
1647- // / downstream diagnostics concerning move-only types.
1646+ // / invalid signature to avoid spurious downstream diagnostics.
16481647static GenericSignature getPlaceholderGenericSignature (
16491648 ASTContext &ctx, const DeclContext *DC) {
16501649 SmallVector<GenericParamList *, 2 > gpLists;
@@ -1660,22 +1659,13 @@ static GenericSignature getPlaceholderGenericSignature(
16601659 gpLists[i]->setDepth (i);
16611660
16621661 SmallVector<GenericTypeParamType *, 2 > genericParams;
1663- SmallVector<Requirement, 2 > requirements;
1664-
16651662 for (auto *gpList : gpLists) {
16661663 for (auto *genericParam : *gpList) {
16671664 auto type = genericParam->getDeclaredInterfaceType ();
16681665 genericParams.push_back (type->castTo <GenericTypeParamType>());
1669-
1670- for (auto ip : InvertibleProtocolSet::allKnown ()) {
1671- auto proto = ctx.getProtocol (getKnownProtocolKind (ip));
1672- requirements.emplace_back (RequirementKind::Conformance, type,
1673- proto->getDeclaredInterfaceType ());
1674- }
16751666 }
16761667 }
1677-
1678- return GenericSignature::get (genericParams, requirements);
1668+ return GenericSignature::forInvalid (genericParams);
16791669}
16801670
16811671GenericSignature GenericContext::getGenericSignature () const {
@@ -2700,10 +2690,16 @@ bool PatternBindingDecl::hasStorage() const {
27002690
27012691const PatternBindingEntry *
27022692PatternBindingDecl::getCheckedPatternBindingEntry (unsigned i) const {
2703- return evaluateOrDefault (
2693+ auto result = evaluateOrDefault (
27042694 getASTContext ().evaluator ,
27052695 PatternBindingEntryRequest{const_cast <PatternBindingDecl *>(this ), i},
27062696 nullptr );
2697+
2698+ // If we ran into a cycle, we can still return the entry.
2699+ if (!result)
2700+ return &getPatternList ()[i];
2701+
2702+ return result;
27072703}
27082704
27092705void PatternBindingDecl::setPattern (unsigned i, Pattern *P,
@@ -7392,8 +7388,7 @@ bool ProtocolDecl::existentialConformsToSelf() const {
73927388}
73937389
73947390bool ProtocolDecl::hasSelfOrAssociatedTypeRequirements () const {
7395- // Because we will have considered all the protocols in a cyclic hierarchy by
7396- // the time the cycle is hit.
7391+ // Be conservative and avoid diagnosing if we hit a cycle.
73977392 const bool resultForCycle = false ;
73987393
73997394 return evaluateOrDefault (getASTContext ().evaluator ,
0 commit comments