Skip to content
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

Sema: Suppress set accessor availability diagnostics in LoadExprs #74690

Merged

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Jun 25, 2024

This fixes a regression from #72369. The compiler now incorrectly diagnoses use of an unavailable setter in this example:

func increaseBrightness(in window: UIWindow) {
  // warning: setter for 'screen' was deprecated in iOS 13.0
  window.screen.brightness = 1.0
}

While the setter is deprecated, it would not be called in the generated code since screen is a reference type and there is no writeback through the setter for screen after setting brightness.

Resolves rdar:https://129679658

Many of the new FIXMEs demonstrate the regression reported in rdar:https://129679658.
This fixes a regression from swiftlang#72369.
The compiler now incorrectly diagnoses use of an unavailable setter in this
example:

```
func increaseBrightness(in window: UIWindow) {
  // warning: setter for 'screen' was deprecated in iOS 13.0
  window.screen.brightness = 1.0
}
```

While the setter is deprecated, it would not be called in the generated code
since `screen` is a reference type and there is no writeback through the setter
for `screen` after setting `brightness`.

Resolves rdar:https://129679658
@tshortli tshortli force-pushed the accessor-availability-reference-types branch from 93ec588 to 95cf7cf Compare June 25, 2024 16:21
@tshortli tshortli force-pushed the accessor-availability-reference-types branch from 95cf7cf to 31df22f Compare June 25, 2024 18:10
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@beccadax beccadax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on this part of Sema, but the implementation seems plausible and the tests look good.

@tshortli
Copy link
Contributor Author

I have some new reports with additional test cases that aren't fixed by this but I'm going to build on top of it with another PR to fix those.

@tshortli tshortli merged commit 8dbcd11 into swiftlang:main Jun 26, 2024
3 checks passed
@tshortli tshortli deleted the accessor-availability-reference-types branch June 26, 2024 14:53
@xedin
Copy link
Contributor

xedin commented Jun 26, 2024

@tshortli Sounds good!

@tshortli
Copy link
Contributor Author

Further iteration here: #74793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants