add a Copyable conformance for PackExpansionType

This commit is contained in:
Kavon Farvardin
2023-03-02 22:15:28 -08:00
parent 091d63a5c8
commit d69c0378a6
2 changed files with 16 additions and 0 deletions

View File

@@ -1724,6 +1724,16 @@ LookupConformanceInModuleRequest::evaluate(
return getBuiltinBuiltinTypeConformance(type, builtinType, protocol);
}
// Specific handling of Copyable for pack expansions.
if (auto packExpansion = type->getAs<PackExpansionType>()) {
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
auto patternType = packExpansion->getPatternType();
return (patternType->isTypeParameter()
? ProtocolConformanceRef(protocol)
: mod->lookupConformance(patternType, protocol));
}
}
auto nominal = type->getAnyNominal();
// If we don't have a nominal type, there are no conformances.