Skip to content

Commit 1bfd491

Browse files
authored
Merge pull request #1 from ktoso/patch-6
Fix some code snippets in NNNN-nonisolated-for-global-actor-cutoff.md
2 parents 968e64c + 141d839 commit 1bfd491

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

proposals/NNNN-nonisolated-for-global-actor-cutoff.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ In the above code, `S` can still conform to the globally-isolated protocol `P` w
5151
However, the above method would not work for cutting off the global isolation inference on a protocol itself. There is a very nonobvious workaround: when the compiler is inferring global actor isolation, if there are multiple inference sources with conflicting global actors, no global actor is inferred. This is demonstrated by the following example:
5252

5353
```swift
54-
class FakeExecutor: FakeGlobalActor {
54+
final class FakeExecutor: SerialExecutor {
5555
static let shared: FakeExecutor = .init()
5656

5757
func enqueue(_ job: consuming ExecutorJob) {
@@ -65,15 +65,15 @@ public actor FakeGlobalActor: Sendable {
6565

6666
private init() {}
6767
public nonisolated var unownedExecutor: UnownedSerialExecutor {
68-
FakeGlobalActor.shared.asUnownedSerialExecutor()
68+
FakeExecutor.shared.asUnownedSerialExecutor()
6969
}
7070
}
7171

7272
@MainActor
7373
protocol GloballyIsolated {}
7474

7575
@FakeGlobalActor
76-
protocol RemoveGlobalActor
76+
protocol RemoveGlobalActor {}
7777

7878
protocol RefinedProtocol: GloballyIsolated, RemoveGlobalActor {} // 'RefinedProtocol' is non-isolated
7979
```

0 commit comments

Comments
 (0)