File tree Expand file tree Collapse file tree 4 files changed +9
-22
lines changed
Expand file tree Collapse file tree 4 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -541,7 +541,6 @@ class CanType : public Type {
541541 CanType getNominalParent () const ; // in Types.h
542542 NominalTypeDecl *getAnyNominal () const ;
543543 GenericTypeDecl *getAnyGeneric () const ;
544- TypeDecl *getAnyTypeDecl () const ;
545544
546545 bool isForeignReferenceType (); // in Types.h
547546
Original file line number Diff line number Diff line change @@ -1233,11 +1233,6 @@ class alignas(1 << TypeAlignInBits) TypeBase
12331233 // / declaration.
12341234 GenericTypeDecl *getAnyGeneric ();
12351235
1236- // If this a GenericType, ModuleType, or GenericTypeParamType, return the
1237- // type declaration.
1238- // NOTE: Will not attempt to find an AssociatedTypeDecl.
1239- TypeDecl *getAnyTypeDecl ();
1240-
12411236 // / removeArgumentLabels - Retrieve a version of this type with all
12421237 // / argument labels removed.
12431238 Type removeArgumentLabels (unsigned numArgumentLabels);
@@ -7426,10 +7421,6 @@ inline GenericTypeDecl *TypeBase::getAnyGeneric() {
74267421 return getCanonicalType ().getAnyGeneric ();
74277422}
74287423
7429- inline TypeDecl *TypeBase::getAnyTypeDecl () {
7430- return getCanonicalType ().getAnyTypeDecl ();
7431- }
7432-
74337424inline bool TypeBase::isBuiltinIntegerType (unsigned n) {
74347425 if (auto intTy = dyn_cast<BuiltinIntegerType>(getCanonicalType ()))
74357426 return intTy->getWidth ().isFixedWidth ()
Original file line number Diff line number Diff line change @@ -3336,6 +3336,14 @@ static bool hasInverseCopyable(
33363336 Decl *decl,
33373337 std::function<bool (InverseMarking const &)> isRelevantInverse) {
33383338
3339+ auto getTypeDecl = [](Type type) -> TypeDecl* {
3340+ if (auto genericTy = type->getAnyGeneric ())
3341+ return genericTy;
3342+ if (auto gtpt = dyn_cast<GenericTypeParamType>(type))
3343+ return gtpt->getDecl ();
3344+ return nullptr ;
3345+ };
3346+
33393347 if (auto *extension = dyn_cast<ExtensionDecl>(decl)) {
33403348 if (auto *nominal = extension->getSelfNominalTypeDecl ())
33413349 if (isRelevantInverse (nominal->getNoncopyableMarking ()))
@@ -3361,7 +3369,7 @@ static bool hasInverseCopyable(
33613369 // Check for noncopyable types in the types of this declaration.
33623370 if (Type type = value->getInterfaceType ()) {
33633371 bool hasNoncopyable = type.findIf ([&](Type type) {
3364- if (auto typeDecl = type-> getAnyTypeDecl ( ))
3372+ if (auto * typeDecl = getTypeDecl (type ))
33653373 if (isRelevantInverse (typeDecl->getNoncopyableMarking ()))
33663374 return true ;
33673375
Original file line number Diff line number Diff line change @@ -91,17 +91,6 @@ GenericTypeDecl *CanType::getAnyGeneric() const {
9191 return nullptr ;
9292}
9393
94- TypeDecl *CanType::getAnyTypeDecl () const {
95- // NOTE: there is no simple way to determine if it's an AssociatedTypeDecl.
96- if (auto genericTy = getAnyGeneric ())
97- return genericTy;
98- if (auto gtpt = dyn_cast<GenericTypeParamType>(*this ))
99- return gtpt->getDecl ();
100- if (auto module = dyn_cast<ModuleType>(*this ))
101- return module ->getModule ();
102- return nullptr ;
103- }
104-
10594// ===----------------------------------------------------------------------===//
10695// Various Type Methods.
10796// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments