Commit Graph

6 Commits

Author SHA1 Message Date
Allan Shortlidge
eafea5b21e Sema: Relax availability checking in universally unavailable contexts.
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.
2024-12-09 17:15:15 -08:00
Allan Shortlidge
c3e189e4d4 Tests: Add tests for deprecated property wrapper diagnostics.
Also, test property wrapper availability diagnostics on wrapped local vars.

Inspired by https://github.com/swiftlang/swift/issues/63139, though it doesn't
seem to reproduce.
2024-11-12 16:54:11 -08:00
Allan Shortlidge
7c75b26f1b Sema: Make suppression of availability checking for types more consistent.
Availability checking for types was only suppressed when the immediate context
for the use of the type was explicitly marked unavailable. Availability is
lexical so the checking should be suppressed in the entire scope instead.
2024-11-01 08:18:13 -07:00
Allan Shortlidge
7e6e8ed7b5 Sema: Fully check the availability of wrappedValue.
Call `checkDeclarationAvailability()`, instead of just diagnosing
unavailability.
2024-10-25 16:50:20 -07:00
Ben Langmuir
fd1875dcfb [test] Move availability tests to later fake OS versions
10.50 was once greater than any real macOS version, but now it compares
less than real released versions, which makes these tests depend on the
deployment target unnecessarily. Update these tests to use even larger
numbers to hopefully keep them independent a little longer.
2024-08-21 11:38:54 -07:00
Allan Shortlidge
b5066bbcaf Sema: Check the availability of property wrappers attached to VarDecls in named patterns.
The availability of property wrappers was previously checked for typed patterns but not named patterns.

Resolves rdar://86698223.
2022-08-22 16:51:27 -07:00