@@ -1660,7 +1660,7 @@ extension Person: Equatable {
16601660You can opt out of this inference for a global-actor-isolated type
16611661by explicitly declaring that a protocol conformance is nonisolated.
16621662The following code example declares
1663- a nonisolated isolated conformance to ` Equatable ` in an extension:
1663+ a nonisolated conformance to ` Equatable ` in an extension:
16641664
16651665``` swift
16661666@MainActor
@@ -1690,10 +1690,10 @@ A conformance requirement to `Sendable` allows generic code to send parameter
16901690values to concurrently-executing code. If generic code accepts non-` Sendable `
16911691types, then the generic code can only use the input values from the current
16921692isolation domain. These generic APIs can safely accept isolated conformances
1693- and call protocol requirement as long as the caller is on the same global
1693+ and call protocol requirements as long as the caller is on the same global
16941694actor that the conformance is isolated to. The following code has a protocol
16951695` P ` , a class ` C ` with a main-actor isolated conformance to ` P ` , and
1696- call-sites to the ` P.perform ` requirement from a main-actor
1696+ calls to the ` P.perform ` requirement from a main-actor
16971697task and a concurrent task:
16981698
16991699``` swift
@@ -1732,11 +1732,12 @@ from a concurrent task results in an error,
17321732because it would allow calling the main actor isolated implementation
17331733of ` P.perform ` from outside the main actor.
17341734
1735- Generic code can check whether a value conforms to a protocol
1735+ Abstract code that uses type parameters and ` any ` types
1736+ can check whether a value conforms to a protocol
17361737through dynamic casting.
17371738The following code has a protocol ` P ` ,
17381739and a method ` performIfP ` that accepts a parameter of type ` Any `
1739- which is dynamic cast to ` any P ` in the function body:
1740+ which is dynamically cast to ` any P ` in the function body:
17401741
17411742``` swift
17421743protocol P {
@@ -1754,11 +1755,13 @@ Isolated conformances are only safe to use
17541755when the code is running on the global actor
17551756that the conformance is isolated to,
17561757so the dynamic cast only succeeds
1757- if the dynamic cast occurs on the global actor.
1758- If you declare a main-actor isolated conformance to ` P `
1758+ if the dynamic cast occurs on that global actor.
1759+ For example, if you declare a main-actor isolated conformance to ` P `
17591760and call ` performIfP ` with an instance of the conforming type,
1760- the dynamic cast will only succeed
1761- when ` performIfP ` is called from the main actor:
1761+ the dynamic cast will succeed
1762+ when ` performIfP ` is called in a main actor task, and it
1763+ will fail when ` performIfP ` is called in a concurrent
1764+ task:
17621765
17631766``` swift
17641767@MainActor class C : @MainActor P {
@@ -1790,7 +1793,7 @@ so the dynamic cast fails and `perform` is not called.
17901793
17911794Protocol requirements can be used
17921795through instances of conforming types and through
1793- instances of the conforming types themselves
1796+ instances of the conforming types themselves,
17941797called * metatype values* .
17951798In generic code,
17961799a conformance requirement to ` Sendable ` or ` SendableMetatype `
@@ -1815,7 +1818,7 @@ func performConcurrently<T: P>(_ t: T) where T: Sendable {
18151818}
18161819```
18171820
1818- The above code admits data races if the conformance to ` P ` is isolated,
1821+ The above code would admit data races if the conformance to ` P ` was isolated,
18191822because the implementation of ` perform `
18201823may access global actor isolated state.
18211824To prevent data races,
0 commit comments