Skip to content

Commit 72bf30b

Browse files
committed
[Isolation] Propagate global actors from witnesses.
1 parent 4ae5262 commit 72bf30b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,8 @@ ActorIsolation ActorIsolationRequest::evaluate(
26692669
// If the declaration witnesses a protocol requirement that is isolated,
26702670
// use that.
26712671
if (auto witnessedIsolation = getIsolationFromWitnessedRequirements(value)) {
2672-
if (auto inferred = inferredIsolation(*witnessedIsolation))
2672+
if (auto inferred = inferredIsolation(
2673+
*witnessedIsolation, /*propagateUnsafe=*/defaultIsolation))
26732674
return inferred;
26742675
}
26752676

test/ClangImporter/objc_async.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func testSlowServerOldSchool(slowServer: SlowServer) {
7777
func globalAsync() async { }
7878

7979
actor MySubclassCheckingSwiftAttributes : ProtocolWithSwiftAttributes {
80-
func syncMethod() { } // expected-note {{calls to instance method 'syncMethod()' from outside of its actor context are implicitly asynchronous}}
80+
func syncMethod() { } // expected-note 2{{calls to instance method 'syncMethod()' from outside of its actor context are implicitly asynchronous}}
8181

8282
func independentMethod() {
8383
syncMethod() // expected-error{{ctor-isolated instance method 'syncMethod()' can not be referenced from a non-isolated context}}
@@ -88,7 +88,7 @@ actor MySubclassCheckingSwiftAttributes : ProtocolWithSwiftAttributes {
8888
}
8989

9090
func mainActorMethod() {
91-
syncMethod()
91+
syncMethod() // expected-error{{actor-isolated instance method 'syncMethod()' can not be referenced from synchronous context of global actor 'MainActor'}}
9292
}
9393

9494
func uiActorMethod() { }

0 commit comments

Comments
 (0)