kishikawakatsumi / swift-power-assert

Power Assert in Swift.
https://power-assert.swiftfiddle.com/
MIT License
485 stars 11 forks source link

Update dependency apple/swift-syntax to v600 #555

Open renovate[bot] opened 2 months ago

renovate[bot] commented 2 months ago

This PR contains the following updates:

Package Update Change
apple/swift-syntax major from: "509.1.1" -> from: "600.0.1"

[!WARNING] Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

apple/swift-syntax (apple/swift-syntax) ### [`v600.0.1`](https://redirect.github.com/swiftlang/swift-syntax/releases/tag/600.0.1) [Compare Source](https://redirect.github.com/apple/swift-syntax/compare/600.0.0...600.0.1) Compared to 600.0.0 this release fixes a compilation issue when building swift-syntax in C++ interop mode ([https://github.com/swiftlang/swift-syntax/pull/2861](https://redirect.github.com/swiftlang/swift-syntax/pull/2861)). It also contains the following changes from [600.0.0](https://redirect.github.com/apple/swift-syntax/releases/tag/600.0.0). ##### New APIs - FixIt now has a new computed property named `edits` - Description: the `edits` represent the non-overlapping textual `edits` that need to be performed when the Fix-It is applied. - Issue: [https://github.com/swiftlang/sourcekit-lsp/issues/909](https://redirect.github.com/swiftlang/sourcekit-lsp/issues/909) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2314](https://redirect.github.com/swiftlang/swift-syntax/pull/2314) - `SourceEdit` - Description: `SourceEdit` has been moved from SwiftRefactor to SwiftSyntax - Issue: [https://github.com/swiftlang/sourcekit-lsp/issues/909](https://redirect.github.com/swiftlang/sourcekit-lsp/issues/909) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2314](https://redirect.github.com/swiftlang/swift-syntax/pull/2314) - `assertMacroExpansion` now have new parameters named `applyFixIts` and `fixedSource` - Description: `applyFixIts` and `fixedSource` are used to assert so ensure that the source code after applying Fix-Its matches this string. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2015](https://redirect.github.com/swiftlang/swift-syntax/issues/2015) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2021](https://redirect.github.com/swiftlang/swift-syntax/pull/2021) - `DeclSyntaxEnum`, `StmtSyntaxEnum`, `ExprSyntaxEnum`, `TypeSyntaxEnum`, and `PatternSyntaxEnum` - Description: Enum to exhaustively switch over all different syntax nodes of each base type. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2351](https://redirect.github.com/swiftlang/swift-syntax/pull/2351) - `WithOptionalCodeBlock` - Description: A trait for syntax nodes that have an optional code block, such as `FunctionDeclSyntax` and `InitializerDeclSyntax`. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2359](https://redirect.github.com/swiftlang/swift-syntax/pull/2359) - `CodeBlockSyntax` - Description: `CodeBlockSyntax` is now `SyntaxParseable`, so it can be used with string interpolations. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2361](https://redirect.github.com/swiftlang/swift-syntax/pull/2361) - `ThrowsClause` - Description: The `throwsSpecifier` for the effects nodes (`AccessorEffectSpecifiers`, `FunctionEffectSpecifiers`, `TypeEffectSpecifiers`, `EffectSpecifiers`) has been replaced with `throwsClause`, which captures both the throws specifier and the (optional) thrown error type, as introduced by SE-0413. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2379](https://redirect.github.com/swiftlang/swift-syntax/pull/2379) - `String.isValidSwiftIdentifier(for:)` - Description: `SwiftParser` adds an extension on `String` to check if it can be used as an identifier in a given context. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2434](https://redirect.github.com/swiftlang/swift-syntax/pull/2434) - `MacroDeclSyntax.expand` - the `expand(argumentList:definition:replacements:)` method gains a new parameter 'genericReplacements:' that is defaulted to an empty array. - The method's signature is now `expand(argumentList:definition:replacements:genericReplacements:)` - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2450](https://redirect.github.com/swiftlang/swift-syntax/pull/2450) - `SyntaxProtocol.asMacroLexicalContext()` and `allMacroLexicalContexts(enclosingSyntax:)` - Description: Produce the lexical context for a given syntax node (if it has one), or the entire stack of lexical contexts enclosing a syntax node, for use in macro expansion. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/1554](https://redirect.github.com/swiftlang/swift-syntax/pull/1554) - `TriviaPiece.isComment` - Description: `TriviaPiece` now has a computed property `isComment` that returns `true` if the trivia piece is a comment. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2469](https://redirect.github.com/swiftlang/swift-syntax/pull/2469) - New `assertMacroExpansion` API with option to specify macro specifications with `macroSpecs` argument - Description: `macroSpecs` can have additional specifications like conformances provided by member or extension macro that can be used for macro expansion. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2031](https://redirect.github.com/swiftlang/swift-syntax/issues/2031) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2327](https://redirect.github.com/swiftlang/swift-syntax/pull/2327) - `BasicFormat.inferIndentation(of:)` - Description: Uses heuristics to infer the indentation width used in a syntax tree. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2514](https://redirect.github.com/swiftlang/swift-syntax/pull/2514) - `IncrementalEdit` stores replacement text - Description: `IncrementalEdit` used to store the range that was replaced and the length of the replacement but not the replacement bytes by itself. `IncrementalEdit` now has a `replacement` property that contains the replacement bytes. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2527](https://redirect.github.com/swiftlang/swift-syntax/pull/2527) - Type specifiers - Description: `AttributedTypeSyntax` can now contain multiple specifiers and these types are used to model the list of specifiers. Additionally, type specifiers can now contain arguments, like `borrow(data)`. To facilitate this, the following new types were introduces: `LifetimeSpecifierArgumentListSyntax`, `LifetimeSpecifierArgumentSyntax`, `LifetimeSpecifierArgumentsSyntax`, `LifetimeTypeSpecifierSyntax`, `SimpleTypeSpecifierSyntax`, `TypeSpecifierListSyntax` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2433](https://redirect.github.com/swiftlang/swift-syntax/pull/2433) - `DeclGroupSyntax.introducer` - Description: The `DeclGroupSyntax` trait has an extra `introducer` property, ie. the keyword that introduces the declaration. - Issue: [https://github.com/swiftlang/sourcekit-lsp/issues/2535](https://redirect.github.com/swiftlang/sourcekit-lsp/issues/2535) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2539](https://redirect.github.com/swiftlang/swift-syntax/pull/2539) - `ExprSyntax.interpretedAsVersionTuple` - Description: With the change to parse `#if canImport(MyModule, _version: 1.2.3)` as a function call instead of a dedicated syntax node, `1.2.3` natively gets parsed as a member access `3` to the `1.2` float literal. This property allows the reinterpretation of such an expression as a version tuple. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2025](https://redirect.github.com/swiftlang/swift-syntax/pull/2025) - `SyntaxProtocol.node(at:)` - Description: Given a `SyntaxIdentifier`, returns the `Syntax` node with that identifier - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SyntaxIdentifier.IndexInTree` - Description: Uniquely identifies a syntax node within a tree. This is similar to `SyntaxIdentifier` but does not store the root ID of the tree. It can thus be transferred across trees that are structurally equivalent, for example two copies of the same tree that live in different processes. The only public functions on this type are `toOpaque` and `init(fromOpaque:)`, which allow serialization of the `IndexInTree`. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SyntaxIdentifier` conformance to `Comparable`: - Description: A `SyntaxIdentifier` compares less than another `SyntaxIdentifier` if the node at that identifier occurs first during a depth-first traversal of the tree. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SyntaxIdentifier.indexInTree` and `SyntaxIdentifier.fromIndexInTree` - Description: `SyntaxIdentifier.indexInTree` allows the retrieval of a `SyntaxIdentifier` that identifies the syntax node independent of the syntax tree. `SyntaxIdentifier.fromIndexInTree` allows the creation for a `SyntaxIdentifier` from a tree-agnostic `SyntaxIdentifier.IndexInTree` and the tree's root node. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SwiftSyntaxMacrosGenericTestSupport` - Description: A version of the `SwiftSyntaxMacrosTestSupport` module that doesn't depend on `Foundation` or `XCTest` and can thus be used to write macro tests using `swift-testing`. Since swift-syntax can't depend on swift-testing (which would incur a circular dependency since swift-testing depends on swift-syntax), users need to manually specify a failure handler like the following, that fails the swift-testing test: `Issue.record("\($0.message)", fileID: $0.location.fileID, filePath: $0.location.filePath, line: $0.location.line, column: $0.location.column)` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2647](https://redirect.github.com/swiftlang/swift-syntax/pull/2647) - `TokenSyntax.identifier` - Description: Adds an `identifier` property to `TokenSyntax` which returns a canonicalized representation of an identifier that strips away backticks. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2576](https://redirect.github.com/swiftlang/swift-syntax/pull/2576) ##### Deprecations - Child Choice Node Casts - Description: `is`, `as`, and `cast` methods for types not contained in the choice node are marked as deprecated. The deprecated methods will emit a warning, indicating that the cast will always fail. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2092](https://redirect.github.com/swiftlang/swift-syntax/issues/2092) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2184](https://redirect.github.com/swiftlang/swift-syntax/pull/2184) - Migration steps: Remove the `is`, `as` or `cast` methods because they will always fail. - `IncrementalParseTransition`: - Description: The initializer `IncrementalParseTransition.init(previousTree:edits:lookaheadRanges:reusedNodeCallback:)` is marked as deprecated. Use `IncrementalParseTransition.init(previousIncrementalParseResult:edits:reusedNodeCallback:)` instead. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2267](https://redirect.github.com/swiftlang/swift-syntax/issues/2267) - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2272](https://redirect.github.com/swiftlang/swift-syntax/pull/2272) - Migration steps: Call `IncrementalParseTransition.init(previousIncrementalParseResult:edits:reusedNodeCallback:)` instead. - `MacroExpansion{Error|Warning|FixIt}Message` moved to the `SwiftSyntaxMacros` module - Description: Move the `MacroExpansion{Error|Warning|FixIt}Message` types from the `SwiftSyntaxMacroExpansion` module to `SwiftSyntaxMacros`. Deprecated typealiases in `SwiftSyntaxMacroExpansion` forward to `SwiftSyntaxMacros`. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2338](https://redirect.github.com/swiftlang/swift-syntax/pull/2338) - Notes: The expansion diagnostic messages were defined in `SwiftSyntaxMacroExpansion`, which is intended as an implementation detail of the plugin server and should not need to be imported by macros. - `EditorPlaceholderDeclSyntax` and `EditorPlaceholderExprSyntax`: - Description: `EditorPlaceholderDeclSyntax` and `EditorPlaceholderExprSyntax` are now deprecated and placeholders are instead parsed as identifiers within a `MissingDeclSyntax` or `DeclReferenceExprSyntax`. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2237](https://redirect.github.com/swiftlang/swift-syntax/pull/2237) - `AttributedTypeSyntax.specifier` has renamed to `specifiers` and changed to be a collection - Description: Types can have multiple specifiers now and the syntax tree has been modified to reflect that. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2433](https://redirect.github.com/swiftlang/swift-syntax/pull/2433) - ` CanImportExprSyntax ` and `CanImportVersionInfoSyntax` - Description: Instead of parsing `canImport` inside `#if` directives as a special expression node, parse it as a functionc call expression. This is in-line with how the `swift(>=6.0)` and `compiler(>=6.0)` directives are parsed. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2025](https://redirect.github.com/swiftlang/swift-syntax/pull/2025) ##### API-Incompatible Changes - `MacroDefinition` used for expanding macros: - Description: The `MacroDefinition/expansion` enum case used to have two values (`(MacroExpansionExprSyntax, replacements: [Replacement])`), has now gained another value in order to support generic argument replacements in macro expansions: `(MacroExpansionExprSyntax, replacements: [Replacement], genericReplacements: [GenericArgumentReplacement])` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2450](https://redirect.github.com/swiftlang/swift-syntax/pull/2450) - Migration steps: Code which exhaustively checked over the enum should be changed to `case .expansion(let node, let replacements, let genericReplacements):`. Creating the `.extension` gained a compatibility shim, retaining the previous syntax source compatible (`return .expansion(node, replacements: [])`). - Effect specifiers: - Description: The `unexpectedAfterThrowsSpecifier` node of the various effect specifiers has been removed. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2219](https://redirect.github.com/swiftlang/swift-syntax/pull/2219) - Migration steps: Check `unexpectedBetweenThrowsSpecifierAndThrownError` and `unexpectedAfterThrownError` instead. - `SyntaxKind` removed conformance to `CaseIterable` - Description: `SyntaxKind` no longer conforms to `CaseIterable` since there is no good use case to iterate over all syntax kinds. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2292](https://redirect.github.com/swiftlang/swift-syntax/pull/2292) - Migration steps: Exhaustively check all the syntax nodes that your program supports. There should be no use case to iterate over all cases in `SyntaxKind`. - `IntegerLiteralExprSyntax.Radix` removed conformance to `CaseIterable` - Description: `IntegerLiteralExprSyntax.Radix` no longer conforms to `CaseIterable` since there is no good use case to iterate over all radix kinds. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2292](https://redirect.github.com/swiftlang/swift-syntax/pull/2292) - Migration steps: There should be no use case to iterate over all cases in `IntegerLiteralExprSyntax.Radix`. - `Parser.parseIncrementally(source:parseTransition:)` and `Parser.parseIncrementally(source:maximumNestingLevel:parseTransition:)`: - Description: The default versions of `Parser.parseIncrementally` return a `IncrementalParseResult` instead of a tuple. Access to the struct should be compatible with the tuple in almost all cases unless the tuple is stored into a variable and then destructed or passed to a function that expects a tuple. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2267](https://redirect.github.com/swiftlang/swift-syntax/issues/2267) - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2272](https://redirect.github.com/swiftlang/swift-syntax/pull/2272) - Migration steps: If necessary, change type annotations from the tuple to the `IncrementalParseResult` type. - `SyntaxClassification` gained a new case: `argumentLabel` - The new classification case covers the first names of parameters in function-like declarations and the label of arguments in function-like calls. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2375](https://redirect.github.com/swiftlang/swift-syntax/pull/2375) - Migration steps: In exhaustive switches over `SyntaxClassification`, cover the new case. - `SyntaxEnum` and `SyntaxKind` gained new cases: `throwsClause` - The new cases cover the newly introduced `ThrowsClauseSyntax` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2379](https://redirect.github.com/swiftlang/swift-syntax/pull/2379) - Migration steps: In exhaustive switches over `SyntaxEnum` and `SyntaxKind`, cover the new case. - `MacroExpansionContext` now requires a property `lexicalContext`: - Description: The new property provides the lexical context in which the macro is expanded, and has several paired API changes. Types that conform to `MacroExpansionContext` will need to implement this property. Additionally, the `HostToPluginMessage` cases `expandFreestandingMacro` and `expandAttachedMacro` now include an optional `lexicalContext`. Finally, the `SyntaxProtocol.expand(macros:in:indentationWidth:)` syntactic expansion operation has been deprecated in favor of a new version `expand(macros:contextGenerator:indentationWidth:)` that takes a function produces a new macro expansion context for each expansion. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/1554](https://redirect.github.com/swiftlang/swift-syntax/pull/1554) - Migration steps: Add the new property `lexicalContext` to any `MacroExpansionContext`-conforming types. If implementing the host-to-plugin message protocol, add support for `lexicalContext`. For macro expansion operations going through `SyntaxProtocol.expand`, provide a context generator that creates a fresh context including the lexical context. - `TriviaPiece.isBackslash` in `SwiftParserDiagnostics` removed - Description: `TriviaPiece.isBackslash` was not intended to be public API. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2531](https://redirect.github.com/swiftlang/swift-syntax/pull/2531) - Migration steps: Use `if case .backslash = triviaPiece` instead - All symbols in `SwiftCompilerPluginMessageHandling` are now SPI - Description: This module is only intended to be used from some internal components. Any other modules should not use them directly. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2489](https://redirect.github.com/swiftlang/swift-syntax/pull/2489) - Migration steps: Stop using this module. ### [`v600.0.0`](https://redirect.github.com/swiftlang/swift-syntax/releases/tag/600.0.0) [Compare Source](https://redirect.github.com/apple/swift-syntax/compare/510.0.3...600.0.0) ##### New APIs - FixIt now has a new computed property named `edits` - Description: the `edits` represent the non-overlapping textual `edits` that need to be performed when the Fix-It is applied. - Issue: [https://github.com/swiftlang/sourcekit-lsp/issues/909](https://redirect.github.com/swiftlang/sourcekit-lsp/issues/909) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2314](https://redirect.github.com/swiftlang/swift-syntax/pull/2314) - `SourceEdit` - Description: `SourceEdit` has been moved from SwiftRefactor to SwiftSyntax - Issue: [https://github.com/swiftlang/sourcekit-lsp/issues/909](https://redirect.github.com/swiftlang/sourcekit-lsp/issues/909) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2314](https://redirect.github.com/swiftlang/swift-syntax/pull/2314) - `assertMacroExpansion` now have new parameters named `applyFixIts` and `fixedSource` - Description: `applyFixIts` and `fixedSource` are used to assert so ensure that the source code after applying Fix-Its matches this string. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2015](https://redirect.github.com/swiftlang/swift-syntax/issues/2015) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2021](https://redirect.github.com/swiftlang/swift-syntax/pull/2021) - `DeclSyntaxEnum`, `StmtSyntaxEnum`, `ExprSyntaxEnum`, `TypeSyntaxEnum`, and `PatternSyntaxEnum` - Description: Enum to exhaustively switch over all different syntax nodes of each base type. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2351](https://redirect.github.com/swiftlang/swift-syntax/pull/2351) - `WithOptionalCodeBlock` - Description: A trait for syntax nodes that have an optional code block, such as `FunctionDeclSyntax` and `InitializerDeclSyntax`. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2359](https://redirect.github.com/swiftlang/swift-syntax/pull/2359) - `CodeBlockSyntax` - Description: `CodeBlockSyntax` is now `SyntaxParseable`, so it can be used with string interpolations. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2361](https://redirect.github.com/swiftlang/swift-syntax/pull/2361) - `ThrowsClause` - Description: The `throwsSpecifier` for the effects nodes (`AccessorEffectSpecifiers`, `FunctionEffectSpecifiers`, `TypeEffectSpecifiers`, `EffectSpecifiers`) has been replaced with `throwsClause`, which captures both the throws specifier and the (optional) thrown error type, as introduced by SE-0413. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2379](https://redirect.github.com/swiftlang/swift-syntax/pull/2379) - `String.isValidSwiftIdentifier(for:)` - Description: `SwiftParser` adds an extension on `String` to check if it can be used as an identifier in a given context. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2434](https://redirect.github.com/swiftlang/swift-syntax/pull/2434) - `MacroDeclSyntax.expand` - the `expand(argumentList:definition:replacements:)` method gains a new parameter 'genericReplacements:' that is defaulted to an empty array. - The method's signature is now `expand(argumentList:definition:replacements:genericReplacements:)` - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2450](https://redirect.github.com/swiftlang/swift-syntax/pull/2450) - `SyntaxProtocol.asMacroLexicalContext()` and `allMacroLexicalContexts(enclosingSyntax:)` - Description: Produce the lexical context for a given syntax node (if it has one), or the entire stack of lexical contexts enclosing a syntax node, for use in macro expansion. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/1554](https://redirect.github.com/swiftlang/swift-syntax/pull/1554) - `TriviaPiece.isComment` - Description: `TriviaPiece` now has a computed property `isComment` that returns `true` if the trivia piece is a comment. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2469](https://redirect.github.com/swiftlang/swift-syntax/pull/2469) - New `assertMacroExpansion` API with option to specify macro specifications with `macroSpecs` argument - Description: `macroSpecs` can have additional specifications like conformances provided by member or extension macro that can be used for macro expansion. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2031](https://redirect.github.com/swiftlang/swift-syntax/issues/2031) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2327](https://redirect.github.com/swiftlang/swift-syntax/pull/2327) - `BasicFormat.inferIndentation(of:)` - Description: Uses heuristics to infer the indentation width used in a syntax tree. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2514](https://redirect.github.com/swiftlang/swift-syntax/pull/2514) - `IncrementalEdit` stores replacement text - Description: `IncrementalEdit` used to store the range that was replaced and the length of the replacement but not the replacement bytes by itself. `IncrementalEdit` now has a `replacement` property that contains the replacement bytes. - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2527](https://redirect.github.com/swiftlang/swift-syntax/pull/2527) - Type specifiers - Description: `AttributedTypeSyntax` can now contain multiple specifiers and these types are used to model the list of specifiers. Additionally, type specifiers can now contain arguments, like `borrow(data)`. To facilitate this, the following new types were introduces: `LifetimeSpecifierArgumentListSyntax`, `LifetimeSpecifierArgumentSyntax`, `LifetimeSpecifierArgumentsSyntax`, `LifetimeTypeSpecifierSyntax`, `SimpleTypeSpecifierSyntax`, `TypeSpecifierListSyntax` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2433](https://redirect.github.com/swiftlang/swift-syntax/pull/2433) - `DeclGroupSyntax.introducer` - Description: The `DeclGroupSyntax` trait has an extra `introducer` property, ie. the keyword that introduces the declaration. - Issue: [https://github.com/swiftlang/sourcekit-lsp/issues/2535](https://redirect.github.com/swiftlang/sourcekit-lsp/issues/2535) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2539](https://redirect.github.com/swiftlang/swift-syntax/pull/2539) - `ExprSyntax.interpretedAsVersionTuple` - Description: With the change to parse `#if canImport(MyModule, _version: 1.2.3)` as a function call instead of a dedicated syntax node, `1.2.3` natively gets parsed as a member access `3` to the `1.2` float literal. This property allows the reinterpretation of such an expression as a version tuple. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2025](https://redirect.github.com/swiftlang/swift-syntax/pull/2025) - `SyntaxProtocol.node(at:)` - Description: Given a `SyntaxIdentifier`, returns the `Syntax` node with that identifier - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SyntaxIdentifier.IndexInTree` - Description: Uniquely identifies a syntax node within a tree. This is similar to `SyntaxIdentifier` but does not store the root ID of the tree. It can thus be transferred across trees that are structurally equivalent, for example two copies of the same tree that live in different processes. The only public functions on this type are `toOpaque` and `init(fromOpaque:)`, which allow serialization of the `IndexInTree`. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SyntaxIdentifier` conformance to `Comparable`: - Description: A `SyntaxIdentifier` compares less than another `SyntaxIdentifier` if the node at that identifier occurs first during a depth-first traversal of the tree. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SyntaxIdentifier.indexInTree` and `SyntaxIdentifier.fromIndexInTree` - Description: `SyntaxIdentifier.indexInTree` allows the retrieval of a `SyntaxIdentifier` that identifies the syntax node independent of the syntax tree. `SyntaxIdentifier.fromIndexInTree` allows the creation for a `SyntaxIdentifier` from a tree-agnostic `SyntaxIdentifier.IndexInTree` and the tree's root node. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2594](https://redirect.github.com/swiftlang/swift-syntax/pull/2594) - `SwiftSyntaxMacrosGenericTestSupport` - Description: A version of the `SwiftSyntaxMacrosTestSupport` module that doesn't depend on `Foundation` or `XCTest` and can thus be used to write macro tests using `swift-testing`. Since swift-syntax can't depend on swift-testing (which would incur a circular dependency since swift-testing depends on swift-syntax), users need to manually specify a failure handler like the following, that fails the swift-testing test: `Issue.record("\($0.message)", fileID: $0.location.fileID, filePath: $0.location.filePath, line: $0.location.line, column: $0.location.column)` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2647](https://redirect.github.com/swiftlang/swift-syntax/pull/2647) - `TokenSyntax.identifier` - Description: Adds an `identifier` property to `TokenSyntax` which returns a canonicalized representation of an identifier that strips away backticks. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2576](https://redirect.github.com/swiftlang/swift-syntax/pull/2576) ##### Deprecations - Child Choice Node Casts - Description: `is`, `as`, and `cast` methods for types not contained in the choice node are marked as deprecated. The deprecated methods will emit a warning, indicating that the cast will always fail. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2092](https://redirect.github.com/swiftlang/swift-syntax/issues/2092) - Pull Request: [https://github.com/swiftlang/swift-syntax/pull/2184](https://redirect.github.com/swiftlang/swift-syntax/pull/2184) - Migration steps: Remove the `is`, `as` or `cast` methods because they will always fail. - `IncrementalParseTransition`: - Description: The initializer `IncrementalParseTransition.init(previousTree:edits:lookaheadRanges:reusedNodeCallback:)` is marked as deprecated. Use `IncrementalParseTransition.init(previousIncrementalParseResult:edits:reusedNodeCallback:)` instead. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2267](https://redirect.github.com/swiftlang/swift-syntax/issues/2267) - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2272](https://redirect.github.com/swiftlang/swift-syntax/pull/2272) - Migration steps: Call `IncrementalParseTransition.init(previousIncrementalParseResult:edits:reusedNodeCallback:)` instead. - `MacroExpansion{Error|Warning|FixIt}Message` moved to the `SwiftSyntaxMacros` module - Description: Move the `MacroExpansion{Error|Warning|FixIt}Message` types from the `SwiftSyntaxMacroExpansion` module to `SwiftSyntaxMacros`. Deprecated typealiases in `SwiftSyntaxMacroExpansion` forward to `SwiftSyntaxMacros`. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2338](https://redirect.github.com/swiftlang/swift-syntax/pull/2338) - Notes: The expansion diagnostic messages were defined in `SwiftSyntaxMacroExpansion`, which is intended as an implementation detail of the plugin server and should not need to be imported by macros. - `EditorPlaceholderDeclSyntax` and `EditorPlaceholderExprSyntax`: - Description: `EditorPlaceholderDeclSyntax` and `EditorPlaceholderExprSyntax` are now deprecated and placeholders are instead parsed as identifiers within a `MissingDeclSyntax` or `DeclReferenceExprSyntax`. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2237](https://redirect.github.com/swiftlang/swift-syntax/pull/2237) - `AttributedTypeSyntax.specifier` has renamed to `specifiers` and changed to be a collection - Description: Types can have multiple specifiers now and the syntax tree has been modified to reflect that. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2433](https://redirect.github.com/swiftlang/swift-syntax/pull/2433) - ` CanImportExprSyntax ` and `CanImportVersionInfoSyntax` - Description: Instead of parsing `canImport` inside `#if` directives as a special expression node, parse it as a functionc call expression. This is in-line with how the `swift(>=6.0)` and `compiler(>=6.0)` directives are parsed. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2025](https://redirect.github.com/swiftlang/swift-syntax/pull/2025) ##### API-Incompatible Changes - `MacroDefinition` used for expanding macros: - Description: The `MacroDefinition/expansion` enum case used to have two values (`(MacroExpansionExprSyntax, replacements: [Replacement])`), has now gained another value in order to support generic argument replacements in macro expansions: `(MacroExpansionExprSyntax, replacements: [Replacement], genericReplacements: [GenericArgumentReplacement])` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2450](https://redirect.github.com/swiftlang/swift-syntax/pull/2450) - Migration steps: Code which exhaustively checked over the enum should be changed to `case .expansion(let node, let replacements, let genericReplacements):`. Creating the `.extension` gained a compatibility shim, retaining the previous syntax source compatible (`return .expansion(node, replacements: [])`). - Effect specifiers: - Description: The `unexpectedAfterThrowsSpecifier` node of the various effect specifiers has been removed. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2219](https://redirect.github.com/swiftlang/swift-syntax/pull/2219) - Migration steps: Check `unexpectedBetweenThrowsSpecifierAndThrownError` and `unexpectedAfterThrownError` instead. - `SyntaxKind` removed conformance to `CaseIterable` - Description: `SyntaxKind` no longer conforms to `CaseIterable` since there is no good use case to iterate over all syntax kinds. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2292](https://redirect.github.com/swiftlang/swift-syntax/pull/2292) - Migration steps: Exhaustively check all the syntax nodes that your program supports. There should be no use case to iterate over all cases in `SyntaxKind`. - `IntegerLiteralExprSyntax.Radix` removed conformance to `CaseIterable` - Description: `IntegerLiteralExprSyntax.Radix` no longer conforms to `CaseIterable` since there is no good use case to iterate over all radix kinds. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2292](https://redirect.github.com/swiftlang/swift-syntax/pull/2292) - Migration steps: There should be no use case to iterate over all cases in `IntegerLiteralExprSyntax.Radix`. - `Parser.parseIncrementally(source:parseTransition:)` and `Parser.parseIncrementally(source:maximumNestingLevel:parseTransition:)`: - Description: The default versions of `Parser.parseIncrementally` return a `IncrementalParseResult` instead of a tuple. Access to the struct should be compatible with the tuple in almost all cases unless the tuple is stored into a variable and then destructed or passed to a function that expects a tuple. - Issue: [https://github.com/swiftlang/swift-syntax/issues/2267](https://redirect.github.com/swiftlang/swift-syntax/issues/2267) - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2272](https://redirect.github.com/swiftlang/swift-syntax/pull/2272) - Migration steps: If necessary, change type annotations from the tuple to the `IncrementalParseResult` type. - `SyntaxClassification` gained a new case: `argumentLabel` - The new classification case covers the first names of parameters in function-like declarations and the label of arguments in function-like calls. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2375](https://redirect.github.com/swiftlang/swift-syntax/pull/2375) - Migration steps: In exhaustive switches over `SyntaxClassification`, cover the new case. - `SyntaxEnum` and `SyntaxKind` gained new cases: `throwsClause` - The new cases cover the newly introduced `ThrowsClauseSyntax` - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2379](https://redirect.github.com/swiftlang/swift-syntax/pull/2379) - Migration steps: In exhaustive switches over `SyntaxEnum` and `SyntaxKind`, cover the new case. - `MacroExpansionContext` now requires a property `lexicalContext`: - Description: The new property provides the lexical context in which the macro is expanded, and has several paired API changes. Types that conform to `MacroExpansionContext` will need to implement this property. Additionally, the `HostToPluginMessage` cases `expandFreestandingMacro` and `expandAttachedMacro` now include an optional `lexicalContext`. Finally, the `SyntaxProtocol.expand(macros:in:indentationWidth:)` syntactic expansion operation has been deprecated in favor of a new version `expand(macros:contextGenerator:indentationWidth:)` that takes a function produces a new macro expansion context for each expansion. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/1554](https://redirect.github.com/swiftlang/swift-syntax/pull/1554) - Migration steps: Add the new property `lexicalContext` to any `MacroExpansionContext`-conforming types. If implementing the host-to-plugin message protocol, add support for `lexicalContext`. For macro expansion operations going through `SyntaxProtocol.expand`, provide a context generator that creates a fresh context including the lexical context. - `TriviaPiece.isBackslash` in `SwiftParserDiagnostics` removed - Description: `TriviaPiece.isBackslash` was not intended to be public API. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2531](https://redirect.github.com/swiftlang/swift-syntax/pull/2531) - Migration steps: Use `if case .backslash = triviaPiece` instead - All symbols in `SwiftCompilerPluginMessageHandling` are now SPI - Description: This module is only intended to be used from some internal components. Any other modules should not use them directly. - Pull request: [https://github.com/swiftlang/swift-syntax/pull/2489](https://redirect.github.com/swiftlang/swift-syntax/pull/2489) - Migration steps: Stop using this module. ### [`v510.0.3`](https://redirect.github.com/swiftlang/swift-syntax/releases/tag/510.0.3) [Compare Source](https://redirect.github.com/apple/swift-syntax/compare/510.0.2...510.0.3) Compared to 510.0.2 improves swift-syntax’s ability to build using Bazel. It also contains the following changes from [510.0.0](https://redirect.github.com/apple/swift-syntax/releases/tag/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: [https://github.com/apple/swift-syntax/pull/2085](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2014](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/1984](https://redirect.github.com/apple/swift-syntax/issues/1984) - Pull Request: [https://github.com/apple/swift-syntax/pull/2127](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/1984](https://redirect.github.com/apple/swift-syntax/issues/1984) - Pull Request: [https://github.com/apple/swift-syntax/pull/2112](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2143](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/2108) - `WildcardPatternSyntax.typeAnnotation` - Description: `typeAnnotation` on `WildcardPatternSyntax` was a mistake. Use `typeAnnotation` properties on the outer constructs instead. E.g. `PatternBindingListSyntax.typeAnnotation` - Pull Request: [https://github.com/apple/swift-syntax/pull/2393](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2261](https://redirect.github.com/apple/swift-syntax/issues/2261) - Pull Request: [https://github.com/apple/swift-syntax/pull/2264](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2213](https://redirect.github.com/apple/swift-syntax/pull/2213) ### [`v510.0.2`](https://redirect.github.com/swiftlang/swift-syntax/releases/tag/510.0.2) [Compare Source](https://redirect.github.com/apple/swift-syntax/compare/510.0.1...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](https://redirect.github.com/apple/swift-syntax/releases/tag/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: [https://github.com/apple/swift-syntax/pull/2085](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2014](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/1984](https://redirect.github.com/apple/swift-syntax/issues/1984) - Pull Request: [https://github.com/apple/swift-syntax/pull/2127](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/1984](https://redirect.github.com/apple/swift-syntax/issues/1984) - Pull Request: [https://github.com/apple/swift-syntax/pull/2112](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2143](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/2108) - `WildcardPatternSyntax.typeAnnotation` - Description: `typeAnnotation` on `WildcardPatternSyntax` was a mistake. Use `typeAnnotation` properties on the outer constructs instead. E.g. `PatternBindingListSyntax.typeAnnotation` - Pull Request: [https://github.com/apple/swift-syntax/pull/2393](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2261](https://redirect.github.com/apple/swift-syntax/issues/2261) - Pull Request: [https://github.com/apple/swift-syntax/pull/2264](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2213](https://redirect.github.com/apple/swift-syntax/pull/2213) ### [`v510.0.1`](https://redirect.github.com/swiftlang/swift-syntax/releases/tag/510.0.1) [Compare Source](https://redirect.github.com/apple/swift-syntax/compare/510.0.0...510.0.1) Compared to 510.0.0 this fixes a possible misaligned memory access. It also contains the following changes from [510.0.0](https://redirect.github.com/apple/swift-syntax/releases/tag/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: [https://github.com/apple/swift-syntax/pull/2085](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2014](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/1984](https://redirect.github.com/apple/swift-syntax/issues/1984) - Pull Request: [https://github.com/apple/swift-syntax/pull/2127](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/1984](https://redirect.github.com/apple/swift-syntax/issues/1984) - Pull Request: [https://github.com/apple/swift-syntax/pull/2112](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2143](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2092](https://redirect.github.com/apple/swift-syntax/issues/2092) - Pull Request: [https://github.com/apple/swift-syntax/pull/2108](https://redirect.github.com/apple/swift-syntax/pull/2108) - `WildcardPatternSyntax.typeAnnotation` - Description: `typeAnnotation` on `WildcardPatternSyntax` was a mistake. Use `typeAnnotation` properties on the outer constructs instead. E.g. `PatternBindingListSyntax.typeAnnotation` - Pull Request: [https://github.com/apple/swift-syntax/pull/2393](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/issues/2261](https://redirect.github.com/apple/swift-syntax/issues/2261) - Pull Request: [https://github.com/apple/swift-syntax/pull/2264](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2213](https://redirect.github.com/apple/swift-syntax/pull/2213) ### [`v510.0.0`](https://redirect.github.com/swiftlang/swift-syntax/releases/tag/510.0.0) [Compare Source](https://redirect.github.com/apple/swift-syntax/compare/509.1.1...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: [https://github.com/apple/swift-syntax/pull/2085](https://redirect.github.com/apple/swift-syntax/pull/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: [https://github.com/apple/swift-syntax/pull/2014](https://redirect.github.com/apple/swift-syntax/pull/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. -

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.



This PR was generated by Mend Renovate. View the repository job log.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.05%. Comparing base (c71bc93) to head (fe3ac5a).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #555 +/- ## ======================================= Coverage 89.05% 89.05% ======================================= Files 9 9 Lines 2503 2503 ======================================= Hits 2229 2229 Misses 274 274 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.