Skip to content

Commit 8df553f

Browse files
committed
AST: Remove old form of getOpenedExistentialSignature()
1 parent 5c9753c commit 8df553f

File tree

2 files changed

+7
-48
lines changed

2 files changed

+7
-48
lines changed

include/swift/AST/ASTContext.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,19 +1446,6 @@ class ASTContext final {
14461446
/// like `<T>`.
14471447
CanGenericSignature getSingleGenericParameterSignature() const;
14481448

1449-
/// Retrieve a generic signature with a single type parameter conforming
1450-
/// to the given protocol or composition type, like <T: P>.
1451-
///
1452-
/// The opened archetype may have a different set of conformances from the
1453-
/// corresponding existential. The opened archetype conformances are dictated
1454-
/// by the ABI for generic arguments, while the existential value conformances
1455-
/// are dictated by their layout (see \c Type::getExistentialLayout()). In
1456-
/// particular, the opened archetype signature does not have requirements for
1457-
/// conformances inherited from superclass constraints while existential
1458-
/// values do.
1459-
CanGenericSignature getOpenedExistentialSignature(Type type,
1460-
GenericSignature parentSig);
1461-
14621449
/// Retrieve a generic signature with a single type parameter conforming
14631450
/// to the given protocol or composition type, like <T: P>.
14641451
///

lib/AST/ASTContext.cpp

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
@@ -6136,34 +6131,6 @@ CanGenericSignature ASTContext::getSingleGenericParameterSignature() const {
61366131
return canonicalSig;
61376132
}
61386133

6139-
CanGenericSignature
6140-
ASTContext::getOpenedExistentialSignature(Type type, GenericSignature parentSig) {
6141-
assert(type->isExistentialType());
6142-
6143-
if (auto existential = type->getAs<ExistentialType>())
6144-
type = existential->getConstraintType();
6145-
6146-
const CanType constraint = type->getCanonicalType();
6147-
6148-
auto canParentSig = parentSig.getCanonicalSignature();
6149-
auto key = std::make_pair(constraint, canParentSig.getPointer());
6150-
auto found = getImpl().ExistentialSignatures.find(key);
6151-
if (found != getImpl().ExistentialSignatures.end())
6152-
return found->second;
6153-
6154-
LocalArchetypeRequirementCollector collector(*this, canParentSig);
6155-
collector.addOpenedExistential(type);
6156-
auto genericSig = buildGenericSignature(
6157-
*this, collector.OuterSig, collector.Params, collector.Requirements,
6158-
/*allowInverses=*/true).getCanonicalSignature();
6159-
6160-
auto result = getImpl().ExistentialSignatures.insert(
6161-
std::make_pair(key, genericSig));
6162-
ASSERT(result.second);
6163-
6164-
return genericSig;
6165-
}
6166-
61676134
OpenedExistentialSignature
61686135
ASTContext::getOpenedExistentialSignature(Type type) {
61696136
assert(type->isExistentialType());
@@ -6193,8 +6160,13 @@ ASTContext::getOpenedExistentialSignature(Type type) {
61936160
// Open the generalization signature by adding a new generic parameter
61946161
// for `Self`.
61956162
auto parentSig = gen.Generalization.getGenericSignature();
6196-
existentialSig.OpenedSig =
6197-
getOpenedExistentialSignature(gen.Shape, parentSig);
6163+
auto canParentSig = parentSig.getCanonicalSignature();
6164+
6165+
LocalArchetypeRequirementCollector collector(*this, canParentSig);
6166+
collector.addOpenedExistential(gen.Shape);
6167+
existentialSig.OpenedSig = buildGenericSignature(
6168+
*this, collector.OuterSig, collector.Params, collector.Requirements,
6169+
/*allowInverses=*/true).getCanonicalSignature();
61986170

61996171
// Stash the `Self` type.
62006172
existentialSig.SelfType =

0 commit comments

Comments
 (0)