Skip to content

Commit 64362ef

Browse files
committed
[NFC] Add a release note for SE-0411.
(cherry picked from commit 97ee101)
1 parent 41d9f0c commit 64362ef

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
> **Note**\
44
> This is in reverse chronological order, so newer entries are added to the top.
55
6+
## Swift 5.10
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+
630
## Swift 5.9.2
731

832
* [SE-0407][]:
@@ -9846,6 +9870,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
98469870
[SE-0394]: https://github.com/apple/swift-evolution/blob/main/proposals/0394-swiftpm-expression-macros.md
98479871
[SE-0397]: https://github.com/apple/swift-evolution/blob/main/proposals/0397-freestanding-declaration-macros.md
98489872
[SE-0407]: https://github.com/apple/swift-evolution/blob/main/proposals/0407-member-macro-conformances.md
9873+
[SE-0411]: https://github.com/apple/swift-evolution/blob/main/proposals/0411-isolated-default-values.md
98499874
[#64927]: <https://github.com/apple/swift/issues/64927>
98509875
[#42697]: <https://github.com/apple/swift/issues/42697>
98519876
[#42728]: <https://github.com/apple/swift/issues/42728>

0 commit comments

Comments
 (0)