Skip to content

Commit d32afa1

Browse files
committed
Make isolated conformances explicit in code.
1 parent 1ecd2ba commit d32afa1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

TSPL.docc/LanguageGuide/Concurrency.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ func perform(_ p: some P) {
16971697
p.perform()
16981698
}
16991699

1700-
@MainActor class C: P { ... }
1700+
@MainActor class C: @MainActor P { ... }
17011701

17021702
Task { @MainActor in
17031703
let c = C()
@@ -1753,7 +1753,7 @@ the dynamic cast will only succeed
17531753
when `performIfP` is called from the main actor:
17541754

17551755
```swift
1756-
@MainActor class C: P {
1756+
@MainActor class C: @MainActor P {
17571757
func perform() {
17581758
print("C.perform")
17591759
}
@@ -1812,7 +1812,7 @@ Swift prohibits using an isolated conformance
18121812
when the type is also required to conform to `Sendable`:
18131813

18141814
```swift
1815-
@MainActor class C: P { ... }
1815+
@MainActor class C: @MainActor P { ... }
18161816

18171817
let c = C()
18181818
performConcurrently(c) // Error
@@ -1885,7 +1885,7 @@ Swift will prevent calling `createParallel`
18851885
with a type that has an isolated conformance to `P`:
18861886

18871887
```swift
1888-
@MainActor class C: P {
1888+
@MainActor class C: @MainActor P {
18891889
static func perform() { /* use main actor state */ }
18901890
}
18911891

0 commit comments

Comments
 (0)