Skip to content

Commit b1d22ff

Browse files
committed
AST: Update TypeBase::mayHaveSuperclass() for subclass existentials
1 parent 473faf1 commit b1d22ff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/swift/AST/Types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4556,9 +4556,14 @@ inline bool TypeBase::mayHaveSuperclass() {
45564556
if (getClassOrBoundGenericClass())
45574557
return true;
45584558

4559+
// FIXME: requiresClass() is not the same as having an explicit superclass;
4560+
// is this wrong?
45594561
if (auto archetype = getAs<ArchetypeType>())
45604562
return (bool)archetype->requiresClass();
45614563

4564+
if (isExistentialType())
4565+
return (bool)getSuperclass(nullptr);
4566+
45624567
return is<DynamicSelfType>();
45634568
}
45644569

0 commit comments

Comments
 (0)