Skip to content

Sema: Relax availability checking in universally unavailable contexts #78077

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

Conversation

tshortli
Copy link
Contributor

Recent refactoring fixed a bug that previously caused f() to be checked as if it were unavailable only on macOS in the following example:

@available(macOS, unavailable)
struct Outer {
  @available(*, unavailable)
  func f() {
    someFunctionUnavailableOnMacOS()
  }
}

Unfortunately, fixing that bug made a different existing availability checking rule more problematic. References to declarations that are unavailable on the current platform have been diagnosed as unavailable even in contexts that are universally unavailable. This long standing behavior is overly strict but it rarely had consequences. However, now that the example above is modeled correctly, this overly strict behavior is causing some source compatibility issues. The easiest solution is to relax the overly strict checking.

Resolves rdar://141124478.

Recent refactoring fixed a bug that previously caused `f()` to be checked as if
it were unavailable only on macOS in the following example:

```
@available(macOS, unavailable)
struct Outer {
  @available(*, unavailable)
  func f() {
    someFunctionUnavailableOnMacOS()
  }
}
```

Unfortunately, fixing that bug made a different existing availability checking
rule more problematic. References to declarations that are unavailable on the
current platform have been diagnosed as unavailable even in contexts that are
universally unavailable. This long standing behavior is overly strict but it
rarely had consequences. However, now that the example above is modeled
correctly, this overly strict behavior is causing some source compatibility
issues. The easiest solution is to relax the overly strict checking.

Resolves rdar://141124478.
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli merged commit 0dfca46 into swiftlang:main Dec 10, 2024
5 checks passed
@tshortli tshortli deleted the allow-unavailable-on-platform-in-universally-unavailable-contexts branch December 10, 2024 18:02
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.

2 participants