File tree Expand file tree Collapse file tree 2 files changed +40
-32
lines changed Expand file tree Collapse file tree 2 files changed +40
-32
lines changed Original file line number Diff line number Diff line change @@ -6781,38 +6781,6 @@ inline TypeBase *TypeBase::getDesugaredType() {
6781
6781
return cast<SugarType>(this )->getSinglyDesugaredType ()->getDesugaredType ();
6782
6782
}
6783
6783
6784
- inline bool TypeBase::hasSimpleTypeRepr () const {
6785
- // NOTE: Please keep this logic in sync with TypeRepr::isSimple().
6786
- switch (getKind ()) {
6787
- case TypeKind::Function:
6788
- case TypeKind::GenericFunction:
6789
- return false ;
6790
-
6791
- case TypeKind::Metatype:
6792
- return !cast<const AnyMetatypeType>(this )->hasRepresentation ();
6793
-
6794
- case TypeKind::ExistentialMetatype:
6795
- case TypeKind::Existential:
6796
- return false ;
6797
-
6798
- case TypeKind::OpaqueTypeArchetype:
6799
- case TypeKind::OpenedArchetype:
6800
- return false ;
6801
-
6802
- case TypeKind::ProtocolComposition: {
6803
- // 'Any', 'AnyObject' and single protocol compositions are simple
6804
- auto composition = cast<const ProtocolCompositionType>(this );
6805
- auto memberCount = composition->getMembers ().size ();
6806
- if (composition->hasExplicitAnyObject ())
6807
- return memberCount == 0 ;
6808
- return memberCount <= 1 ;
6809
- }
6810
-
6811
- default :
6812
- return true ;
6813
- }
6814
- }
6815
-
6816
6784
} // end namespace swift
6817
6785
6818
6786
namespace llvm {
Original file line number Diff line number Diff line change @@ -6224,6 +6224,46 @@ bool TypeBase::isForeignReferenceType() {
6224
6224
return false ;
6225
6225
}
6226
6226
6227
+ bool TypeBase::hasSimpleTypeRepr () const {
6228
+ // NOTE: Please keep this logic in sync with TypeRepr::isSimple().
6229
+ switch (getKind ()) {
6230
+ case TypeKind::Function:
6231
+ case TypeKind::GenericFunction:
6232
+ return false ;
6233
+
6234
+ case TypeKind::Metatype:
6235
+ return !cast<const AnyMetatypeType>(this )->hasRepresentation ();
6236
+
6237
+ case TypeKind::ExistentialMetatype:
6238
+ case TypeKind::Existential:
6239
+ return false ;
6240
+
6241
+ case TypeKind::OpaqueTypeArchetype:
6242
+ case TypeKind::OpenedArchetype:
6243
+ return false ;
6244
+
6245
+ case TypeKind::ProtocolComposition: {
6246
+ // 'Any', 'AnyObject' and single protocol compositions are simple
6247
+ auto composition = cast<const ProtocolCompositionType>(this );
6248
+ auto memberCount = composition->getMembers ().size ();
6249
+ if (composition->hasExplicitAnyObject ())
6250
+ return memberCount == 0 ;
6251
+ return memberCount <= 1 ;
6252
+ }
6253
+
6254
+ case TypeKind::GenericTypeParam: {
6255
+ if (auto *decl = cast<const GenericTypeParamType>(this )) {
6256
+ return !decl->isOpaqueType ();
6257
+ }
6258
+
6259
+ return true ;
6260
+ }
6261
+
6262
+ default :
6263
+ return true ;
6264
+ }
6265
+ }
6266
+
6227
6267
bool CanType::isForeignReferenceType () {
6228
6268
if (auto *classDecl = getPointer ()->lookThroughAllOptionalTypes ()->getClassOrBoundGenericClass ())
6229
6269
return classDecl->isForeignReferenceType ();
You can’t perform that action at this time.
0 commit comments