Skip to content

Commit 5d7ae8a

Browse files
Merge pull request #72934 from nate-chandler/cherrypick/release/6.0/rdar126135770
6.0: [BitwiseCopyable] Don't infer for noncopyable.
2 parents 8ea0787 + 40657fe commit 5d7ae8a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/Sema/TypeCheckBitwise.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ void BitwiseCopyableStorageVisitor::emitNonconformingMemberTypeDiagnostic(
229229
static bool checkBitwiseCopyableInstanceStorage(NominalTypeDecl *nominal,
230230
DeclContext *dc,
231231
BitwiseCopyableCheck check) {
232+
if (dc->mapTypeIntoContext(nominal->getDeclaredInterfaceType())
233+
->isNoncopyable()) {
234+
// Already separately diagnosed when explicit.
235+
return true;
236+
}
237+
232238
assert(dc->getParentModule()->getASTContext().getProtocol(
233239
KnownProtocolKind::BitwiseCopyable));
234240

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name Test -enable-experimental-feature BitwiseCopyable
3+
// RUN: %FileCheck %s < %t.swiftinterface
4+
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Test
5+
6+
7+
@frozen
8+
@_moveOnly
9+
public struct S_Implicit_Noncopyable {}
10+
11+
// CHECK-NOT: extension Test.S_Implicit_Noncopyable : Swift._BitwiseCopyable {}

0 commit comments

Comments
 (0)