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: Signatures of decls in local contexts always inherit availability.
Declarations nested in inlinable function bodies, such as `var` declarations,
should not introduce new `TypeRefinementContext` nodes that are restricted to
the deployment target. This bug was preventing availability checking from
noticing availability errors when the occurred in a `var` declaration inside of
a fragile function body:
```
@available(macOS 12.0, *)
public struct X {
public init() {}
}
@_alwaysEmitIntoClient
public func x() {
// This should be diagnosed, X is not always available
let _ = X()
}
```
Resolves rdar://125564069
// Repeat everything with pattern binding decls instead of discard expressions.
401
+
defer{
402
+
let _ =AtDeploymentTarget() // expected-error {{'AtDeploymentTarget' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}} expected-note {{add 'if #available'}}
403
+
let _ =AfterDeploymentTarget() // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}} expected-note {{add 'if #available'}}
404
+
}
405
+
let _ =NoAvailable()
406
+
let _ =BeforeInliningTarget()
407
+
let _ =AtInliningTarget()
408
+
let _ =BetweenTargets() // expected-error {{'BetweenTargets' is only available in macOS 10.14.5 or newer; clients of 'Test' may have a lower deployment target}} expected-note {{add 'if #available'}}
409
+
let _ =AtDeploymentTarget() // expected-error {{'AtDeploymentTarget' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}} expected-note {{add 'if #available'}}
410
+
let _ =AfterDeploymentTarget() // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}} expected-note {{add 'if #available'}}
0 commit comments