@@ -2159,9 +2159,9 @@ class PoundDiagnosticDecl : public Decl {
2159
2159
class OpaqueTypeDecl ;
2160
2160
2161
2161
// / Describes the least favorable positions at which a requirement refers
2162
- // / to 'Self' in terms of variance, for use in the is-inheritable and
2163
- // / is-available-existential checks.
2164
- class SelfReferenceInfo final {
2162
+ // / to a given generic parameter in terms of variance, for use in the
2163
+ // / is-inheritable and is- available-existential checks.
2164
+ class GenericParameterReferenceInfo final {
2165
2165
using OptionalTypePosition = OptionalEnum<decltype (TypePosition::Covariant)>;
2166
2166
2167
2167
public:
@@ -2171,27 +2171,27 @@ class SelfReferenceInfo final {
2171
2171
OptionalTypePosition assocTypeRef;
2172
2172
2173
2173
// / A reference to 'Self'.
2174
- static SelfReferenceInfo forSelfRef (TypePosition position) {
2175
- return SelfReferenceInfo (false , position, llvm::None);
2174
+ static GenericParameterReferenceInfo forSelfRef (TypePosition position) {
2175
+ return GenericParameterReferenceInfo (false , position, llvm::None);
2176
2176
}
2177
2177
2178
2178
// / A reference to 'Self' through an associated type.
2179
- static SelfReferenceInfo forAssocTypeRef (TypePosition position) {
2180
- return SelfReferenceInfo (false , llvm::None, position);
2179
+ static GenericParameterReferenceInfo forAssocTypeRef (TypePosition position) {
2180
+ return GenericParameterReferenceInfo (false , llvm::None, position);
2181
2181
}
2182
2182
2183
- SelfReferenceInfo &operator |=(const SelfReferenceInfo &other);
2183
+ GenericParameterReferenceInfo &operator |=(const GenericParameterReferenceInfo &other);
2184
2184
2185
2185
explicit operator bool () const {
2186
2186
return hasCovariantSelfResult || selfRef || assocTypeRef;
2187
2187
}
2188
2188
2189
- SelfReferenceInfo ()
2189
+ GenericParameterReferenceInfo ()
2190
2190
: hasCovariantSelfResult(false ), selfRef(llvm::None),
2191
2191
assocTypeRef (llvm::None) {}
2192
2192
2193
2193
private:
2194
- SelfReferenceInfo (bool hasCovariantSelfResult, OptionalTypePosition selfRef,
2194
+ GenericParameterReferenceInfo (bool hasCovariantSelfResult, OptionalTypePosition selfRef,
2195
2195
OptionalTypePosition assocTypeRef)
2196
2196
: hasCovariantSelfResult(hasCovariantSelfResult), selfRef(selfRef),
2197
2197
assocTypeRef(assocTypeRef) {}
@@ -2682,7 +2682,7 @@ class ValueDecl : public Decl {
2682
2682
// / is considered covariant only when it appears as the immediate type of a
2683
2683
// / property, or the uncurried result type of a method/subscript, e.g.
2684
2684
// / '() -> () -> Self'.
2685
- SelfReferenceInfo findExistentialSelfReferences (
2685
+ GenericParameterReferenceInfo findExistentialSelfReferences (
2686
2686
Type baseTy, bool treatNonResultCovariantSelfAsInvariant) const ;
2687
2687
};
2688
2688
@@ -7800,6 +7800,14 @@ class MissingMemberDecl : public Decl {
7800
7800
}
7801
7801
};
7802
7802
7803
+ // / Find references to the given generic paramaeter in the generic signature
7804
+ // / and the type of the given value.
7805
+ GenericParameterReferenceInfo findGenericParameterReferences (
7806
+ const ValueDecl *value,
7807
+ CanGenericSignature sig, GenericTypeParamType *genericParam,
7808
+ bool treatNonResultCovarianceAsInvariant,
7809
+ Optional<unsigned > skipParamIndex);
7810
+
7803
7811
inline bool AbstractStorageDecl::isSettable (const DeclContext *UseDC,
7804
7812
const DeclRefExpr *base) const {
7805
7813
if (auto vd = dyn_cast<VarDecl>(this ))
0 commit comments