Skip to content

Commit c5c1347

Browse files
committed
Remove ArchetypeType::getKnownNestedTypes().
This API is only used for dumping and verification, and is not intended to remain a meaningful query.
1 parent 2a90cd1 commit c5c1347

File tree

4 files changed

+0
-56
lines changed

4 files changed

+0
-56
lines changed

include/swift/AST/Types.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5466,14 +5466,6 @@ class ArchetypeType : public SubstitutableType,
54665466
/// Check if the archetype contains a nested type with the given name.
54675467
bool hasNestedType(Identifier Name) const;
54685468

5469-
/// Retrieve the known nested types of this archetype.
5470-
///
5471-
/// Useful only for debugging dumps; all other queries should attempt to
5472-
/// find a particular nested type by name, directly, or look at the
5473-
/// protocols to which this archetype conforms.
5474-
ArrayRef<std::pair<Identifier, Type>>
5475-
getKnownNestedTypes() const;
5476-
54775469
/// Register a nested type with the given name.
54785470
void registerNestedType(Identifier name, Type nested);
54795471

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,45 +3733,23 @@ namespace {
37333733
printRec("superclass", superclass);
37343734
}
37353735

3736-
void printArchetypeNestedTypes(ArchetypeType *T) {
3737-
Indent += 2;
3738-
for (auto nestedType : T->getKnownNestedTypes()) {
3739-
OS << "\n";
3740-
OS.indent(Indent) << "(";
3741-
PrintWithColorRAII(OS, TypeFieldColor) << "nested_type";
3742-
OS << "=";
3743-
OS << nestedType.first.str() << " ";
3744-
if (!nestedType.second) {
3745-
PrintWithColorRAII(OS, TypeColor) << "<<unresolved>>";
3746-
} else {
3747-
PrintWithColorRAII(OS, TypeColor);
3748-
OS << "=" << nestedType.second.getString();
3749-
}
3750-
OS << ")";
3751-
}
3752-
Indent -= 2;
3753-
}
3754-
37553736
void visitPrimaryArchetypeType(PrimaryArchetypeType *T, StringRef label) {
37563737
printArchetypeCommon(T, "primary_archetype_type", label);
37573738
printField("name", T->getFullName());
37583739
OS << "\n";
3759-
printArchetypeNestedTypes(T);
37603740
PrintWithColorRAII(OS, ParenthesisColor) << ')';
37613741
}
37623742
void visitNestedArchetypeType(NestedArchetypeType *T, StringRef label) {
37633743
printArchetypeCommon(T, "nested_archetype_type", label);
37643744
printField("name", T->getFullName());
37653745
printField("parent", T->getParent());
37663746
printField("assoc_type", T->getAssocType()->printRef());
3767-
printArchetypeNestedTypes(T);
37683747
PrintWithColorRAII(OS, ParenthesisColor) << ')';
37693748
}
37703749
void visitOpenedArchetypeType(OpenedArchetypeType *T, StringRef label) {
37713750
printArchetypeCommon(T, "opened_archetype_type", label);
37723751
printRec("opened_existential", T->getOpenedExistentialType());
37733752
printField("opened_existential_id", T->getOpenedExistentialID());
3774-
printArchetypeNestedTypes(T);
37753753
PrintWithColorRAII(OS, ParenthesisColor) << ')';
37763754
}
37773755
void visitOpaqueTypeArchetypeType(OpaqueTypeArchetypeType *T,
@@ -3786,14 +3764,12 @@ namespace {
37863764
SubstitutionMap::DumpStyle::Full,
37873765
Indent + 2, Dumped);
37883766
}
3789-
printArchetypeNestedTypes(T);
37903767
PrintWithColorRAII(OS, ParenthesisColor) << ')';
37913768
}
37923769
void visitSequenceArchetypeType(SequenceArchetypeType *T, StringRef label) {
37933770
printArchetypeCommon(T, "sequence_archetype_type", label);
37943771
printField("name", T->getFullName());
37953772
OS << "\n";
3796-
printArchetypeNestedTypes(T);
37973773
PrintWithColorRAII(OS, ParenthesisColor) << ')';
37983774
}
37993775

lib/AST/ASTVerifier.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -658,24 +658,6 @@ class Verifier : public ASTWalker {
658658

659659
return true;
660660
}
661-
662-
// Make sure that none of the nested types are dependent.
663-
for (const auto &nested : archetype->getKnownNestedTypes()) {
664-
if (!nested.second)
665-
continue;
666-
667-
if (auto nestedType = nested.second) {
668-
if (nestedType->hasTypeParameter()) {
669-
Out << "Nested type " << nested.first.str()
670-
<< " of archetype " << archetype->getString()
671-
<< " is dependent type " << nestedType->getString()
672-
<< "\n";
673-
return true;
674-
}
675-
}
676-
677-
verifyChecked(nested.second, visitedArchetypes);
678-
}
679661
}
680662

681663
return false;

lib/AST/Type.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,12 +3767,6 @@ bool ArchetypeType::hasNestedType(Identifier Name) const {
37673767
return Pos != NestedTypes.end() && Pos->first == Name;
37683768
}
37693769

3770-
ArrayRef<std::pair<Identifier, Type>>
3771-
ArchetypeType::getKnownNestedTypes() const {
3772-
populateNestedTypes();
3773-
return NestedTypes;
3774-
}
3775-
37763770
void ArchetypeType::registerNestedType(Identifier name, Type nested) {
37773771
populateNestedTypes();
37783772

0 commit comments

Comments
 (0)