slight tweak to how implicit conformance of nominals is generated

Also, only generate those conformances when the move-only feature is on,
for now.
This commit is contained in:
Kavon Farvardin
2023-01-30 13:34:28 -08:00
parent 18b1389542
commit 66ac9bb592
2 changed files with 14 additions and 6 deletions

View File

@@ -1659,6 +1659,15 @@ LookupConformanceInModuleRequest::evaluate(
} else {
return ProtocolConformanceRef::forMissingOrInvalid(type, protocol);
}
} else if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
// Only move-only nominals are not Copyable
if (nominal->isMoveOnly()) {
return ProtocolConformanceRef::forInvalid();
} else {
// FIXME: this should probably follow the Sendable case in that
// we should synthesize and append a ProtocolConformance to the `conformances` list.
return ProtocolConformanceRef(protocol);
}
} else {
// Was unable to infer the missing conformance.
return ProtocolConformanceRef::forMissingOrInvalid(type, protocol);