Skip to content

Commit f374c6c

Browse files
authored
[SE-0446] Amend to clarify that types within nonisolated types don't get default main actor inference (#2915)
1 parent 36e135e commit f374c6c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

proposals/0466-control-default-actor-isolation.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ When the default actor isolation is specified as `MainActor`, declarations are i
6666
* All declarations inside an `actor` type, including static variables, methods, initializers, and deinitializers
6767
* Declarations that cannot have global actor isolation, including typealiases, import statements, enum cases, and individual accessors
6868
* Declarations whose primary definition directly conforms to a protocol that inherits `SendableMetatype`
69+
* Declarations that are types nested within a nonisolated type
6970

7071
The following code example shows the inferred actor isolation in comments given the code is built with `-default-isolation MainActor`:
7172

@@ -112,7 +113,13 @@ struct S: P {
112113
nonisolated protocol Q: Sendable { }
113114

114115
// nonisolated
115-
struct S2: Q { }
116+
struct S2: Q {
117+
// nonisolated
118+
struct Inner { }
119+
120+
// @MyActor
121+
struct IsolatedInner: P
122+
}
116123

117124
// @MainActor
118125
struct S3 { }

0 commit comments

Comments
 (0)