Skip to content

Commit 97ee101

Browse files
committed
[NFC] Add a release note for SE-0411.
1 parent e47a66c commit 97ee101

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@
55
66
## Swift 5.11
77

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+
830
* [SE-0413][]:
931

1032
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
99049926
[SE-0394]: https://github.com/apple/swift-evolution/blob/main/proposals/0394-swiftpm-expression-macros.md
99059927
[SE-0397]: https://github.com/apple/swift-evolution/blob/main/proposals/0397-freestanding-declaration-macros.md
99069928
[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
99079930
[SE-0413]: https://github.com/apple/swift-evolution/blob/main/proposals/0413-typed-throws.md
99089931
[#64927]: <https://github.com/apple/swift/issues/64927>
99099932
[#42697]: <https://github.com/apple/swift/issues/42697>

0 commit comments

Comments
 (0)