You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
structNeverAvailableContainer{ // expected-note {{'NeverAvailableContainer' has been explicitly marked unavailable here}}
136
136
letnever_var:NeverAvailable=never() // expected-error {{'never()' is unavailable}}
137
-
letosx_var:OSXUnavailable=osx() // expected-error {{'osx()' is unavailable}}
138
-
letosx_extension_var:OSXAppExtensionsUnavailable=osx_extension() // expected-error {{'osx_extension()' is unavailable in application extensions for macOS}}
extensionConformsToPExeceptOnMacOS:P{} // expected-note {{conformance of 'ConformsToPExeceptOnMacOS' to 'P' has been explicitly marked unavailable here}}
39
+
40
+
@available(SwiftStdlib 5.1,*)
41
+
extensionOuter{
42
+
func returnsConformsToPExeceptOnMacOS()->someP{
43
+
ConformsToPExeceptOnMacOS() // expected-error {{conformance of 'ConformsToPExeceptOnMacOS' to 'P' is unavailable in macOS}}
0 commit comments