Skip to content

[GenPack] Emit all element signature requirements. #63665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions include/swift/IRGen/GenericRequirement.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ class GenericRequirement {
GenericRequirement(Kind kind, CanType type, ProtocolDecl *proto)
: kind(kind), type(type), proto(proto) {}

static bool isPack(CanType ty) {
if (auto gp = dyn_cast<GenericTypeParamType>(ty))
return gp->isParameterPack();
if (auto dm = dyn_cast<DependentMemberType>(ty))
if (auto gp =
dyn_cast<GenericTypeParamType>(dm->getBase()->getCanonicalType()))
return gp->isParameterPack();
return false;
}

public:
Kind getKind() const {
return kind;
Expand All @@ -91,7 +81,7 @@ class GenericRequirement {
}

bool isMetadata() const {
return kind == Kind::Metadata;
return kind == Kind::Metadata || kind == Kind::MetadataPack;
}

static GenericRequirement forMetadata(CanType type, bool isPack) {
Expand All @@ -100,11 +90,11 @@ class GenericRequirement {
}

static GenericRequirement forMetadata(CanType type) {
return forMetadata(type, isPack(type));
return forMetadata(type, type->hasParameterPack());
}

bool isWitnessTable() const {
return kind == Kind::WitnessTable;
return kind == Kind::WitnessTable || kind == Kind::WitnessTablePack;
}

static GenericRequirement forWitnessTable(CanType type, ProtocolDecl *proto,
Expand All @@ -114,7 +104,7 @@ class GenericRequirement {
}

static GenericRequirement forWitnessTable(CanType type, ProtocolDecl *proto) {
return forWitnessTable(type, proto, isPack(type));
return forWitnessTable(type, proto, type->hasParameterPack());
}

static llvm::Type *typeForKind(irgen::IRGenModule &IGM,
Expand Down
Loading