@@ -457,10 +457,6 @@ struct ASTContext::Implementation {
457457 // / The single-parameter generic signature with no constraints, <T>.
458458 CanGenericSignature SingleGenericParameterSignature;
459459
460- // / The existential signature <T : P> for each P.
461- llvm::DenseMap<std::pair<CanType, const GenericSignatureImpl *>, CanGenericSignature>
462- ExistentialSignatures;
463-
464460 // / The element signature for a generic signature, which contains a clone
465461 // / of the context generic signature with new type parameters and requirements
466462 // / for opened pack elements in the given shape equivalence class.
@@ -851,7 +847,6 @@ void ASTContext::Implementation::dump(llvm::raw_ostream &os) const {
851847 SIZE_AND_BYTES (AssociativityCache);
852848 SIZE_AND_BYTES (DelayedConformanceDiags);
853849 SIZE_AND_BYTES (LazyContexts);
854- SIZE_AND_BYTES (ExistentialSignatures);
855850 SIZE_AND_BYTES (ElementSignatures);
856851 SIZE_AND_BYTES (Overrides);
857852 SIZE_AND_BYTES (DefaultWitnesses);
@@ -6137,34 +6132,6 @@ CanGenericSignature ASTContext::getSingleGenericParameterSignature() const {
61376132 return canonicalSig;
61386133}
61396134
6140- CanGenericSignature
6141- ASTContext::getOpenedExistentialSignature (Type type, GenericSignature parentSig) {
6142- assert (type->isExistentialType ());
6143-
6144- if (auto existential = type->getAs <ExistentialType>())
6145- type = existential->getConstraintType ();
6146-
6147- const CanType constraint = type->getCanonicalType ();
6148-
6149- auto canParentSig = parentSig.getCanonicalSignature ();
6150- auto key = std::make_pair (constraint, canParentSig.getPointer ());
6151- auto found = getImpl ().ExistentialSignatures .find (key);
6152- if (found != getImpl ().ExistentialSignatures .end ())
6153- return found->second ;
6154-
6155- LocalArchetypeRequirementCollector collector (*this , canParentSig);
6156- collector.addOpenedExistential (type);
6157- auto genericSig = buildGenericSignature (
6158- *this , collector.OuterSig , collector.Params , collector.Requirements ,
6159- /* allowInverses=*/ true ).getCanonicalSignature ();
6160-
6161- auto result = getImpl ().ExistentialSignatures .insert (
6162- std::make_pair (key, genericSig));
6163- ASSERT (result.second );
6164-
6165- return genericSig;
6166- }
6167-
61686135OpenedExistentialSignature
61696136ASTContext::getOpenedExistentialSignature (Type type) {
61706137 assert (type->isExistentialType ());
@@ -6194,8 +6161,13 @@ ASTContext::getOpenedExistentialSignature(Type type) {
61946161 // Open the generalization signature by adding a new generic parameter
61956162 // for `Self`.
61966163 auto parentSig = gen.Generalization .getGenericSignature ();
6197- existentialSig.OpenedSig =
6198- getOpenedExistentialSignature (gen.Shape , parentSig);
6164+ auto canParentSig = parentSig.getCanonicalSignature ();
6165+
6166+ LocalArchetypeRequirementCollector collector (*this , canParentSig);
6167+ collector.addOpenedExistential (gen.Shape );
6168+ existentialSig.OpenedSig = buildGenericSignature (
6169+ *this , collector.OuterSig , collector.Params , collector.Requirements ,
6170+ /* allowInverses=*/ true ).getCanonicalSignature ();
61996171
62006172 // Stash the `Self` type.
62016173 existentialSig.SelfType =
0 commit comments