3232#include " swift/AST/IfConfigClause.h"
3333#include " swift/AST/Import.h"
3434#include " swift/AST/Initializer.h"
35+ #include " swift/AST/InverseMarking.h"
3536#include " swift/AST/LayoutConstraint.h"
3637#include " swift/AST/LifetimeAnnotation.h"
3738#include " swift/AST/ReferenceCounting.h"
@@ -3219,30 +3220,6 @@ class TypeDecl : public ValueDecl {
32193220 };
32203221 };
32213222
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-
32463223 static bool classof (const Decl *D) {
32473224 return D->getKind () >= DeclKind::First_TypeDecl &&
32483225 D->getKind () <= DeclKind::Last_TypeDecl;
@@ -3260,7 +3237,7 @@ class TypeDecl : public ValueDecl {
32603237 }
32613238};
32623239
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
32643241// / it has these generic parameters, it is always a DeclContext.
32653242class GenericTypeDecl : public GenericContext , public TypeDecl {
32663243public:
@@ -3935,6 +3912,10 @@ class AssociatedTypeDecl : public TypeDecl {
39353912 TypeDecl::getOverriddenDecl ());
39363913 }
39373914
3915+ // / Determine whether this type has ~<target>` stated as
3916+ // / one of its inherited types.
3917+ InverseMarking::Mark hasInverseMarking (InvertibleProtocolKind target) const ;
3918+
39383919 // / Retrieve the set of associated types overridden by this associated
39393920 // / type.
39403921 llvm::TinyPtrVector<AssociatedTypeDecl *> getOverriddenDecls () const ;
@@ -4372,6 +4353,34 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
43724353 // / Returns null if the type is a class, or does not have a declared `deinit`.
43734354 DestructorDecl *getValueTypeDestructor ();
43744355
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+
43754384 // Implement isa/cast/dyncast/etc.
43764385 static bool classof (const Decl *D) {
43774386 return D->getKind () >= DeclKind::First_NominalTypeDecl &&
@@ -5227,6 +5236,10 @@ class ProtocolDecl final : public NominalTypeDecl {
52275236 // / protocol.
52285237 bool inheritsFrom (const ProtocolDecl *Super) const ;
52295238
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+
52305243 // / Determine whether this protocol requires conformance to `IP`, without
52315244 // / querying a generic signature.
52325245 bool requiresInvertible (InvertibleProtocolKind ip) const ;
0 commit comments