Skip to content

[BitwiseCopyable] Don't infer for noncopyable. #72929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/Sema/TypeCheckBitwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
11 changes: 11 additions & 0 deletions test/ModuleInterface/bitwise_copyable.swift
Original file line number Diff line number Diff line change
@@ -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 {}