Skip to content

[Changelog] Add SR-7083 to the changelog #31413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,34 @@ CHANGELOG
Swift 5.3
----------

* [SR-7083][]:

Property observers such as `willSet` and `didSet` are now supported on `lazy` properties:

```swift
class C {
lazy var property: Int = 0 {
willSet { print("willSet called!") } // Okay
didSet { print("didSet called!") } // Okay
}
}
```

Note that the initial value of the property will be forced and made available as the `oldValue` for the `didSet` observer, if the property hasn't been accessed yet.

```swift
class C {
lazy var property: Int = 0 {
didSet { print("Old value: ", oldValue) }
}
}

let c = C()
c.property = 1 // Prints 'Old value: 0'
```

This could have side-effects, for example if the lazy property's initializer is doing other work.

* [SR-11700][]:

Exclusivity violations within code that computes the `default`
Expand Down Expand Up @@ -8068,6 +8096,7 @@ Swift 1.0
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>
[SR-6118]: <https://bugs.swift.org/browse/SR-6118>
[SR-7083]: <https://bugs.swift.org/browse/SR-7083>
[SR-7139]: <https://bugs.swift.org/browse/SR-7139>
[SR-7251]: <https://bugs.swift.org/browse/SR-7251>
[SR-7601]: <https://bugs.swift.org/browse/SR-7601>
Expand Down