Skip to content

Commit 2e01f4e

Browse files
committed
GenProto: drop cond. Copyable reqs from descriptor
1 parent 4d484c9 commit 2e01f4e

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,17 +2113,28 @@ namespace {
21132113
if (!normal)
21142114
return;
21152115

2116-
std::optional<Requirement> scratchRequirement;
2117-
auto condReqs = normal->getConditionalRequirements();
2116+
SmallVector<Requirement, 2> condReqs;
2117+
{
2118+
// FIXME(kavon): probably need to emit the inverse requirements in the
2119+
// metadata so the runtime knows not to check for Copyable? For now
2120+
// filter them out.
2121+
auto origCondReqs = normal->getConditionalRequirements();
2122+
for (auto req : origCondReqs) {
2123+
if (req.getKind() == RequirementKind::Conformance &&
2124+
req.getProtocolDecl()->getInvertibleProtocolKind())
2125+
continue;
2126+
condReqs.push_back(req);
2127+
}
2128+
}
2129+
21182130
if (condReqs.empty()) {
21192131
// For a protocol P that conforms to another protocol, introduce a
21202132
// conditional requirement for that P's Self: P. This aligns with
21212133
// SILWitnessTable::enumerateWitnessTableConditionalConformances().
21222134
if (auto selfProto = normal->getDeclContext()->getSelfProtocolDecl()) {
21232135
auto selfType = selfProto->getSelfInterfaceType()->getCanonicalType();
2124-
scratchRequirement.emplace(RequirementKind::Conformance, selfType,
2125-
selfProto->getDeclaredInterfaceType());
2126-
condReqs = *scratchRequirement;
2136+
condReqs.emplace_back(RequirementKind::Conformance, selfType,
2137+
selfProto->getDeclaredInterfaceType());
21272138
}
21282139

21292140
if (condReqs.empty())

0 commit comments

Comments
 (0)