Commit Graph

6 Commits

Author SHA1 Message Date
John Holdsworth
e55d4254d2 [Parse] Allow multiline attribute messages (SE-200) (#19219)
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.
2018-09-14 10:33:32 +09:00
Rintaro Ishizaki
59778f8ecb [Parse] Disable support for multiline/extended escaping string literal
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
2018-09-08 17:32:36 +09:00
Ding Ye
3dca923371 Add a fix-it and rephrase some warning messages. 2018-08-31 08:40:19 +10:00
Ding Ye
b790eb5dcf [Parser] Improve diagnostics for special platforms in available attribute.
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.
2018-08-31 08:40:19 +10:00
Robert Widmann
370b08a927 Revise diagnostic message for availability fixit 2017-04-30 21:48:06 -04:00
David Rönnqvist
f45196d022 [SR-4231] Add diagnostic (& fix-it) for mixed syntax availability attribute (#9122)
* [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.
2017-04-30 19:39:38 -04:00