[BitwiseCopyable] Permit conformance in overlay.

rdar://139759304
This commit is contained in:
Nate Chandler
2024-11-12 16:53:46 -08:00
parent 8c0453d1a0
commit 80390ce1d1
2 changed files with 5 additions and 2 deletions

View File

@@ -417,9 +417,10 @@ bool swift::checkBitwiseCopyableConformance(ProtocolConformance *conformance,
return false;
}
// BitwiseCopyable must be added in the same source file.
// BitwiseCopyable must be added in the same module or its overlay.
auto conformanceDecl = conformanceDC->getAsDecl();
if (conformanceDecl->getModuleContext() != nominal->getModuleContext()) {
if (!conformanceDecl->getModuleContext()->isSameModuleLookingThroughOverlays(
nominal->getModuleContext())) {
conformanceDecl->diagnose(diag::bitwise_copyable_outside_module, nominal);
return true;
}

View File

@@ -1,3 +1,5 @@
@_exported import ClangModuleWithOverlay
extension ClangType : BitwiseCopyable {}
public func fromSwiftOverlay() {}