diff --git a/lib/Sema/TypeCheckBitwise.cpp b/lib/Sema/TypeCheckBitwise.cpp index 50a788665e023..1f074b001a1ce 100644 --- a/lib/Sema/TypeCheckBitwise.cpp +++ b/lib/Sema/TypeCheckBitwise.cpp @@ -229,6 +229,12 @@ void BitwiseCopyableStorageVisitor::emitNonconformingMemberTypeDiagnostic( static bool checkBitwiseCopyableInstanceStorage(NominalTypeDecl *nominal, DeclContext *dc, BitwiseCopyableCheck check) { + if (dc->mapTypeIntoContext(nominal->getDeclaredInterfaceType()) + ->isNoncopyable()) { + // Already separately diagnosed when explicit. + return true; + } + assert(dc->getParentModule()->getASTContext().getProtocol( KnownProtocolKind::BitwiseCopyable)); diff --git a/test/ModuleInterface/bitwise_copyable.swift b/test/ModuleInterface/bitwise_copyable.swift new file mode 100644 index 0000000000000..b597643def109 --- /dev/null +++ b/test/ModuleInterface/bitwise_copyable.swift @@ -0,0 +1,11 @@ +// RUN: %empty-directory(%t) +// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name Test -enable-experimental-feature BitwiseCopyable +// RUN: %FileCheck %s < %t.swiftinterface +// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Test + + +@frozen +@_moveOnly +public struct S_Implicit_Noncopyable {} + +// CHECK-NOT: extension Test.S_Implicit_Noncopyable : Swift._BitwiseCopyable {}