Skip to content

NFC: Add a CHANGELOG entry about banning @available on lazy and wrapped properties #59626

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
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,18 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
the result type provides a generalization where the callee chooses the
resulting type and value.

* The compiler now correctly emits errors for `@available` attributes on stored properties with the `lazy` modifier or with attached property wrappers. Previously, the attribute was accepted on this subset of stored properties but the resulting binary would crash at runtime when type metadata was unavailable.

```swift
struct S {
@available(macOS 99, *) // error: stored properties cannot be marked potentially unavailable with '@available'
lazy var a: Int = 42

@available(macOS 99, *) // error: stored properties cannot be marked potentially unavailable with '@available'
@Wrapper var b: Int
}
```

* The compiler now correctly emits warnings for more kinds of expressions where a protocol conformance is used and may be unavailable at runtime. Previously, member reference expressions and type erasing expressions that used potentially unavailable conformances were not diagnosed, leading to potential crashes at runtime.

```swift
Expand Down