In the following example, the writeback via the property `b` should be
diagnosed since `b`'s setter is unavailable:
```
struct A {
struct B {
var x: Int = 0
}
private var _b: B = B()
var b: B {
get { _b }
@available(*, unavailable) set {
_b = newValue
}
}
}
var a = A()
a.b.x = 1
```
Resolves rdar://125019717
Fixes the missing diagnostic about the availability of the setter of `x` in the
following example:
```
struct S {
var x: Int {
get { 0 }
@available(*, unavailable) set {}
}
}
var s = S()
s[keyPath: \.x] = 1
```
Resolves rdar://124977727
The recent deprecation of the set accessor for `CommandLine.arguments` exposed
a bug in availability checking:
```
for arg in CommandLine.arguments[1...] {
╰─ warning: setter for 'arguments' is deprecated: ...
```
The parser generates an `InOutExpr` in the AST for the subscript access in the
code above and the availabilty checker was unconditionally diagnosing set
accessors for `InOutExprs`, resulting in spurious availability warnings for
read-only accesses of properties. The fix is to check whether there is an
enclosing `LoadExpr` in the AST and only diagnose the getter accessor in that
case.
Resolves rdar://124566405
This test documents the current behavior of availability diagnostics for
generalized accessors, including some bugs which have been called out as
FIXMEs.