Skip to content

Commit 5a10c4e

Browse files
committed
AST: Bring back old meaning of mayHaveSuperclass()
1 parent 3720bad commit 5a10c4e

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

include/swift/AST/Types.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4552,21 +4552,6 @@ inline CanType CanType::getNominalParent() const {
45524552
}
45534553
}
45544554

4555-
inline bool TypeBase::mayHaveSuperclass() {
4556-
if (getClassOrBoundGenericClass())
4557-
return true;
4558-
4559-
// FIXME: requiresClass() is not the same as having an explicit superclass;
4560-
// is this wrong?
4561-
if (auto archetype = getAs<ArchetypeType>())
4562-
return (bool)archetype->requiresClass();
4563-
4564-
if (isExistentialType())
4565-
return (bool)getSuperclass(nullptr);
4566-
4567-
return is<DynamicSelfType>();
4568-
}
4569-
45704555
inline TupleTypeElt::TupleTypeElt(Type ty, Identifier name, bool isVariadic,
45714556
bool isAutoClosure, bool isEscaping)
45724557
: Name(name), ElementType(ty),

lib/AST/Type.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,16 @@ LayoutConstraint TypeBase::getLayoutConstraint() {
15621562
return LayoutConstraint();
15631563
}
15641564

1565+
bool TypeBase::mayHaveSuperclass() {
1566+
if (getClassOrBoundGenericClass())
1567+
return true;
1568+
1569+
if (auto archetype = getAs<ArchetypeType>())
1570+
return (bool)archetype->requiresClass();
1571+
1572+
return is<DynamicSelfType>();
1573+
}
1574+
15651575
Type TypeBase::getSuperclass(LazyResolver *resolver) {
15661576
auto *nominalDecl = getAnyNominal();
15671577
auto *classDecl = dyn_cast_or_null<ClassDecl>(nominalDecl);

0 commit comments

Comments
 (0)