From 8ac83b00c7dbb6679067746ce83718ed593aab64 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Wed, 16 Jul 2025 15:38:21 -0700 Subject: [PATCH] [SE-0316] Update to match implemented behavior of global actor inference --- proposals/0316-global-actors.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/proposals/0316-global-actors.md b/proposals/0316-global-actors.md index 79ba23067a..538009fa9b 100644 --- a/proposals/0316-global-actors.md +++ b/proposals/0316-global-actors.md @@ -67,7 +67,7 @@ func notOnTheMainActor() async { increaseTextSize() // error: increaseTextSize is isolated to MainActor, cannot call synchronously await increaseTextSize() // okay: asynchronous call hops over to the main thread and executes there } -``` +``` ### Defining global actors @@ -316,7 +316,7 @@ Declarations that are not explicitly annotated with either a global actor or `no } ``` -* A non-actor type that conforms to a global-actor-qualified protocol within the same source file as its primary definition infers actor isolation from that protocol: +* A non-actor type that conforms to a global-actor-qualified protocol in its primary definition infers actor isolation from that protocol: ```swift @MainActor protocol P { @@ -325,6 +325,12 @@ Declarations that are not explicitly annotated with either a global actor or `no class C: P { } // C is implicitly @MainActor + class C2 { } + + extension C2: P { // C2 is not implicitly @MainActor + func updateUI() { } // okay, implicitly @MainActor + } + // source file D.swift class D { }