Skip to content

Commit 655b03d

Browse files
committed
Add isTypeErasedGenericClassType to TypeBase.
NFC.
1 parent 1d4009a commit 655b03d

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
@@ -714,7 +714,10 @@ class alignas(1 << TypeAlignInBits) TypeBase {
714714
/// class-bounded existential type whose required conformances are
715715
/// all @objc. Such types are compatible with ObjC.
716716
bool isObjCExistentialType();
717-
717+
718+
// // Is this an ObjC generic class.
719+
bool isTypeErasedGenericClassType();
720+
718721
/// Determines whether this type is an existential type with a class protocol
719722
/// bound.
720723
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;
@@ -4316,7 +4320,7 @@ case TypeKind::Id:
43164320
bool changed = false;
43174321
auto hasTypeErasedGenericClassType = [](Type ty) -> bool {
43184322
return ty.findIf([](Type subType) -> bool {
4319-
if (subType->getCanonicalType().isTypeErasedGenericClassType())
4323+
if (subType->isTypeErasedGenericClassType())
43204324
return true;
43214325
else
43224326
return false;

0 commit comments

Comments
 (0)