Skip to content

Commit f8ca0f0

Browse files
authored
Merge pull request #83138 from hborla/6.2-invalid-isolated-conformance-downgrade
[6.2][Concurrency] Downgrade isolated conformances to `SendableMetatype` protocols to a warning for implicitly `@preconcurrency` protocols.
2 parents a345e3a + 94df8da commit f8ca0f0

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
@@ -8355,6 +8355,7 @@ RawConformanceIsolationRequest::evaluate(
83558355
if (proto->inheritsFrom(sendableMetatype)) {
83568356
bool isPreconcurrency = moduleImportForPreconcurrency(
83578357
proto, conformance->getDeclContext()) != nullptr;
8358+
isPreconcurrency |= proto->preconcurrency();
83588359
ctx.Diags.diagnose(
83598360
rootNormal->getLoc(),
83608361
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)