Skip to content

Commit 40657fe

Browse files
committed
[BitwiseCopyable] Don't infer for noncopyable.
This bailout was accidentally removed in #72856 when removing a duplicative diagnostic. rdar://126135770
1 parent b099cd5 commit 40657fe

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)