Skip to content

Commit 1b2ef54

Browse files
authored
Merge pull request #35714 from DougGregor/global-actors-conformance-objc
2 parents 95662b0 + d12b390 commit 1b2ef54

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,8 +2749,12 @@ bool ConformanceChecker::checkActorIsolation(
27492749
//
27502750
// However, we allow this case when the requirement was imported, because
27512751
// it might not have been annotated.
2752-
if (witnessGlobalActor && !requirementGlobalActor &&
2753-
!requirement->hasClangNode()) {
2752+
if (witnessGlobalActor && !requirementGlobalActor) {
2753+
// If the requirement was imported from Objective-C, it may not have been
2754+
// annotated appropriately. Allow the mismatch.
2755+
if (requirement->hasClangNode())
2756+
return false;
2757+
27542758
witness->diagnose(
27552759
diag::global_actor_isolated_witness, witness->getDescriptiveKind(),
27562760
witness->getName(), witnessGlobalActor, Proto->getName());

test/ClangImporter/objc_async_conformance.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,13 @@ class SelectorOK2 : NSObject, RequiredObserverOnlyCompletion {
6464
class Rock : NSObject, Rollable {
6565
func roll(completionHandler: @escaping () -> Void) { completionHandler() }
6666
func roll() { roll(completionHandler: {}) }
67-
}
67+
}
68+
69+
// Crash involving actor isolation checking.
70+
class C5 {
71+
@MainActor @objc var allOperations: [String] = []
72+
}
73+
74+
class C6: C5, ServiceProvider {
75+
@MainActor func allOperations() async -> [String] { [] }
76+
}

0 commit comments

Comments
 (0)