Skip to content

[SE-0316] Update to match implemented behavior of global actor inference #2919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions proposals/0316-global-actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand All @@ -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 { }

Expand Down