Skip to content

Releases: apple/swift-syntax

510.0.2

07 May 16:24
303e5c5
Compare
Choose a tag to compare

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
  • SyntaxCollection.index(at:)

    • Description: Returns the index of the n-th element in a SyntaxCollection. This computation is in O(n) and SyntaxCollection is not subscriptable by an integer.
    • Pull Request: #2014
  • Convenience initializer ClosureCaptureSyntax.init()

    • Description: Provides a convenience initializer for ClosureCaptureSyntax that takes a concrete name argument and automatically adds equal = TokenSyntax.equalToken() to it.
    • Issue: #1984
    • Pull Request: #2127
  • Convenience initializer EnumCaseParameterSyntax.init()

    • Description: Provides a convenience initializer for EnumCaseParameterSyntax that takes a concrete firstName value and adds colon = TokenSyntax.colonToken() automatically to it.
    • Issue: #1984
    • Pull Request: #2112
  • DiagnosticSeverity and PluginMessage.Diagnostic.Severity now have new case named remark

    • 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

    • Description: Syntax nodes that do not act as base nodes for other syntax types have the casting methods marked as deprecated. This prevents unsafe type-casting by issuing deprecation warnings for methods that will always result in failed casts.
    • Issue: #2092
    • Pull Request: #2108
  • Same-Type Casts

    • Description: is, as, and cast overloads on SyntaxProtocol with same-type conversions are marked as deprecated. The deprecated methods emit a warning indicating the cast will always succeed.
    • Issue: #2092
    • Pull Request: #2108
  • Base Node Casts

    • Description: is, as, and cast methods on base node protocols with base-type conversions are marked as deprecated. The deprecated methods emit a warning that informs the developer that the cast will always succeed and should be done using the base node's initializer.
    • Issue: #2092
    • Pull Request: #2108
  • WildcardPatternSyntax.typeAnnotation

    • Description: typeAnnotation on WildcardPatternSyntax was a mistake. Use typeAnnotation properties on the outer constructs instead. E.g. PatternBindingListSyntax.typeAnnotation
    • Pull Request: #2393

API-Incompatible Changes

  • NoteMessage.fixItID renamed to noteID

    • Description: This was an error that it was named fixItID and should have been named noteID instead. Accesses to fixItID are deprecated and forward to noteID. Any types that conform NoteMessage it will need to be updated to provide a noteID instead of a fixItID.
    • Issue: #2261
    • Pull Request: #2264
  • DiagnosticSpec.highlight replaced by highlights

    • Description: The use of a single string highlight prevented users from asserting that a macro highlighted exactly the expected set of syntax nodes. Use of DiagnosticSpec.init(...highlight:...) is deprecated and forwards to DiagnosticSpec.init(...highlights:...). Migrating from highlight to highlights is straightforward; any uses of DiagnosticSpec.init which do not specify a highlight 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", "{}"].
    • Pull Request: #2213

510.0.1

09 Mar 00:15
fa8f95c
Compare
Choose a tag to compare

Compared to 510.0.0 this fixes a possible misaligned memory access.

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
  • SyntaxCollection.index(at:)

    • Description: Returns the index of the n-th element in a SyntaxCollection. This computation is in O(n) and SyntaxCollection is not subscriptable by an integer.
    • Pull Request: #2014
  • Convenience initializer ClosureCaptureSyntax.init()

    • Description: Provides a convenience initializer for ClosureCaptureSyntax that takes a concrete name argument and automatically adds equal = TokenSyntax.equalToken() to it.
    • Issue: #1984
    • Pull Request: #2127
  • Convenience initializer EnumCaseParameterSyntax.init()

    • Description: Provides a convenience initializer for EnumCaseParameterSyntax that takes a concrete firstName value and adds colon = TokenSyntax.colonToken() automatically to it.
    • Issue: #1984
    • Pull Request: #2112
  • DiagnosticSeverity and PluginMessage.Diagnostic.Severity now have new case named remark

    • 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

    • Description: Syntax nodes that do not act as base nodes for other syntax types have the casting methods marked as deprecated. This prevents unsafe type-casting by issuing deprecation warnings for methods that will always result in failed casts.
    • Issue: #2092
    • Pull Request: #2108
  • Same-Type Casts

    • Description: is, as, and cast overloads on SyntaxProtocol with same-type conversions are marked as deprecated. The deprecated methods emit a warning indicating the cast will always succeed.
    • Issue: #2092
    • Pull Request: #2108
  • Base Node Casts

    • Description: is, as, and cast methods on base node protocols with base-type conversions are marked as deprecated. The deprecated methods emit a warning that informs the developer that the cast will always succeed and should be done using the base node's initializer.
    • Issue: #2092
    • Pull Request: #2108
  • WildcardPatternSyntax.typeAnnotation

    • Description: typeAnnotation on WildcardPatternSyntax was a mistake. Use typeAnnotation properties on the outer constructs instead. E.g. PatternBindingListSyntax.typeAnnotation
    • Pull Request: #2393

