19
19
20
20
#include " swift/AST/LayoutConstraint.h"
21
21
#include " swift/AST/RequirementKind.h"
22
+ #include " swift/AST/KnownProtocols.h"
22
23
#include " swift/AST/Type.h"
23
24
#include " swift/Basic/Debug.h"
24
25
#include " llvm/ADT/Hashing.h"
25
26
#include " llvm/ADT/PointerIntPair.h"
26
27
#include " llvm/Support/ErrorHandling.h"
27
28
28
29
namespace swift {
29
-
30
- enum class InvertibleProtocolKind : uint8_t ;
30
+ class GenericContext ;
31
31
32
32
// / Return type of Requirement::checkRequirement().
33
33
enum class CheckRequirementResult : uint8_t {
@@ -230,6 +230,7 @@ struct StructuralRequirement {
230
230
bool fromDefault = false ;
231
231
};
232
232
233
+ // / An "anti-conformance" requirement `Subject: ~Protocol`.
233
234
struct InverseRequirement {
234
235
Type subject;
235
236
ProtocolDecl *protocol;
@@ -239,13 +240,17 @@ struct InverseRequirement {
239
240
240
241
InvertibleProtocolKind getKind () const ;
241
242
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,
243
246
SmallVectorImpl<Type> &result);
244
247
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 );
248
251
252
+ // / Appends additional requirements corresponding to defaults for the given
253
+ // / generic parameters.
249
254
static void expandDefaults (ASTContext &ctx,
250
255
ArrayRef<Type> gps,
251
256
SmallVectorImpl<StructuralRequirement> &result);
0 commit comments