@@ -553,11 +553,12 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
553
553
// / Whether the existential of this protocol conforms to itself.
554
554
ExistentialConformsToSelf : 1 ,
555
555
556
- // / Whether the \c ExistentialRequiresAny bit is valid.
557
- ExistentialRequiresAnyValid : 1 ,
556
+ // / Whether the \c HasSelfOrAssociatedTypeRequirements bit is valid.
557
+ HasSelfOrAssociatedTypeRequirementsValid : 1 ,
558
558
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 ,
561
562
562
563
// / True if the protocol has requirements that cannot be satisfied (e.g.
563
564
// / because they could not be imported from Objective-C).
@@ -4756,19 +4757,19 @@ class ProtocolDecl final : public NominalTypeDecl {
4756
4757
Bits.ProtocolDecl .ExistentialConformsToSelf = result;
4757
4758
}
4758
4759
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 ;
4764
4765
4765
4766
return None;
4766
4767
}
4767
4768
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 ;
4772
4773
}
4773
4774
4774
4775
bool hasLazyRequirementSignature () const {
@@ -4785,11 +4786,9 @@ class ProtocolDecl final : public NominalTypeDecl {
4785
4786
friend class TypeAliasRequirementsRequest ;
4786
4787
friend class ProtocolDependenciesRequest ;
4787
4788
friend class RequirementSignatureRequest ;
4788
- friend class RequirementSignatureRequestRQM ;
4789
- friend class RequirementSignatureRequestGSB ;
4790
4789
friend class ProtocolRequiresClassRequest ;
4791
4790
friend class ExistentialConformsToSelfRequest ;
4792
- friend class ExistentialRequiresAnyRequest ;
4791
+ friend class HasSelfOrAssociatedTypeRequirementsRequest ;
4793
4792
friend class InheritedProtocolsRequest ;
4794
4793
friend class PrimaryAssociatedTypesRequest ;
4795
4794
friend class ProtocolRequirementsRequest ;
@@ -4888,15 +4887,20 @@ class ProtocolDecl final : public NominalTypeDecl {
4888
4887
// / Does this protocol require a self-conformance witness table?
4889
4888
bool requiresSelfConformanceWitnessTable () const ;
4890
4889
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:
4894
4895
// / - The protocol has an associated type requirement.
4895
4896
// / - `Self` appears in non-covariant position in the type signature of a
4896
4897
// / value requirement.
4898
+ bool hasSelfOrAssociatedTypeRequirements () const ;
4899
+
4900
+ // / Determine whether an existential type constrained by this protocol must
4901
+ // / be written using `any` syntax.
4897
4902
// /
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.
4900
4904
bool existentialRequiresAny () const ;
4901
4905
4902
4906
// / Returns a list of protocol requirements that must be assessed to
0 commit comments