Skip to content

Commit c7ecce4

Browse files
Merge pull request #33259 from aschwaighofer/add_to_type_base_isTypeErasedGenericClassType
Add isTypeErasedGenericClassType to TypeBase.
2 parents 8a820e7 + 655b03d commit c7ecce4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

include/swift/AST/Types.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,10 @@ class alignas(1 << TypeAlignInBits) TypeBase {
710710
/// class-bounded existential type whose required conformances are
711711
/// all @objc. Such types are compatible with ObjC.
712712
bool isObjCExistentialType();
713-
713+
714+
// // Is this an ObjC generic class.
715+
bool isTypeErasedGenericClassType();
716+
714717
/// Determines whether this type is an existential type with a class protocol
715718
/// bound.
716719
bool isClassExistentialType();

lib/AST/Type.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ bool TypeBase::isObjCExistentialType() {
337337
return getCanonicalType().isObjCExistentialType();
338338
}
339339

340+
bool TypeBase::isTypeErasedGenericClassType() {
341+
return getCanonicalType().isTypeErasedGenericClassType();
342+
}
343+
340344
bool CanType::isObjCExistentialTypeImpl(CanType type) {
341345
if (!type.isExistentialType())
342346
return false;
@@ -4300,7 +4304,7 @@ case TypeKind::Id:
43004304
bool changed = false;
43014305
auto hasTypeErasedGenericClassType = [](Type ty) -> bool {
43024306
return ty.findIf([](Type subType) -> bool {
4303-
if (subType->getCanonicalType().isTypeErasedGenericClassType())
4307+
if (subType->isTypeErasedGenericClassType())
43044308
return true;
43054309
else
43064310
return false;

0 commit comments

Comments
 (0)