@@ -55,10 +55,10 @@ class GenericRequirement {
5555 CanType type;
5656 ProtocolDecl *proto;
5757
58+ public:
5859 GenericRequirement (Kind kind, CanType type, ProtocolDecl *proto)
5960 : kind(kind), type(type), proto(proto) {}
6061
61- public:
6262 Kind getKind () const {
6363 return kind;
6464 }
@@ -76,35 +76,34 @@ class GenericRequirement {
7676 }
7777
7878 static GenericRequirement forShape (CanType type) {
79- assert (type->isParameterPack ());
79+ assert (!isa<PackType>(type));
80+ assert (type->isParameterPack () || isa<PackArchetypeType>(type));
8081 return GenericRequirement (Kind::Shape, type, nullptr );
8182 }
8283
8384 bool isMetadata () const {
8485 return kind == Kind::Metadata || kind == Kind::MetadataPack;
8586 }
8687
87- static GenericRequirement forMetadata (CanType type, bool isPack) {
88- auto kind = isPack ? Kind::MetadataPack : Kind::Metadata;
89- return GenericRequirement (kind, type, nullptr );
90- }
91-
9288 static GenericRequirement forMetadata (CanType type) {
93- return forMetadata (type, type->hasParameterPack ());
89+ assert (!isa<PackType>(type));
90+ auto kind = ((type->isParameterPack () ||
91+ isa<PackArchetypeType>(type))
92+ ? Kind::MetadataPack : Kind::Metadata);
93+ return GenericRequirement (kind, type, nullptr );
9494 }
9595
9696 bool isWitnessTable () const {
9797 return kind == Kind::WitnessTable || kind == Kind::WitnessTablePack;
9898 }
9999
100- static GenericRequirement forWitnessTable (CanType type, ProtocolDecl *proto,
101- bool isPack) {
102- auto kind = isPack ? Kind::WitnessTablePack : Kind::WitnessTable;
103- return GenericRequirement (kind, type, proto);
104- }
105-
106100 static GenericRequirement forWitnessTable (CanType type, ProtocolDecl *proto) {
107- return forWitnessTable (type, proto, type->hasParameterPack ());
101+ assert (!isa<PackType>(type));
102+ auto kind = ((type->isParameterPack () ||
103+ isa<PackArchetypeType>(type))
104+ ? Kind::WitnessTablePack
105+ : Kind::WitnessTable);
106+ return GenericRequirement (kind, type, proto);
108107 }
109108
110109 static llvm::Type *typeForKind (irgen::IRGenModule &IGM,
@@ -142,12 +141,14 @@ template <> struct DenseMapInfo<swift::GenericRequirement> {
142141 using GenericRequirement = swift::GenericRequirement;
143142 using CanTypeInfo = llvm::DenseMapInfo<swift::CanType>;
144143 static GenericRequirement getEmptyKey () {
145- return GenericRequirement::forMetadata (CanTypeInfo::getEmptyKey (),
146- /* isPack=*/ false );
144+ return GenericRequirement (GenericRequirement::Kind::Metadata,
145+ CanTypeInfo::getEmptyKey (),
146+ nullptr );
147147 }
148148 static GenericRequirement getTombstoneKey () {
149- return GenericRequirement::forMetadata (CanTypeInfo::getTombstoneKey (),
150- /* isPack=*/ false );
149+ return GenericRequirement (GenericRequirement::Kind::Metadata,
150+ CanTypeInfo::getTombstoneKey (),
151+ nullptr );
151152 }
152153 static llvm::hash_code getHashValue (GenericRequirement req) {
153154 return hash_combine (CanTypeInfo::getHashValue (req.getTypeParameter ()),
0 commit comments