API-Incompatible Changes

  • NoteMessage.fixItID renamed to noteID

    • Description: This was an error that it was named fixItID and should have been named noteID instead. Accesses to fixItID are deprecated and forward to noteID. Any types that conform NoteMessage it will need to be updated to provide a noteID instead of a fixItID.
    • Issue: #2261
    • Pull Request: #2264
  • DiagnosticSpec.highlight replaced by highlights

    • Description: The use of a single string highlight prevented users from asserting that a macro highlighted exactly the expected set of syntax nodes. Use of DiagnosticSpec.init(...highlight:...) is deprecated and forwards to DiagnosticSpec.init(...highlights:...). Migrating from highlight to highlights is straightforward; any uses of DiagnosticSpec.init which do not specify a highlight 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", "{}"].
    • Pull Request: #2213

swift-5.10-RELEASE

06 Mar 16:15
666f336
Compare
Choose a tag to compare
[5.10][bazel] Update bazel version and BUILD for new modules (#2521)

510.0.0

01 Mar 20:21
08a2f0a
Compare
Choose a tag to compare

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
  • SyntaxCollection.index(at:)

    • Description: Returns the index of the n-th element in a SyntaxCollection. This computation is in O(n) and SyntaxCollection is not subscriptable by an integer.
    • Pull Request: #2014
  • Convenience initializer ClosureCaptureSyntax.init()

    • Description: Provides a convenience initializer for ClosureCaptureSyntax that takes a concrete name argument and automatically adds equal = TokenSyntax.equalToken() to it.
    • Issue: #1984
    • Pull Request: #2127
  • Convenience initializer EnumCaseParameterSyntax.init()

    • Description: Provides a convenience initializer for EnumCaseParameterSyntax that takes a concrete firstName value and adds colon = TokenSyntax.colonToken() automatically to it.
    • Issue: #1984
    • Pull Request: #2112
  • DiagnosticSeverity and PluginMessage.Diagnostic.Severity now have new case named remark

    • 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

    • Description: Syntax nodes that do not act as base nodes for other syntax types have the casting methods marked as deprecated. This prevents unsafe type-casting by issuing deprecation warnings for methods that will always result in failed casts.
    • Issue: #2092
    • Pull Request: #2108
  • Same-Type Casts

    • Description: is, as, and cast overloads on SyntaxProtocol with same-type conversions are marked as deprecated. The deprecated methods emit a warning indicating the cast will always succeed.
    • Issue: #2092
    • Pull Request: #2108
  • Base Node Casts

    • Description: is, as, and cast methods on base node protocols with base-type conversions are marked as deprecated. The deprecated methods emit a warning that informs the developer that the cast will always succeed and should be done using the base node's initializer.
    • Issue: #2092
    • Pull Request: #2108
  • WildcardPatternSyntax.typeAnnotation

    • Description: typeAnnotation on WildcardPatternSyntax was a mistake. Use typeAnnotation properties on the outer constructs instead. E.g. PatternBindingListSyntax.typeAnnotation
    • Pull Request: #2393

API-Incompatible Changes

  • NoteMessage.fixItID renamed to noteID

    • Description: This was an error that it was named fixItID and should have been named noteID instead. Accesses to fixItID are deprecated and forward to noteID. Any types that conform NoteMessage it will need to be updated to provide a noteID instead of a fixItID.
    • Issue: #2261
    • Pull Request: #2264
  • DiagnosticSpec.highlight replaced by highlights

    • Description: The use of a single string highlight prevented users from asserting that a macro highlighted exactly the expected set of syntax nodes. Use of DiagnosticSpec.init(...highlight:...) is deprecated and forwards to DiagnosticSpec.init(...highlights:...). Migrating from highlight to highlights is straightforward; any uses of DiagnosticSpec.init which do not specify a highlight 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", "{}"].
    • Pull Request: #2213

509.1.1

23 Jan 01:41
64889f0
Compare
Choose a tag to compare

Fixes an issue that caused the swift-parser-cli target to not build on visionOS.

509.1.0

09 Jan 01:55
43c802f
Compare
Choose a tag to compare
  • Supports SE-0407 Member Macro Conformances by adding a new defaulted version of the expansion function in MemberMacro that receives the conformingTo parameter
  • Fixes a formatting bug not adding a space between a string/regex literal and a period (#2344)

509.0.2

01 Nov 00:05
6ad4ea2
Compare
Choose a tag to compare

Fixes a possible misaligned memory access

509.0.1

20 Oct 22:05
ffa3cd6
Compare
Choose a tag to compare

Fixes the following issues:

  • Foo<T>.bar should not have whitespace added between > and . (#2224)
  • Missing dependency declaration between SwiftSyntaxMacroExpansion and SwiftOperators (#2224)

509.0.0

14 Sep 00:02
7420304
Compare
Choose a tag to compare

This is the 509.0.0 release of SwiftSyntax, aligned with Swift 5.9.

To use this snapshot add the following dependency to your Package.swift:

.package(url: "https://github.com/apple/swift-syntax", from: "509.0.0")

508.0.1

15 May 19:13
2c49d66
Compare
Choose a tag to compare

This release of SwiftSyntax is aligned with the release of Swift 5.8.

Compared to 508.0.0, this release relaxes the version requirement for swift-argument-parser, resulting in fewer version conflicts for users of SwiftSyntax.