Skip to content

Commit 87459d6

Browse files
Merge pull request #63665 from nate-chandler/variadic-generics/irgen/full_metadata_binding
[GenPack] Emit all element signature requirements.
2 parents 594257f + c5563ff commit 87459d6

File tree

5 files changed

+473
-205
lines changed

5 files changed

+473
-205
lines changed

include/swift/IRGen/GenericRequirement.h

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ class GenericRequirement {
5858
GenericRequirement(Kind kind, CanType type, ProtocolDecl *proto)
5959
: kind(kind), type(type), proto(proto) {}
6060

61-
static bool isPack(CanType ty) {
62-
if (auto gp = dyn_cast<GenericTypeParamType>(ty))
63-
return gp->isParameterPack();
64-
if (auto dm = dyn_cast<DependentMemberType>(ty))
65-
if (auto gp =
66-
dyn_cast<GenericTypeParamType>(dm->getBase()->getCanonicalType()))
67-
return gp->isParameterPack();
68-
return false;
69-
}
70-
7161
public:
7262
Kind getKind() const {
7363
return kind;
@@ -91,7 +81,7 @@ class GenericRequirement {
9181
}
9282

9383
bool isMetadata() const {
94-
return kind == Kind::Metadata;
84+
return kind == Kind::Metadata || kind == Kind::MetadataPack;
9585
}
9686

9787
static GenericRequirement forMetadata(CanType type, bool isPack) {
@@ -100,11 +90,11 @@ class GenericRequirement {
10090
}
10191

10292
static GenericRequirement forMetadata(CanType type) {
103-
return forMetadata(type, isPack(type));
93+
return forMetadata(type, type->hasParameterPack());
10494
}
10595

10696
bool isWitnessTable() const {
107-
return kind == Kind::WitnessTable;
97+
return kind == Kind::WitnessTable || kind == Kind::WitnessTablePack;
10898
}
10999

110100
static GenericRequirement forWitnessTable(CanType type, ProtocolDecl *proto,
@@ -114,7 +104,7 @@ class GenericRequirement {
114104
}
115105

116106
static GenericRequirement forWitnessTable(CanType type, ProtocolDecl *proto) {
117-
return forWitnessTable(type, proto, isPack(type));
107+
return forWitnessTable(type, proto, type->hasParameterPack());
118108
}
119109

120110
static llvm::Type *typeForKind(irgen::IRGenModule &IGM,

0 commit comments

Comments
 (0)