@@ -553,11 +553,12 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
553553 // / Whether the existential of this protocol conforms to itself.
554554 ExistentialConformsToSelf : 1 ,
555555
556- // / Whether the \c ExistentialRequiresAny bit is valid.
557- ExistentialRequiresAnyValid : 1 ,
556+ // / Whether the \c HasSelfOrAssociatedTypeRequirements bit is valid.
557+ HasSelfOrAssociatedTypeRequirementsValid : 1 ,
558558
559- // / Whether the existential of this protocol must be spelled with \c any.
560- ExistentialRequiresAny : 1 ,
559+ // / Whether this protocol has \c Self or associated type requirements.
560+ // / See \c hasSelfOrAssociatedTypeRequirements() for clarification.
561+ HasSelfOrAssociatedTypeRequirements : 1 ,
561562
562563 // / True if the protocol has requirements that cannot be satisfied (e.g.
563564 // / because they could not be imported from Objective-C).
@@ -4756,19 +4757,19 @@ class ProtocolDecl final : public NominalTypeDecl {
47564757 Bits.ProtocolDecl .ExistentialConformsToSelf = result;
47574758 }
47584759
4759- // / Returns the cached result of \c existentialRequiresAny or \c None if it
4760- // / hasn't yet been computed.
4761- Optional<bool > getCachedExistentialRequiresAny () {
4762- if (Bits.ProtocolDecl .ExistentialRequiresAnyValid )
4763- return Bits.ProtocolDecl .ExistentialRequiresAny ;
4760+ // / Returns the cached result of \c hasSelfOrAssociatedTypeRequirements or
4761+ // / \c None if it hasn't yet been computed.
4762+ Optional<bool > getCachedHasSelfOrAssociatedTypeRequirements () {
4763+ if (Bits.ProtocolDecl .HasSelfOrAssociatedTypeRequirementsValid )
4764+ return Bits.ProtocolDecl .HasSelfOrAssociatedTypeRequirements ;
47644765
47654766 return None;
47664767 }
47674768
4768- // / Caches the result of \c existentialRequiresAny
4769- void setCachedExistentialRequiresAny (bool requiresAny ) {
4770- Bits.ProtocolDecl .ExistentialRequiresAnyValid = true ;
4771- Bits.ProtocolDecl .ExistentialRequiresAny = requiresAny ;
4769+ // / Caches the result of \c hasSelfOrAssociatedTypeRequirements
4770+ void setCachedHasSelfOrAssociatedTypeRequirements (bool value ) {
4771+ Bits.ProtocolDecl .HasSelfOrAssociatedTypeRequirementsValid = true ;
4772+ Bits.ProtocolDecl .HasSelfOrAssociatedTypeRequirements = value ;
47724773 }
47734774
47744775 bool hasLazyRequirementSignature () const {
@@ -4785,11 +4786,9 @@ class ProtocolDecl final : public NominalTypeDecl {
47854786 friend class TypeAliasRequirementsRequest ;
47864787 friend class ProtocolDependenciesRequest ;
47874788 friend class RequirementSignatureRequest ;
4788- friend class RequirementSignatureRequestRQM ;
4789- friend class RequirementSignatureRequestGSB ;
47904789 friend class ProtocolRequiresClassRequest ;
47914790 friend class ExistentialConformsToSelfRequest ;
4792- friend class ExistentialRequiresAnyRequest ;
4791+ friend class HasSelfOrAssociatedTypeRequirementsRequest ;
47934792 friend class InheritedProtocolsRequest ;
47944793 friend class PrimaryAssociatedTypesRequest ;
47954794 friend class ProtocolRequirementsRequest ;
@@ -4888,15 +4887,20 @@ class ProtocolDecl final : public NominalTypeDecl {
48884887 // / Does this protocol require a self-conformance witness table?
48894888 bool requiresSelfConformanceWitnessTable () const ;
48904889
4891- // / Determine whether an existential type must be explicitly prefixed
4892- // / with \c any. \c any is required if one of the following conditions is met
4893- // / for this protocol or an inherited protocol:
4890+ // / Determine whether this protocol has `Self` or associated type
4891+ // / requirements.
4892+ // /
4893+ // / This is true if one of the following conditions is met for this protocol
4894+ // / or an inherited protocol:
48944895 // / - The protocol has an associated type requirement.
48954896 // / - `Self` appears in non-covariant position in the type signature of a
48964897 // / value requirement.
4898+ bool hasSelfOrAssociatedTypeRequirements () const ;
4899+
4900+ // / Determine whether an existential type constrained by this protocol must
4901+ // / be written using `any` syntax.
48974902 // /
4898- // / @Note This method does not take the state of language features into
4899- // / account.
4903+ // / \Note This method takes language feature state into account.
49004904 bool existentialRequiresAny () const ;
49014905
49024906 // / Returns a list of protocol requirements that must be assessed to
0 commit comments