This simplifies the code to emit availabilty diagnostics and ensures that they
display domain names consistently. While updating existing diagnostics, improve
consistency along other dimensions as well.
Delay resolution of availability domain identifiers parsed in availability
specifications until type-checking. This allows custom domain specifications to
be written in `if #available` queries.
Since resolving the domain of an `@available` attribute is done during type
checking now, diagnostics about unexpected versions for a domain need to be
emitted at that point instead of during parsing. It doesn't make sense to
maintain the special version of this diagnostic that is emitted during parsing
for the universal availability domain only.
Multiline string literal at attribute message position was disallowed in
59778f8ecb.
Reworked to try to at least get multiline strings working which might be
useful as messages for attributes (for example a detailed “unavailable”
annotation) minus the code which read off the start of the StringRef buffer.
in attribute message
Strings of diagnostics message processed in EncodedDiagnosticMessage
aren't necessarily from parsed Swift source code. That means, they might
not have quotes around it. Furthermore, memory around them might not be
managed. The logic in 'Lexer::getEncodedStringSegment()' used to cause
access violation.
For now, disable multiline string literal and extended escaping in string
literal for attribute message position. Considering the message might be
from Clang, we cannot simply enable this.
rdar://problem/44228891
This patch adds warnings when a version number is used
on the non-specific '*' platform. In addition, it fixes
some misleading warning messages on 'swift' platform.
Resolves: SR-8598.
* [Parse] Add diagnostic for mixed syntax availability attribute
When parsing a list of availablity specifications in the shorthand syntax, check to see that the next specification is also in shorthand syntax. If the next specification looks like an explicit “deprecated” (or similad) attribute, then emit a specific diagnostic about it to help the developer understand the problem.
https://bugs.swift.org/browse/SR-4231
* [Parse] Add fix-it for single mixed availability syntax
For the scenario that’s described in SR-4231, when there is one shorthard syntax followed by ‘deprecated’ (or similar), then we can guess that the intention was to treat the shorthand as ‘introduced’ so that the two of them work together.
This guess is only made if there is one platform version constrain, that is followed by ‘deprecated’, ‘renamed’, etc. but not ‘introduced’.
https://bugs.swift.org/browse/SR-4231
* Automatic formatting using git-clang-format
* Fix typos in test code and language in comment
Also, consistently names test functions as “deprecated” and "introduced"
* [Parse] Add note to explain the mixed availability syntax fix-it insertion
This change also moves the fix-it from the error to the note.