Get rid of the boolean arguments for unavailability in AvailabilityQuery's
constructors and introduce a `asUnavailable()` modifier that can be used
instead in the contexts where unavailability is relevant.
Empty version numbers if availability specs are accepted by Sema prior to Swift
6, and when they occur in `if #available` queries they can make the query AST
node invalid without aborting compilation. Adjust an assertion in SILGen to
compensate.
Generalize SILGen for `if #available` checks by delegating the determination of
the query function and its arguments to `AvailabilityQuery`. Update SILGen for
`@backDeployed` thunks to use the same infrastructure.
NFC.
Also, I discovered that we don't apply nonisolated(nonsending) to
function types in the new mode. That's one for a different patch.
Fixes rdar://154401813 and rdar://154137740
Inverted availability queries were mis-compiled for zippered libraries because
the code that emits calls to `isOSVersionAtLeastOrVariantVersionAtLeast()` was
not updated when the `if #unavailable` syntax was introduced (at that time
support for zippered libraries had not yet been upstreamed). The result of
these calls is now inverted when appropriate.
To make it easier to manage the growing complexity of supporting availability
queries, Sema now models the relevant information about an availability query
with the new `AvailabilityQuery` type. It encapsulates the domain for the
query, the result if it is known at compile time, and the version tuple
arguments to pass to a runtime invocation if applicable.
Resolves rdar://147929876.