Skip to content

Commit 9214b0c

Browse files
authored
Merge pull request #83136 from hborla/invalid-isolated-conformance-downgrade
[Concurrency] Downgrade isolated conformances to `SendableMetatype` protocols to a warning for implicitly `@preconcurrency` protocols.
2 parents d586f15 + 4b50238 commit 9214b0c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8343,6 +8343,7 @@ RawConformanceIsolationRequest::evaluate(
83438343
if (proto->inheritsFrom(sendableMetatype)) {
83448344
bool isPreconcurrency = moduleImportForPreconcurrency(
83458345
proto, conformance->getDeclContext()) != nullptr;
8346+
isPreconcurrency |= proto->preconcurrency();
83468347
ctx.Diags.diagnose(
83478348
conformance->getLoc(),
83488349
diag::isolated_conformance_to_sendable_metatype,

test/Concurrency/sendable_objc_attr_in_type_context_swift5.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,7 @@ extension TestDR {
211211
@_dynamicReplacement(for: test(completion:))
212212
func __replaceObjCFunc(_: @escaping () -> Void) {} // Ok
213213
}
214+
215+
@MainActor
216+
class InvalidIsolated: NSObject, @MainActor P {}
217+
// expected-warning@-1 {{cannot form main actor-isolated conformance of 'InvalidIsolated' to SendableMetatype-inheriting protocol 'P'}}

0 commit comments

Comments
 (0)