From 94df8da6766fef6ae0824525b82fbdd0dccaed54 Mon Sep 17 00:00:00 2001 From: Holly Borla Date: Thu, 17 Jul 2025 10:12:41 -0700 Subject: [PATCH] [Concurrency] Downgrade isolated conformances to SendableMetatype protocols to a warning for implicitly `@preconcurrency` protocols. (cherry picked from commit 4b50238ebf0c067c57af066671cb9786ea00585a) --- lib/Sema/TypeCheckConcurrency.cpp | 1 + .../sendable_objc_attr_in_type_context_swift5.swift | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/Sema/TypeCheckConcurrency.cpp b/lib/Sema/TypeCheckConcurrency.cpp index a13432f2e20b9..72095e3466816 100644 --- a/lib/Sema/TypeCheckConcurrency.cpp +++ b/lib/Sema/TypeCheckConcurrency.cpp @@ -8355,6 +8355,7 @@ RawConformanceIsolationRequest::evaluate( if (proto->inheritsFrom(sendableMetatype)) { bool isPreconcurrency = moduleImportForPreconcurrency( proto, conformance->getDeclContext()) != nullptr; + isPreconcurrency |= proto->preconcurrency(); ctx.Diags.diagnose( rootNormal->getLoc(), diag::isolated_conformance_to_sendable_metatype, diff --git a/test/Concurrency/sendable_objc_attr_in_type_context_swift5.swift b/test/Concurrency/sendable_objc_attr_in_type_context_swift5.swift index 7e9d6c7c0f6ec..d4b1d55ba7305 100644 --- a/test/Concurrency/sendable_objc_attr_in_type_context_swift5.swift +++ b/test/Concurrency/sendable_objc_attr_in_type_context_swift5.swift @@ -211,3 +211,7 @@ extension TestDR { @_dynamicReplacement(for: test(completion:)) func __replaceObjCFunc(_: @escaping () -> Void) {} // Ok } + +@MainActor +class InvalidIsolated: NSObject, @MainActor P {} +// expected-warning@-1 {{cannot form main actor-isolated conformance of 'InvalidIsolated' to SendableMetatype-inheriting protocol 'P'}}