1919
2020#include " swift/AST/LayoutConstraint.h"
2121#include " swift/AST/RequirementKind.h"
22+ #include " swift/AST/KnownProtocols.h"
2223#include " swift/AST/Type.h"
2324#include " swift/Basic/Debug.h"
2425#include " llvm/ADT/Hashing.h"
2526#include " llvm/ADT/PointerIntPair.h"
2627#include " llvm/Support/ErrorHandling.h"
2728
2829namespace swift {
29-
30- enum class InvertibleProtocolKind : uint8_t ;
30+ class GenericContext ;
3131
3232// / Return type of Requirement::checkRequirement().
3333enum class CheckRequirementResult : uint8_t {
@@ -230,6 +230,7 @@ struct StructuralRequirement {
230230 bool fromDefault = false ;
231231};
232232
233+ // / An "anti-conformance" requirement `Subject: ~Protocol`.
233234struct InverseRequirement {
234235 Type subject;
235236 ProtocolDecl *protocol;
@@ -239,13 +240,17 @@ struct InverseRequirement {
239240
240241 InvertibleProtocolKind getKind () const ;
241242
242- static void enumerateDefaultedParams (TypeDecl *decl,
243+ // / Adds the type parameters of this generic context to the result if
244+ // / it has default requirements.
245+ static void enumerateDefaultedParams (GenericContext *decl,
243246 SmallVectorImpl<Type> &result);
244247
245- static void expandDefault (Type gp,
246- SourceLoc loc,
247- SmallVectorImpl<StructuralRequirement> &result );
248+ // / \returns the protocols that are required by default for the given type
249+ // / parameter. These are not inverses themselves.
250+ static InvertibleProtocolSet expandDefault (Type gp );
248251
252+ // / Appends additional requirements corresponding to defaults for the given
253+ // / generic parameters.
249254 static void expandDefaults (ASTContext &ctx,
250255 ArrayRef<Type> gps,
251256 SmallVectorImpl<StructuralRequirement> &result);
0 commit comments