32
32
#include " swift/AST/IfConfigClause.h"
33
33
#include " swift/AST/Import.h"
34
34
#include " swift/AST/Initializer.h"
35
+ #include " swift/AST/InverseMarking.h"
35
36
#include " swift/AST/LayoutConstraint.h"
36
37
#include " swift/AST/LifetimeAnnotation.h"
37
38
#include " swift/AST/ReferenceCounting.h"
@@ -3219,30 +3220,6 @@ class TypeDecl : public ValueDecl {
3219
3220
};
3220
3221
};
3221
3222
3222
- // / "Does a conformance for Copyable exist for this type declaration?"
3223
- // /
3224
- // / This doesn't mean that all instance of this type are Copyable, because
3225
- // / if a conditional conformance to Copyable exists, this method will return
3226
- // / true.
3227
- // /
3228
- // / If you need a more precise answer, ask this Decl's corresponding
3229
- // / Type if it `isCopyable` instead of using this.
3230
- CanBeInvertible::Result canBeCopyable () const ;
3231
-
3232
- // / "Does a conformance for Escapable exist for this type declaration?"
3233
- // /
3234
- // / This doesn't mean that all instance of this type are Escapable, because
3235
- // / if a conditional conformance to Escapable exists, this method will return
3236
- // / true.
3237
- // /
3238
- // / If you need a more precise answer, ask this Decl's corresponding
3239
- // / Type if it `isEscapable` instead of using this.
3240
- CanBeInvertible::Result canBeEscapable () const ;
3241
-
3242
- // / Determine how the given invertible protocol was written on this TypeDecl,
3243
- // / if at all.
3244
- InverseMarking getMarking (InvertibleProtocolKind ip) const ;
3245
-
3246
3223
static bool classof (const Decl *D) {
3247
3224
return D->getKind () >= DeclKind::First_TypeDecl &&
3248
3225
D->getKind () <= DeclKind::Last_TypeDecl;
@@ -3260,7 +3237,7 @@ class TypeDecl : public ValueDecl {
3260
3237
}
3261
3238
};
3262
3239
3263
- // / A type declaration that can have generic parameters attached to it. Because
3240
+ // / A type declaration that have generic parameters attached to it. Because
3264
3241
// / it has these generic parameters, it is always a DeclContext.
3265
3242
class GenericTypeDecl : public GenericContext , public TypeDecl {
3266
3243
public:
@@ -3935,6 +3912,10 @@ class AssociatedTypeDecl : public TypeDecl {
3935
3912
TypeDecl::getOverriddenDecl ());
3936
3913
}
3937
3914
3915
+ // / Determine whether this type has ~<target>` stated as
3916
+ // / one of its inherited types.
3917
+ InverseMarking::Mark hasInverseMarking (InvertibleProtocolKind target) const ;
3918
+
3938
3919
// / Retrieve the set of associated types overridden by this associated
3939
3920
// / type.
3940
3921
llvm::TinyPtrVector<AssociatedTypeDecl *> getOverriddenDecls () const ;
@@ -4372,6 +4353,34 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
4372
4353
// / Returns null if the type is a class, or does not have a declared `deinit`.
4373
4354
DestructorDecl *getValueTypeDestructor ();
4374
4355
4356
+ // / "Does a conformance for Copyable exist for this type declaration?"
4357
+ // /
4358
+ // / This doesn't mean that all instance of this type are Copyable, because
4359
+ // / if a conditional conformance to Copyable exists, this method will return
4360
+ // / true.
4361
+ // /
4362
+ // / If you need a more precise answer, ask this Decl's corresponding
4363
+ // / Type if it `isCopyable` instead of using this.
4364
+ CanBeInvertible::Result canBeCopyable () const ;
4365
+
4366
+ // / "Does a conformance for Escapable exist for this type declaration?"
4367
+ // /
4368
+ // / This doesn't mean that all instance of this type are Escapable, because
4369
+ // / if a conditional conformance to Escapable exists, this method will return
4370
+ // / true.
4371
+ // /
4372
+ // / If you need a more precise answer, ask this Decl's corresponding
4373
+ // / Type if it `isEscapable` instead of using this.
4374
+ CanBeInvertible::Result canBeEscapable () const ;
4375
+
4376
+ // / Determine whether this type has `: <target>` stated explicitly in
4377
+ // / its inheritance clause.
4378
+ bool hasMarking (InvertibleProtocolKind target) const ;
4379
+
4380
+ // / Determine whether this type has ~<target>` stated on
4381
+ // / itself, one of its inherited types or `Self` requirements.
4382
+ InverseMarking::Mark hasInverseMarking (InvertibleProtocolKind target) const ;
4383
+
4375
4384
// Implement isa/cast/dyncast/etc.
4376
4385
static bool classof (const Decl *D) {
4377
4386
return D->getKind () >= DeclKind::First_NominalTypeDecl &&
@@ -5227,6 +5236,10 @@ class ProtocolDecl final : public NominalTypeDecl {
5227
5236
// / protocol.
5228
5237
bool inheritsFrom (const ProtocolDecl *Super) const ;
5229
5238
5239
+ // / Determine whether this protocol has ~<target>` stated on
5240
+ // / itself, one of its inherited types or `Self` requirements.
5241
+ InverseMarking::Mark hasInverseMarking (InvertibleProtocolKind target) const ;
5242
+
5230
5243
// / Determine whether this protocol requires conformance to `IP`, without
5231
5244
// / querying a generic signature.
5232
5245
bool requiresInvertible (InvertibleProtocolKind ip) const ;
0 commit comments