File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
## Swift 5.11
7
7
8
+ * [ SE-0411] [ ] :
9
+
10
+ Default value expressions can now have the same isolation as the enclosing
11
+ function or the corresponding stored property:
12
+
13
+ ``` swift
14
+ @MainActor
15
+ func requiresMainActor () -> Int { ... }
16
+
17
+ class C {
18
+ @MainActor
19
+ var x: Int = requiresMainActor ()
20
+ }
21
+
22
+ @MainActor func defaultArg (value : Int = requiresMainActor ()) { ... }
23
+ ```
24
+
25
+ For isolated default values of stored properties, the implicit initialization
26
+ only happens in the body of an ` init ` with the same isolation. This closes
27
+ an important data-race safety hole where global-actor-isolated default values
28
+ could inadvertently run synchronously from outside the actor.
29
+
8
30
* [ SE-0413] [ ] :
9
31
10
32
Functions can now specify the type of error that they throw as part of the
@@ -9904,6 +9926,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
9904
9926
[SE- 0394 ]: https: // github.com/apple/swift-evolution/blob/main/proposals/0394-swiftpm-expression-macros.md
9905
9927
[SE- 0397 ]: https: // github.com/apple/swift-evolution/blob/main/proposals/0397-freestanding-declaration-macros.md
9906
9928
[SE- 0407 ]: https: // github.com/apple/swift-evolution/blob/main/proposals/0407-member-macro-conformances.md
9929
+ [SE- 0411 ]: https: // github.com/apple/swift-evolution/blob/main/proposals/0411-isolated-default-values.md
9907
9930
[SE- 0413 ]: https: // github.com/apple/swift-evolution/blob/main/proposals/0413-typed-throws.md
9908
9931
[#64927 ]: < https: // github.com/apple/swift/issues/64927>
9909
9932
[#42697 ]: < https: // github.com/apple/swift/issues/42697>
You can’t perform that action at this time.
0 commit comments