510.0.2
Compared to 510.0.1 this release fixes compilation warnings about retroactive conformances when building swift-syntax with a Swift 6 compiler.
It also contains the following changes from 510.0.0.
New APIs
-
SyntaxStringInterpolation.appendInterpolation(_: (some SyntaxProtocol)?)
- Description: Allows optional syntax nodes to be used inside string interpolation of syntax nodes. If the node is
nil
, nothing will get added to the string interpolation. - Pull Request: #2085
- Description: Allows optional syntax nodes to be used inside string interpolation of syntax nodes. If the node is
-
SyntaxCollection.index(at:)
- Description: Returns the index of the n-th element in a
SyntaxCollection
. This computation is in O(n) andSyntaxCollection
is not subscriptable by an integer. - Pull Request: #2014
- Description: Returns the index of the n-th element in a
-
Convenience initializer
ClosureCaptureSyntax.init()
-
Convenience initializer
EnumCaseParameterSyntax.init()
-
DiagnosticSeverity
andPluginMessage.Diagnostic.Severity
now have new case namedremark
- Description: Remarks are used by the Swift compiler and other tools to describe some aspect of translation that doesn't reflect correctness, but may be useful for the user. Remarks have been added to the diagnostic severity enums to align with the Swift compiler.
- Pull Request: #2143
Deprecations
-
Leaf Node Casts
-
Same-Type Casts
-
Base Node Casts
-
WildcardPatternSyntax.typeAnnotation
- Description:
typeAnnotation
onWildcardPatternSyntax
was a mistake. UsetypeAnnotation
properties on the outer constructs instead. E.g.PatternBindingListSyntax.typeAnnotation
- Pull Request: #2393
- Description:
API-Incompatible Changes
-
NoteMessage.fixItID
renamed tonoteID
-
DiagnosticSpec.highlight
replaced byhighlights
- Description: The use of a single string
highlight
prevented users from asserting that a macro highlighted exactly the expected set of syntax nodes. Use ofDiagnosticSpec.init(...highlight:...)
is deprecated and forwards toDiagnosticSpec.init(...highlights:...)
. Migrating fromhighlight
tohighlights
is straightforward; any uses ofDiagnosticSpec.init
which do not specify ahighlight
do not need to change, otherwise:- If the diagnostic highlights a single node, the
highlight
string should be replaced with a single element array containing the same string without any trailing trivia, e.g.,highlight: "let "
->highlights: ["let"]
. - If the diagnostic highlights multiple nodes, the
highlight
string should be replaced with an array containing an element for each highlighted node, e.g.,highlight: "struct {}"
->highlights: ["struct", "{}"]
.
- If the diagnostic highlights a single node, the
- Pull Request: #2213
- Description: The use of a single string