diff --git a/CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift b/CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift index 36c4bcd10e4..0ae771a125b 100644 --- a/CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift +++ b/CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift @@ -367,6 +367,19 @@ public enum SyntaxNodeKind: String, CaseIterable { } } + /// For base node types, generates the name of the protocol to which all + /// concrete leaf nodes that derive from this base kind should conform. + /// + /// - Warning: This property can only be accessed for base node kinds; attempting to + /// access it for a non-base kind will result in a runtime error. + public var leafProtocolType: TypeSyntax { + if isBase { + return "Leaf\(syntaxType)NodeProtocol" + } else { + fatalError("Only base kind can define leaf protocol") + } + } + /// If the syntax kind has been renamed, the previous raw value that is now /// deprecated. public var deprecatedRawValue: String? { diff --git a/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift b/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift index 65e8574bb42..0a51b4ec5bd 100644 --- a/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift +++ b/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift @@ -31,6 +31,68 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { """ ) + DeclSyntax( + """ + /// Extension of ``\(node.kind.protocolType)`` to provide casting methods. + /// + /// These methods enable casting between syntax node types within the same + /// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``). + /// + /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``, + /// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't + /// appropriate for use on types conforming to a specific base node protocol + /// like ``\(node.kind.protocolType)``. That's because at this level, + /// we know that the cast to another base node type (e.g., ``DeclSyntaxProtocol`` + /// when working with ``ExprSyntaxProtocol``) is guaranteed to fail. + /// + /// To guide developers toward correct usage, this extension provides overloads + /// of these casting methods that are restricted to the same base node type. + /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as + /// deprecated, indicating that they will always fail when used in this context. + extension \(node.kind.protocolType) { + /// Checks if the syntax node can be cast to the specified type. + /// + /// - Returns: A boolean indicating whether the cast would succeed. + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Attempts to cast the syntax node to the specified type. + /// + /// - Returns: An optional containing the casted syntax node, or `nil` if the cast fails. + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Force-casts the syntax node to the specified type. + /// + /// - Returns: The casted syntax node. + /// - Warning: This will crash if the cast fails. Use with caution. + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + + /// Deprecated cast check that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + } + """ + ) + try! ExtensionDeclSyntax("public extension Syntax") { DeclSyntax( """ @@ -171,30 +233,6 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { ExprSyntax("self._syntaxNode = Syntax(data)") } - DeclSyntax( - """ - public func `is`(_ syntaxType: S.Type) -> Bool { - return self.as(syntaxType) != nil - } - """ - ) - - DeclSyntax( - """ - public func `as`(_ syntaxType: S.Type) -> S? { - return S.init(self) - } - """ - ) - - DeclSyntax( - """ - public func cast(_ syntaxType: S.Type) -> S { - return self.as(S.self)! - } - """ - ) - DeclSyntax( """ /// Syntax nodes always conform to `\(node.kind.protocolType)`. This API is just @@ -232,9 +270,17 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { StmtSyntax("return .choices(\(choices))") } } + + leafProtocolDecl(type: node.kind.leafProtocolType, inheritedType: node.kind.protocolType) } - try! ExtensionDeclSyntax("extension Syntax") { + try! ExtensionDeclSyntax( + """ + // MARK: - Syntax + + extension Syntax + """ + ) { try VariableDeclSyntax("public static var structure: SyntaxNodeStructure") { let choices = ArrayExprSyntax { ArrayElementSyntax( @@ -254,4 +300,38 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { } } + leafProtocolDecl(type: "LeafSyntaxNodeProtocol", inheritedType: "SyntaxProtocol") +} + +private func leafProtocolDecl(type: TypeSyntax, inheritedType: TypeSyntax) -> DeclSyntax { + DeclSyntax( + """ + /// Protocol that syntax nodes conform to if they don't have any semantic subtypes. + /// These are syntax nodes that are not considered base nodes for other syntax types. + /// + /// Syntax nodes conforming to this protocol have their inherited casting methods + /// deprecated to prevent incorrect casting. + public protocol \(type): \(inheritedType) {} + + public extension \(type) { + /// Deprecated cast check that's inherited from ``\(inheritedType)``. + @available(*, deprecated, message: "This cast will always fail") + func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``\(inheritedType)``. + @available(*, deprecated, message: "This cast will always fail") + func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``\(inheritedType)``. + @available(*, deprecated, message: "This cast will always fail") + func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + } + """ + ) } diff --git a/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxNodesFile.swift b/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxNodesFile.swift index 26de3ceb651..dc613e6cc50 100644 --- a/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxNodesFile.swift +++ b/CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxNodesFile.swift @@ -41,7 +41,7 @@ func syntaxNode(nodesStartingWith: [Character]) -> SourceFileSyntax { \(documentation) \(node.node.apiAttributes())\ - public struct \(node.kind.syntaxType): \(node.baseType.syntaxBaseName)Protocol, SyntaxHashable + public struct \(node.kind.syntaxType): \(node.baseType.syntaxBaseName)Protocol, \(node.base.leafProtocolType), SyntaxHashable """ ) { for child in node.children { diff --git a/Release Notes/510.md b/Release Notes/510.md index a3c1a6f9b55..fd655a51cac 100644 --- a/Release Notes/510.md +++ b/Release Notes/510.md @@ -11,6 +11,11 @@ ## API Behavior Changes +- Leaf Node Protocols + - Description: Syntax nodes that do not act as base nodes for other syntax types now conform to a new protocols that deprecates inherited casting methods (e.g. `AccessorBlockSyntax` to `LeafSyntaxNodeProtocol` or `AccessorDeclSyntax` to `LeafDeclSyntaxNodeProtocol`). This change aims to prevent unsafe type-casting by issuing deprecation warnings for methods that will result in failed casts. + - Issue: https://github.com/apple/swift-syntax/issues/2092 + - Pull Request: https://github.com/apple/swift-syntax/pull/2108 + ## Deprecations ## API-Incompatible Changes diff --git a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift index a3bb0538744..369c7a1deaf 100644 --- a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift +++ b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift @@ -1146,8 +1146,7 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor { return .skipChildren } - if node.conditions.count == 1, - node.conditions.first?.as(ConditionElementSyntax.self)?.condition.is(MissingExprSyntax.self) == true, + if node.conditions.only?.condition.is(MissingExprSyntax.self) == true, !node.body.leftBrace.isMissingAllTokens { addDiagnostic(node.conditions, MissingConditionInStatement(node: node), handledNodes: [node.conditions.id]) @@ -2009,8 +2008,7 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor { return .skipChildren } - if node.conditions.count == 1, - node.conditions.first?.as(ConditionElementSyntax.self)?.condition.is(MissingExprSyntax.self) == true, + if node.conditions.only?.condition.is(MissingExprSyntax.self) == true, !node.body.leftBrace.isMissingAllTokens { addDiagnostic(node.conditions, MissingConditionInStatement(node: node), handledNodes: [node.conditions.id]) diff --git a/Sources/SwiftSyntax/Syntax.swift b/Sources/SwiftSyntax/Syntax.swift index da86d847581..d0e863a0c79 100644 --- a/Sources/SwiftSyntax/Syntax.swift +++ b/Sources/SwiftSyntax/Syntax.swift @@ -196,8 +196,9 @@ extension SyntaxProtocol { // Casting functions to specialized syntax nodes. public extension SyntaxProtocol { - /// Converts the given specialized node to this type. Returns `nil` if the - /// conversion is not possible or the given node was `nil`. + /// Initializes a new instance of the conforming type from a given specialized syntax node. + /// + /// Returns `nil` if the conversion isn't possible, or if the provided node is `nil`. init?(_ node: S?) { guard let node = node else { return nil @@ -205,14 +206,24 @@ public extension SyntaxProtocol { self.init(node) } + /// Checks if the current syntax node can be cast to a given specialized syntax type. + /// + /// - Returns: `true` if the node can be cast, `false` otherwise. func `is`(_ syntaxType: S.Type) -> Bool { return self.as(syntaxType) != nil } + /// Attempts to cast the current syntax node to a given specialized syntax type. + /// + /// - Returns: An instance of the specialized type, or `nil` if the cast fails. func `as`(_ syntaxType: S.Type) -> S? { return S.init(self) } + /// Casts the current syntax node to a given specialized syntax type. + /// + /// - Returns: An instance of the specialized type. + /// - Warning: This function will crash if the cast is not possible. Use `as` to safely attempt a cast. func cast(_ syntaxType: S.Type) -> S { return self.as(S.self)! } diff --git a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift index 500f478c827..f4e5551c1cd 100644 --- a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift +++ b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift @@ -21,6 +21,69 @@ /// - Warning: Do not conform to this protocol yourself. public protocol DeclSyntaxProtocol: SyntaxProtocol {} +/// Extension of ``DeclSyntaxProtocol`` to provide casting methods. +/// +/// These methods enable casting between syntax node types within the same +/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``). +/// +/// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``, +/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't +/// appropriate for use on types conforming to a specific base node protocol +/// like ``DeclSyntaxProtocol``. That's because at this level, +/// we know that the cast to another base node type (e.g., ``DeclSyntaxProtocol`` +/// when working with ``ExprSyntaxProtocol``) is guaranteed to fail. +/// +/// To guide developers toward correct usage, this extension provides overloads +/// of these casting methods that are restricted to the same base node type. +/// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as +/// deprecated, indicating that they will always fail when used in this context. +extension DeclSyntaxProtocol { + /// Checks if the syntax node can be cast to the specified type. + /// + /// - Returns: A boolean indicating whether the cast would succeed. + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Attempts to cast the syntax node to the specified type. + /// + /// - Returns: An optional containing the casted syntax node, or `nil` if the cast fails. + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Force-casts the syntax node to the specified type. + /// + /// - Returns: The casted syntax node. + /// - Warning: This will crash if the cast fails. Use with caution. + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + + + /// Deprecated cast check that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Deprecated casting method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Deprecated force-cast method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + public extension Syntax { /// Check whether the non-type erased version of this syntax node conforms to /// DeclSyntaxProtocol. @@ -96,18 +159,6 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable { self._syntaxNode = Syntax(data) } - public func `is`(_ syntaxType: S.Type) -> Bool { - return self.as(syntaxType) != nil - } - - public func `as`(_ syntaxType: S.Type) -> S? { - return S.init(self) - } - - public func cast(_ syntaxType: S.Type) -> S { - return self.as(S.self)! - } - /// Syntax nodes always conform to `DeclSyntaxProtocol`. This API is just /// added for consistency. /// @@ -154,6 +205,33 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } +/// Protocol that syntax nodes conform to if they don't have any semantic subtypes. +/// These are syntax nodes that are not considered base nodes for other syntax types. +/// +/// Syntax nodes conforming to this protocol have their inherited casting methods +/// deprecated to prevent incorrect casting. +public protocol LeafDeclSyntaxNodeProtocol: DeclSyntaxProtocol {} + +public extension LeafDeclSyntaxNodeProtocol { + /// Deprecated cast check that's inherited from ``DeclSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``DeclSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``DeclSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + // MARK: - ExprSyntax /// Protocol to which all ``ExprSyntax`` nodes conform. @@ -163,6 +241,69 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// - Warning: Do not conform to this protocol yourself. public protocol ExprSyntaxProtocol: SyntaxProtocol {} +/// Extension of ``ExprSyntaxProtocol`` to provide casting methods. +/// +/// These methods enable casting between syntax node types within the same +/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``). +/// +/// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``, +/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't +/// appropriate for use on types conforming to a specific base node protocol +/// like ``ExprSyntaxProtocol``. That's because at this level, +/// we know that the cast to another base node type (e.g., ``DeclSyntaxProtocol`` +/// when working with ``ExprSyntaxProtocol``) is guaranteed to fail. +/// +/// To guide developers toward correct usage, this extension provides overloads +/// of these casting methods that are restricted to the same base node type. +/// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as +/// deprecated, indicating that they will always fail when used in this context. +extension ExprSyntaxProtocol { + /// Checks if the syntax node can be cast to the specified type. + /// + /// - Returns: A boolean indicating whether the cast would succeed. + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Attempts to cast the syntax node to the specified type. + /// + /// - Returns: An optional containing the casted syntax node, or `nil` if the cast fails. + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Force-casts the syntax node to the specified type. + /// + /// - Returns: The casted syntax node. + /// - Warning: This will crash if the cast fails. Use with caution. + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + + + /// Deprecated cast check that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Deprecated casting method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Deprecated force-cast method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + public extension Syntax { /// Check whether the non-type erased version of this syntax node conforms to /// ExprSyntaxProtocol. @@ -238,18 +379,6 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable { self._syntaxNode = Syntax(data) } - public func `is`(_ syntaxType: S.Type) -> Bool { - return self.as(syntaxType) != nil - } - - public func `as`(_ syntaxType: S.Type) -> S? { - return S.init(self) - } - - public func cast(_ syntaxType: S.Type) -> S { - return self.as(S.self)! - } - /// Syntax nodes always conform to `ExprSyntaxProtocol`. This API is just /// added for consistency. /// @@ -324,6 +453,33 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } +/// Protocol that syntax nodes conform to if they don't have any semantic subtypes. +/// These are syntax nodes that are not considered base nodes for other syntax types. +/// +/// Syntax nodes conforming to this protocol have their inherited casting methods +/// deprecated to prevent incorrect casting. +public protocol LeafExprSyntaxNodeProtocol: ExprSyntaxProtocol {} + +public extension LeafExprSyntaxNodeProtocol { + /// Deprecated cast check that's inherited from ``ExprSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``ExprSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``ExprSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + // MARK: - PatternSyntax /// Protocol to which all ``PatternSyntax`` nodes conform. @@ -333,6 +489,69 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - Warning: Do not conform to this protocol yourself. public protocol PatternSyntaxProtocol: SyntaxProtocol {} +/// Extension of ``PatternSyntaxProtocol`` to provide casting methods. +/// +/// These methods enable casting between syntax node types within the same +/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``). +/// +/// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``, +/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't +/// appropriate for use on types conforming to a specific base node protocol +/// like ``PatternSyntaxProtocol``. That's because at this level, +/// we know that the cast to another base node type (e.g., ``DeclSyntaxProtocol`` +/// when working with ``ExprSyntaxProtocol``) is guaranteed to fail. +/// +/// To guide developers toward correct usage, this extension provides overloads +/// of these casting methods that are restricted to the same base node type. +/// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as +/// deprecated, indicating that they will always fail when used in this context. +extension PatternSyntaxProtocol { + /// Checks if the syntax node can be cast to the specified type. + /// + /// - Returns: A boolean indicating whether the cast would succeed. + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Attempts to cast the syntax node to the specified type. + /// + /// - Returns: An optional containing the casted syntax node, or `nil` if the cast fails. + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Force-casts the syntax node to the specified type. + /// + /// - Returns: The casted syntax node. + /// - Warning: This will crash if the cast fails. Use with caution. + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + + + /// Deprecated cast check that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Deprecated casting method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Deprecated force-cast method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + public extension Syntax { /// Check whether the non-type erased version of this syntax node conforms to /// PatternSyntaxProtocol. @@ -408,18 +627,6 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable { self._syntaxNode = Syntax(data) } - public func `is`(_ syntaxType: S.Type) -> Bool { - return self.as(syntaxType) != nil - } - - public func `as`(_ syntaxType: S.Type) -> S? { - return S.init(self) - } - - public func cast(_ syntaxType: S.Type) -> S { - return self.as(S.self)! - } - /// Syntax nodes always conform to `PatternSyntaxProtocol`. This API is just /// added for consistency. /// @@ -449,6 +656,33 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } +/// Protocol that syntax nodes conform to if they don't have any semantic subtypes. +/// These are syntax nodes that are not considered base nodes for other syntax types. +/// +/// Syntax nodes conforming to this protocol have their inherited casting methods +/// deprecated to prevent incorrect casting. +public protocol LeafPatternSyntaxNodeProtocol: PatternSyntaxProtocol {} + +public extension LeafPatternSyntaxNodeProtocol { + /// Deprecated cast check that's inherited from ``PatternSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``PatternSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``PatternSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + // MARK: - StmtSyntax /// Protocol to which all ``StmtSyntax`` nodes conform. @@ -458,6 +692,69 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// - Warning: Do not conform to this protocol yourself. public protocol StmtSyntaxProtocol: SyntaxProtocol {} +/// Extension of ``StmtSyntaxProtocol`` to provide casting methods. +/// +/// These methods enable casting between syntax node types within the same +/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``). +/// +/// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``, +/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't +/// appropriate for use on types conforming to a specific base node protocol +/// like ``StmtSyntaxProtocol``. That's because at this level, +/// we know that the cast to another base node type (e.g., ``DeclSyntaxProtocol`` +/// when working with ``ExprSyntaxProtocol``) is guaranteed to fail. +/// +/// To guide developers toward correct usage, this extension provides overloads +/// of these casting methods that are restricted to the same base node type. +/// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as +/// deprecated, indicating that they will always fail when used in this context. +extension StmtSyntaxProtocol { + /// Checks if the syntax node can be cast to the specified type. + /// + /// - Returns: A boolean indicating whether the cast would succeed. + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Attempts to cast the syntax node to the specified type. + /// + /// - Returns: An optional containing the casted syntax node, or `nil` if the cast fails. + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Force-casts the syntax node to the specified type. + /// + /// - Returns: The casted syntax node. + /// - Warning: This will crash if the cast fails. Use with caution. + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + + + /// Deprecated cast check that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Deprecated casting method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Deprecated force-cast method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + public extension Syntax { /// Check whether the non-type erased version of this syntax node conforms to /// StmtSyntaxProtocol. @@ -533,18 +830,6 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable { self._syntaxNode = Syntax(data) } - public func `is`(_ syntaxType: S.Type) -> Bool { - return self.as(syntaxType) != nil - } - - public func `as`(_ syntaxType: S.Type) -> S? { - return S.init(self) - } - - public func cast(_ syntaxType: S.Type) -> S { - return self.as(S.self)! - } - /// Syntax nodes always conform to `StmtSyntaxProtocol`. This API is just /// added for consistency. /// @@ -583,6 +868,33 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } +/// Protocol that syntax nodes conform to if they don't have any semantic subtypes. +/// These are syntax nodes that are not considered base nodes for other syntax types. +/// +/// Syntax nodes conforming to this protocol have their inherited casting methods +/// deprecated to prevent incorrect casting. +public protocol LeafStmtSyntaxNodeProtocol: StmtSyntaxProtocol {} + +public extension LeafStmtSyntaxNodeProtocol { + /// Deprecated cast check that's inherited from ``StmtSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``StmtSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``StmtSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + // MARK: - TypeSyntax /// Protocol to which all ``TypeSyntax`` nodes conform. @@ -592,6 +904,69 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// - Warning: Do not conform to this protocol yourself. public protocol TypeSyntaxProtocol: SyntaxProtocol {} +/// Extension of ``TypeSyntaxProtocol`` to provide casting methods. +/// +/// These methods enable casting between syntax node types within the same +/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``). +/// +/// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``, +/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't +/// appropriate for use on types conforming to a specific base node protocol +/// like ``TypeSyntaxProtocol``. That's because at this level, +/// we know that the cast to another base node type (e.g., ``DeclSyntaxProtocol`` +/// when working with ``ExprSyntaxProtocol``) is guaranteed to fail. +/// +/// To guide developers toward correct usage, this extension provides overloads +/// of these casting methods that are restricted to the same base node type. +/// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as +/// deprecated, indicating that they will always fail when used in this context. +extension TypeSyntaxProtocol { + /// Checks if the syntax node can be cast to the specified type. + /// + /// - Returns: A boolean indicating whether the cast would succeed. + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Attempts to cast the syntax node to the specified type. + /// + /// - Returns: An optional containing the casted syntax node, or `nil` if the cast fails. + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Force-casts the syntax node to the specified type. + /// + /// - Returns: The casted syntax node. + /// - Warning: This will crash if the cast fails. Use with caution. + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } + + + /// Deprecated cast check that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + + /// Deprecated casting method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + + /// Deprecated force-cast method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + public func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + public extension Syntax { /// Check whether the non-type erased version of this syntax node conforms to /// TypeSyntaxProtocol. @@ -667,18 +1042,6 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable { self._syntaxNode = Syntax(data) } - public func `is`(_ syntaxType: S.Type) -> Bool { - return self.as(syntaxType) != nil - } - - public func `as`(_ syntaxType: S.Type) -> S? { - return S.init(self) - } - - public func cast(_ syntaxType: S.Type) -> S { - return self.as(S.self)! - } - /// Syntax nodes always conform to `TypeSyntaxProtocol`. This API is just /// added for consistency. /// @@ -719,6 +1082,35 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } +/// Protocol that syntax nodes conform to if they don't have any semantic subtypes. +/// These are syntax nodes that are not considered base nodes for other syntax types. +/// +/// Syntax nodes conforming to this protocol have their inherited casting methods +/// deprecated to prevent incorrect casting. +public protocol LeafTypeSyntaxNodeProtocol: TypeSyntaxProtocol {} + +public extension LeafTypeSyntaxNodeProtocol { + /// Deprecated cast check that's inherited from ``TypeSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``TypeSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``TypeSyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} + +// MARK: - Syntax + extension Syntax { public static var structure: SyntaxNodeStructure { return .choices([ @@ -1001,3 +1393,30 @@ extension Syntax { ]) } } + +/// Protocol that syntax nodes conform to if they don't have any semantic subtypes. +/// These are syntax nodes that are not considered base nodes for other syntax types. +/// +/// Syntax nodes conforming to this protocol have their inherited casting methods +/// deprecated to prevent incorrect casting. +public protocol LeafSyntaxNodeProtocol: SyntaxProtocol {} + +public extension LeafSyntaxNodeProtocol { + /// Deprecated cast check that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `is`(_ syntaxType: S.Type) -> Bool { + return self.as(syntaxType) != nil + } + + /// Deprecated casting method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func `as`(_ syntaxType: S.Type) -> S? { + return S.init(self) + } + + /// Deprecated force-cast method that's inherited from ``SyntaxProtocol``. + @available(*, deprecated, message: "This cast will always fail") + func cast(_ syntaxType: S.Type) -> S { + return self.as(S.self)! + } +} diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesAB.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesAB.swift index 313e27b1461..fdde3fbd664 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesAB.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesAB.swift @@ -24,7 +24,7 @@ /// /// - ``PatternBindingSyntax``.``PatternBindingSyntax/accessorBlock`` /// - ``SubscriptDeclSyntax``.``SubscriptDeclSyntax/accessorBlock`` -public struct AccessorBlockSyntax: SyntaxProtocol, SyntaxHashable { +public struct AccessorBlockSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Accessors: SyntaxChildChoices, SyntaxHashable { case `accessors`(AccessorDeclListSyntax) case `getter`(CodeBlockItemListSyntax) @@ -223,7 +223,7 @@ public struct AccessorBlockSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AccessorDeclListSyntax`` -public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct AccessorDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -480,7 +480,7 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AccessorDeclSyntax``.``AccessorDeclSyntax/effectSpecifiers`` -public struct AccessorEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { +public struct AccessorEffectSpecifiersSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -608,7 +608,7 @@ public struct AccessorEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AccessorDeclSyntax``.``AccessorDeclSyntax/parameters`` -public struct AccessorParametersSyntax: SyntaxProtocol, SyntaxHashable { +public struct AccessorParametersSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -763,7 +763,7 @@ public struct AccessorParametersSyntax: SyntaxProtocol, SyntaxHashable { /// - `inheritanceClause`: ``InheritanceClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `memberBlock`: ``MemberBlockSyntax`` -public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct ActorDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1102,7 +1102,7 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ArrayElementListSyntax`` -public struct ArrayElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct ArrayElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1226,7 +1226,7 @@ public struct ArrayElementSyntax: SyntaxProtocol, SyntaxHashable { /// - `leftSquare`: `'['` /// - `elements`: ``ArrayElementListSyntax`` /// - `rightSquare`: `']'` -public struct ArrayExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct ArrayExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1402,7 +1402,7 @@ public struct ArrayExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `leftSquare`: `'['` /// - `element`: ``TypeSyntax`` /// - `rightSquare`: `']'` -public struct ArrayTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct ArrayTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1551,7 +1551,7 @@ public struct ArrayTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// /// - `effectSpecifiers`: ``TypeEffectSpecifiersSyntax``? /// - `arrow`: `'->'` -public struct ArrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct ArrowExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1676,7 +1676,7 @@ public struct ArrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `asKeyword`: `'as'` /// - `questionOrExclamationMark`: (`'?'` | `'!'`)? /// - `type`: ``TypeSyntax`` -public struct AsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct AsExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1850,7 +1850,7 @@ public struct AsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `equal`: `'='` -public struct AssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct AssignmentExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1966,7 +1966,7 @@ public struct AssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `inheritanceClause`: ``InheritanceClauseSyntax``? /// - `initializer`: ``TypeInitializerClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? -public struct AssociatedTypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct AssociatedTypeDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2295,7 +2295,7 @@ public struct AssociatedTypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// /// - ``AttributeListSyntax`` /// - ``SwitchCaseSyntax``.``SwitchCaseSyntax/attribute`` -public struct AttributeSyntax: SyntaxProtocol, SyntaxHashable { +public struct AttributeSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Arguments: SyntaxChildChoices, SyntaxHashable { case `argumentList`(LabeledExprListSyntax) case `token`(TokenSyntax) @@ -2771,7 +2771,7 @@ public struct AttributeSyntax: SyntaxProtocol, SyntaxHashable { /// - `specifier`: (`'inout'` | `'__shared'` | `'__owned'` | `'isolated'` | `'_const'` | `'borrowing'` | `'consuming'`)? /// - `attributes`: ``AttributeListSyntax`` /// - `baseType`: ``TypeSyntax`` -public struct AttributedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct AttributedTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2952,7 +2952,7 @@ public struct AttributedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AvailabilityArgumentListSyntax`` -public struct AvailabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct AvailabilityArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Argument: SyntaxChildChoices, SyntaxHashable { case `token`(TokenSyntax) case `availabilityVersionRestriction`(PlatformVersionSyntax) @@ -3138,7 +3138,7 @@ public struct AvailabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ConditionElementSyntax``.``ConditionElementSyntax/condition`` -public struct AvailabilityConditionSyntax: SyntaxProtocol, SyntaxHashable { +public struct AvailabilityConditionSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3346,7 +3346,7 @@ public struct AvailabilityConditionSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AvailabilityArgumentSyntax``.``AvailabilityArgumentSyntax/argument`` -public struct AvailabilityLabeledArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct AvailabilityLabeledArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Value: SyntaxChildChoices, SyntaxHashable { case `string`(SimpleStringLiteralExprSyntax) case `version`(VersionTupleSyntax) @@ -3543,7 +3543,7 @@ public struct AvailabilityLabeledArgumentSyntax: SyntaxProtocol, SyntaxHashable /// /// - `awaitKeyword`: `'await'` /// - `expression`: ``ExprSyntax`` -public struct AwaitExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct AwaitExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3673,7 +3673,7 @@ public struct AwaitExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct BackDeployedAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct BackDeployedAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3853,7 +3853,7 @@ public struct BackDeployedAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashab /// ### Children /// /// - `operator`: `` -public struct BinaryOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct BinaryOperatorExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3937,7 +3937,7 @@ public struct BinaryOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `literal`: (`'true'` | `'false'`) -public struct BooleanLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct BooleanLiteralExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4022,7 +4022,7 @@ public struct BooleanLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `borrowKeyword`: `'_borrow'` /// - `expression`: ``ExprSyntax`` -public struct BorrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct BorrowExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4145,7 +4145,7 @@ public struct BorrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `breakKeyword`: `'break'` /// - `label`: ``? -public struct BreakStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct BreakStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesC.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesC.swift index c296bf36a83..8e1af00fabe 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesC.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesC.swift @@ -21,7 +21,7 @@ /// - `importPath`: `` /// - `versionInfo`: ``CanImportVersionInfoSyntax``? /// - `rightParen`: `')'` -public struct CanImportExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct CanImportExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -228,7 +228,7 @@ public struct CanImportExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``CanImportExprSyntax``.``CanImportExprSyntax/versionInfo`` -public struct CanImportVersionInfoSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct CanImportVersionInfoSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -408,7 +408,7 @@ public struct CanImportVersionInfoSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``CatchClauseListSyntax`` -public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct CatchClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -588,7 +588,7 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``CatchItemListSyntax`` -public struct CatchItemSyntax: SyntaxProtocol, SyntaxHashable { +public struct CatchItemSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -767,7 +767,7 @@ public struct CatchItemSyntax: SyntaxProtocol, SyntaxHashable { /// - `inheritanceClause`: ``InheritanceClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `memberBlock`: ``MemberBlockSyntax`` -public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct ClassDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1113,7 +1113,7 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `classKeyword`: `'class'` -public struct ClassRestrictionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct ClassRestrictionTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1203,7 +1203,7 @@ public struct ClassRestrictionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ClosureSignatureSyntax``.``ClosureSignatureSyntax/capture`` -public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct ClosureCaptureClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1384,7 +1384,7 @@ public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ClosureCaptureSyntax``.``ClosureCaptureSyntax/specifier`` -public struct ClosureCaptureSpecifierSyntax: SyntaxProtocol, SyntaxHashable { +public struct ClosureCaptureSpecifierSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1566,7 +1566,7 @@ public struct ClosureCaptureSpecifierSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ClosureCaptureListSyntax`` -public struct ClosureCaptureSyntax: SyntaxProtocol, SyntaxHashable { +public struct ClosureCaptureSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1777,7 +1777,7 @@ public struct ClosureCaptureSyntax: SyntaxProtocol, SyntaxHashable { /// - ``MacroExpansionExprSyntax``.``MacroExpansionExprSyntax/trailingClosure`` /// - ``MultipleTrailingClosureElementSyntax``.``MultipleTrailingClosureElementSyntax/closure`` /// - ``SubscriptCallExprSyntax``.``SubscriptCallExprSyntax/trailingClosure`` -public struct ClosureExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct ClosureExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1983,7 +1983,7 @@ public struct ClosureExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ClosureSignatureSyntax``.``ClosureSignatureSyntax/parameterClause`` -public struct ClosureParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct ClosureParameterClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2174,7 +2174,7 @@ public struct ClosureParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ClosureParameterListSyntax`` -public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { +public struct ClosureParameterSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2521,7 +2521,7 @@ public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ClosureShorthandParameterListSyntax`` -public struct ClosureShorthandParameterSyntax: SyntaxProtocol, SyntaxHashable { +public struct ClosureShorthandParameterSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2652,7 +2652,7 @@ public struct ClosureShorthandParameterSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ClosureExprSyntax``.``ClosureExprSyntax/signature`` -public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable { +public struct ClosureSignatureSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum ParameterClause: SyntaxChildChoices, SyntaxHashable { case `simpleInput`(ClosureShorthandParameterListSyntax) case `parameterClause`(ClosureParameterClauseSyntax) @@ -2953,7 +2953,7 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``CodeBlockItemListSyntax`` -public struct CodeBlockItemSyntax: SyntaxProtocol, SyntaxHashable { +public struct CodeBlockItemSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Item: SyntaxChildChoices, SyntaxHashable { case `decl`(DeclSyntax) case `stmt`(StmtSyntax) @@ -3150,7 +3150,7 @@ public struct CodeBlockItemSyntax: SyntaxProtocol, SyntaxHashable { /// - ``InitializerDeclSyntax``.``InitializerDeclSyntax/body`` /// - ``RepeatStmtSyntax``.``RepeatStmtSyntax/body`` /// - ``WhileStmtSyntax``.``WhileStmtSyntax/body`` -public struct CodeBlockSyntax: SyntaxProtocol, SyntaxHashable { +public struct CodeBlockSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3329,7 +3329,7 @@ public struct CodeBlockSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``CompositionTypeElementListSyntax`` -public struct CompositionTypeElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct CompositionTypeElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3451,7 +3451,7 @@ public struct CompositionTypeElementSyntax: SyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `elements`: ``CompositionTypeElementListSyntax`` -public struct CompositionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct CompositionTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3566,7 +3566,7 @@ public struct CompositionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ConditionElementListSyntax`` -public struct ConditionElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct ConditionElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Condition: SyntaxChildChoices, SyntaxHashable { case `expression`(ExprSyntax) case `availability`(AvailabilityConditionSyntax) @@ -3763,7 +3763,7 @@ public struct ConditionElementSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``GenericRequirementSyntax``.``GenericRequirementSyntax/requirement`` -public struct ConformanceRequirementSyntax: SyntaxProtocol, SyntaxHashable { +public struct ConformanceRequirementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3912,7 +3912,7 @@ public struct ConformanceRequirementSyntax: SyntaxProtocol, SyntaxHashable { /// /// - `consumeKeyword`: (`'_move'` | `'consume'`) /// - `expression`: ``ExprSyntax`` -public struct ConsumeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct ConsumeExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4035,7 +4035,7 @@ public struct ConsumeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `continueKeyword`: `'continue'` /// - `label`: ``? -public struct ContinueStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct ContinueStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4167,7 +4167,7 @@ public struct ContinueStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct ConventionAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct ConventionAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4377,7 +4377,7 @@ public struct ConventionAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4526,7 +4526,7 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S /// /// - `copyKeyword`: `'copy'` /// - `expression`: ``ExprSyntax`` -public struct CopyExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct CopyExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift index 2dbbeb896e2..d2c604f2e25 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesD.swift @@ -23,7 +23,7 @@ /// ### Contained in /// /// - ``DeclModifierSyntax``.``DeclModifierSyntax/detail`` -public struct DeclModifierDetailSyntax: SyntaxProtocol, SyntaxHashable { +public struct DeclModifierDetailSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -177,7 +177,7 @@ public struct DeclModifierDetailSyntax: SyntaxProtocol, SyntaxHashable { /// /// - ``AccessorDeclSyntax``.``AccessorDeclSyntax/modifier`` /// - ``DeclModifierListSyntax`` -public struct DeclModifierSyntax: SyntaxProtocol, SyntaxHashable { +public struct DeclModifierSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -304,7 +304,7 @@ public struct DeclModifierSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``DeclNameArgumentListSyntax`` -public struct DeclNameArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct DeclNameArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -432,7 +432,7 @@ public struct DeclNameArgumentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``DeclReferenceExprSyntax``.``DeclReferenceExprSyntax/argumentNames`` -public struct DeclNameArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct DeclNameArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -615,7 +615,7 @@ public struct DeclNameArgumentsSyntax: SyntaxProtocol, SyntaxHashable { /// - ``KeyPathPropertyComponentSyntax``.``KeyPathPropertyComponentSyntax/declName`` /// - ``MemberAccessExprSyntax``.``MemberAccessExprSyntax/declName`` /// - ``SpecializeTargetFunctionArgumentSyntax``.``SpecializeTargetFunctionArgumentSyntax/declName`` -public struct DeclReferenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct DeclReferenceExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -738,7 +738,7 @@ public struct DeclReferenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `deferKeyword`: `'defer'` /// - `body`: ``CodeBlockSyntax`` -public struct DeferStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct DeferStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -873,7 +873,7 @@ public struct DeferStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// - `deinitKeyword`: `'deinit'` /// - `effectSpecifiers`: ``DeinitializerEffectSpecifiersSyntax``? /// - `body`: ``CodeBlockSyntax``? -public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1137,7 +1137,7 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``DeinitializerDeclSyntax``.``DeinitializerDeclSyntax/effectSpecifiers`` -public struct DeinitializerEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { +public struct DeinitializerEffectSpecifiersSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1233,7 +1233,7 @@ public struct DeinitializerEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashabl /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct DerivativeAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct DerivativeAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1500,7 +1500,7 @@ public struct DerivativeAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable /// ### Contained in /// /// - ``DesignatedTypeListSyntax`` -public struct DesignatedTypeSyntax: SyntaxProtocol, SyntaxHashable { +public struct DesignatedTypeSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1629,7 +1629,7 @@ public struct DesignatedTypeSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``DictionaryElementListSyntax`` -public struct DictionaryElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct DictionaryElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1805,7 +1805,7 @@ public struct DictionaryElementSyntax: SyntaxProtocol, SyntaxHashable { /// - `leftSquare`: `'['` /// - `content`: (`':'` | ``DictionaryElementListSyntax``) /// - `rightSquare`: `']'` -public struct DictionaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct DictionaryExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public enum Content: SyntaxChildChoices, SyntaxHashable { case `colon`(TokenSyntax) case `elements`(DictionaryElementListSyntax) @@ -1999,7 +1999,7 @@ public struct DictionaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `colon`: `':'` /// - `value`: ``TypeSyntax`` /// - `rightSquare`: `']'` -public struct DictionaryTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct DictionaryTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2207,7 +2207,7 @@ public struct DictionaryTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// /// - ``DifferentiabilityArgumentListSyntax`` /// - ``DifferentiabilityWithRespectToArgumentSyntax``.``DifferentiabilityWithRespectToArgumentSyntax/arguments`` -public struct DifferentiabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct DifferentiabilityArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2337,7 +2337,7 @@ public struct DifferentiabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``DifferentiabilityWithRespectToArgumentSyntax``.``DifferentiabilityWithRespectToArgumentSyntax/arguments`` -public struct DifferentiabilityArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct DifferentiabilityArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2522,7 +2522,7 @@ public struct DifferentiabilityArgumentsSyntax: SyntaxProtocol, SyntaxHashable { /// /// - ``DerivativeAttributeArgumentsSyntax``.``DerivativeAttributeArgumentsSyntax/arguments`` /// - ``DifferentiableAttributeArgumentsSyntax``.``DifferentiableAttributeArgumentsSyntax/arguments`` -public struct DifferentiabilityWithRespectToArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct DifferentiabilityWithRespectToArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Arguments: SyntaxChildChoices, SyntaxHashable { case `argument`(DifferentiabilityArgumentSyntax) case `argumentList`(DifferentiabilityArgumentsSyntax) @@ -2726,7 +2726,7 @@ public struct DifferentiabilityWithRespectToArgumentSyntax: SyntaxProtocol, Synt /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2932,7 +2932,7 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash /// ### Children /// /// - `wildcard`: `'_'` -public struct DiscardAssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct DiscardAssignmentExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3017,7 +3017,7 @@ public struct DiscardAssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `discardKeyword`: `'discard'` /// - `expression`: ``ExprSyntax`` -public struct DiscardStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct DiscardStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3141,7 +3141,7 @@ public struct DiscardStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// - `doKeyword`: `'do'` /// - `body`: ``CodeBlockSyntax`` /// - `catchClauses`: ``CatchClauseListSyntax`` -public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct DoStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3322,7 +3322,7 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``DocumentationAttributeArgumentListSyntax`` -public struct DocumentationAttributeArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct DocumentationAttributeArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Value: SyntaxChildChoices, SyntaxHashable { case `token`(TokenSyntax) case `string`(StringLiteralExprSyntax) @@ -3548,7 +3548,7 @@ public struct DocumentationAttributeArgumentSyntax: SyntaxProtocol, SyntaxHashab /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct DynamicReplacementAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct DynamicReplacementAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesEF.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesEF.swift index d0a4b6d7db7..5abe551ef1b 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesEF.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesEF.swift @@ -21,7 +21,7 @@ /// - `attributes`: ``AttributeListSyntax`` /// - `modifiers`: ``DeclModifierListSyntax`` /// - `placeholder`: `` -public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -227,7 +227,7 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `placeholder`: `` -public struct EditorPlaceholderExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct EditorPlaceholderExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -316,7 +316,7 @@ public struct EditorPlaceholderExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `modifiers`: ``DeclModifierListSyntax`` /// - `caseKeyword`: `'case'` /// - `elements`: ``EnumCaseElementListSyntax`` -public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -585,7 +585,7 @@ public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``EnumCaseElementListSyntax`` -public struct EnumCaseElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct EnumCaseElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -773,7 +773,7 @@ public struct EnumCaseElementSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``EnumCaseElementSyntax``.``EnumCaseElementSyntax/parameterClause`` -public struct EnumCaseParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct EnumCaseParameterClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -963,7 +963,7 @@ public struct EnumCaseParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``EnumCaseParameterListSyntax`` -public struct EnumCaseParameterSyntax: SyntaxProtocol, SyntaxHashable { +public struct EnumCaseParameterSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1258,7 +1258,7 @@ public struct EnumCaseParameterSyntax: SyntaxProtocol, SyntaxHashable { /// - `inheritanceClause`: ``InheritanceClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `memberBlock`: ``MemberBlockSyntax`` -public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct EnumDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1612,7 +1612,7 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct ExposeAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct ExposeAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1760,7 +1760,7 @@ public struct ExposeAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `expression`: ``ExprSyntax`` -public struct ExpressionPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { +public struct ExpressionPatternSyntax: PatternSyntaxProtocol, LeafPatternSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1852,7 +1852,7 @@ public struct ExpressionPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``StringLiteralSegmentListSyntax`` -public struct ExpressionSegmentSyntax: SyntaxProtocol, SyntaxHashable { +public struct ExpressionSegmentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2078,7 +2078,7 @@ public struct ExpressionSegmentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `expression`: ``ExprSyntax`` -public struct ExpressionStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct ExpressionStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2168,7 +2168,7 @@ public struct ExpressionStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// - `inheritanceClause`: ``InheritanceClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `memberBlock`: ``MemberBlockSyntax`` -public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct ExtensionDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2474,7 +2474,7 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `fallthroughKeyword`: `'fallthrough'` -public struct FallThroughStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct FallThroughStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2558,7 +2558,7 @@ public struct FallThroughStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `literal`: `` -public struct FloatLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct FloatLiteralExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2651,7 +2651,7 @@ public struct FloatLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `sequence`: ``ExprSyntax`` /// - `whereClause`: ``WhereClauseSyntax``? /// - `body`: ``CodeBlockSyntax`` -public struct ForStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct ForStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2982,7 +2982,7 @@ public struct ForStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// /// - `expression`: ``ExprSyntax`` /// - `exclamationMark`: `'!'` -public struct ForceUnwrapExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct ForceUnwrapExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3109,7 +3109,7 @@ public struct ForceUnwrapExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `rightParen`: `')'`? /// - `trailingClosure`: ``ClosureExprSyntax``? /// - `additionalTrailingClosures`: ``MultipleTrailingClosureElementListSyntax`` -public struct FunctionCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct FunctionCallExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3394,7 +3394,7 @@ public struct FunctionCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `signature`: ``FunctionSignatureSyntax`` /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `body`: ``CodeBlockSyntax``? -public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct FunctionDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3733,7 +3733,7 @@ public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``FunctionSignatureSyntax``.``FunctionSignatureSyntax/effectSpecifiers`` -public struct FunctionEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { +public struct FunctionEffectSpecifiersSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3862,7 +3862,7 @@ public struct FunctionEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { /// /// - ``FunctionSignatureSyntax``.``FunctionSignatureSyntax/parameterClause`` /// - ``SubscriptDeclSyntax``.``SubscriptDeclSyntax/parameterClause`` -public struct FunctionParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct FunctionParameterClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4048,7 +4048,7 @@ public struct FunctionParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``FunctionParameterListSyntax`` -public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { +public struct FunctionParameterSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4412,7 +4412,7 @@ public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { /// - ``FunctionDeclSyntax``.``FunctionDeclSyntax/signature`` /// - ``InitializerDeclSyntax``.``InitializerDeclSyntax/signature`` /// - ``MacroDeclSyntax``.``MacroDeclSyntax/signature`` -public struct FunctionSignatureSyntax: SyntaxProtocol, SyntaxHashable { +public struct FunctionSignatureSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4564,7 +4564,7 @@ public struct FunctionSignatureSyntax: SyntaxProtocol, SyntaxHashable { /// - `rightParen`: `')'` /// - `effectSpecifiers`: ``TypeEffectSpecifiersSyntax``? /// - `returnClause`: ``ReturnClauseSyntax`` -public struct FunctionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct FunctionTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift index e8a5f42fa07..6d1f17dc30b 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesGHI.swift @@ -28,7 +28,7 @@ /// - ``MacroExpansionDeclSyntax``.``MacroExpansionDeclSyntax/genericArgumentClause`` /// - ``MacroExpansionExprSyntax``.``MacroExpansionExprSyntax/genericArgumentClause`` /// - ``MemberTypeSyntax``.``MemberTypeSyntax/genericArgumentClause`` -public struct GenericArgumentClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct GenericArgumentClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -207,7 +207,7 @@ public struct GenericArgumentClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``GenericArgumentListSyntax`` -public struct GenericArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct GenericArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -347,7 +347,7 @@ public struct GenericArgumentSyntax: SyntaxProtocol, SyntaxHashable { /// - ``StructDeclSyntax``.``StructDeclSyntax/genericParameterClause`` /// - ``SubscriptDeclSyntax``.``SubscriptDeclSyntax/genericParameterClause`` /// - ``TypeAliasDeclSyntax``.``TypeAliasDeclSyntax/genericParameterClause`` -public struct GenericParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct GenericParameterClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -564,7 +564,7 @@ public struct GenericParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``GenericParameterListSyntax`` -public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { +public struct GenericParameterSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -821,7 +821,7 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``GenericRequirementListSyntax`` -public struct GenericRequirementSyntax: SyntaxProtocol, SyntaxHashable { +public struct GenericRequirementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Requirement: SyntaxChildChoices, SyntaxHashable { case `sameTypeRequirement`(SameTypeRequirementSyntax) case `conformanceRequirement`(ConformanceRequirementSyntax) @@ -997,7 +997,7 @@ public struct GenericRequirementSyntax: SyntaxProtocol, SyntaxHashable { /// /// - `expression`: ``ExprSyntax`` /// - `genericArgumentClause`: ``GenericArgumentClauseSyntax`` -public struct GenericSpecializationExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct GenericSpecializationExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1140,7 +1140,7 @@ public struct GenericSpecializationExprSyntax: ExprSyntaxProtocol, SyntaxHashabl /// - ``StructDeclSyntax``.``StructDeclSyntax/genericWhereClause`` /// - ``SubscriptDeclSyntax``.``SubscriptDeclSyntax/genericWhereClause`` /// - ``TypeAliasDeclSyntax``.``TypeAliasDeclSyntax/genericWhereClause`` -public struct GenericWhereClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct GenericWhereClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1295,7 +1295,7 @@ public struct GenericWhereClauseSyntax: SyntaxProtocol, SyntaxHashable { /// - `conditions`: ``ConditionElementListSyntax`` /// - `elseKeyword`: `'else'` /// - `body`: ``CodeBlockSyntax`` -public struct GuardStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct GuardStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1495,7 +1495,7 @@ public struct GuardStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `identifier`: (`` | `'self'` | `'init'`) -public struct IdentifierPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { +public struct IdentifierPatternSyntax: PatternSyntaxProtocol, LeafPatternSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1580,7 +1580,7 @@ public struct IdentifierPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// /// - `name`: (`` | `'Self'` | `'Any'` | `'_'`) /// - `genericArgumentClause`: ``GenericArgumentClauseSyntax``? -public struct IdentifierTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct IdentifierTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1708,7 +1708,7 @@ public struct IdentifierTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``IfConfigClauseListSyntax`` -public struct IfConfigClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct IfConfigClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Elements: SyntaxChildChoices, SyntaxHashable { case `statements`(CodeBlockItemListSyntax) case `switchCases`(SwitchCaseListSyntax) @@ -1944,7 +1944,7 @@ public struct IfConfigClauseSyntax: SyntaxProtocol, SyntaxHashable { /// - ``AttributeListSyntax`` /// - ``PostfixIfConfigExprSyntax``.``PostfixIfConfigExprSyntax/config`` /// - ``SwitchCaseListSyntax`` -public struct IfConfigDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct IfConfigDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2100,7 +2100,7 @@ public struct IfConfigDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``IfExprSyntax``.``IfExprSyntax/elseBody`` -public struct IfExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct IfExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public enum ElseBody: SyntaxChildChoices, SyntaxHashable { case `ifExpr`(IfExprSyntax) case `codeBlock`(CodeBlockSyntax) @@ -2376,7 +2376,7 @@ public struct IfExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct ImplementsAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct ImplementsAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2531,7 +2531,7 @@ public struct ImplementsAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable /// /// - `wrappedType`: ``TypeSyntax`` /// - `exclamationMark`: `'!'` -public struct ImplicitlyUnwrappedOptionalTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct ImplicitlyUnwrappedOptionalTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2665,7 +2665,7 @@ public struct ImplicitlyUnwrappedOptionalTypeSyntax: TypeSyntaxProtocol, SyntaxH /// - `importKeyword`: `'import'` /// - `importKindSpecifier`: (`'typealias'` | `'struct'` | `'class'` | `'enum'` | `'protocol'` | `'var'` | `'let'` | `'func'` | `'inout'`)? /// - `path`: ``ImportPathComponentListSyntax`` -public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct ImportDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2960,7 +2960,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ImportPathComponentListSyntax`` -public struct ImportPathComponentSyntax: SyntaxProtocol, SyntaxHashable { +public struct ImportPathComponentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3083,7 +3083,7 @@ public struct ImportPathComponentSyntax: SyntaxProtocol, SyntaxHashable { /// /// - `ampersand`: `'&'` /// - `expression`: ``ExprSyntax`` -public struct InOutExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct InOutExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3207,7 +3207,7 @@ public struct InOutExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `leftOperand`: ``ExprSyntax`` /// - `operator`: ``ExprSyntax`` /// - `rightOperand`: ``ExprSyntax`` -public struct InfixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct InfixOperatorExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3366,7 +3366,7 @@ public struct InfixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - ``ExtensionDeclSyntax``.``ExtensionDeclSyntax/inheritanceClause`` /// - ``ProtocolDeclSyntax``.``ProtocolDeclSyntax/inheritanceClause`` /// - ``StructDeclSyntax``.``StructDeclSyntax/inheritanceClause`` -public struct InheritanceClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct InheritanceClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3519,7 +3519,7 @@ public struct InheritanceClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``InheritedTypeListSyntax`` -public struct InheritedTypeSyntax: SyntaxProtocol, SyntaxHashable { +public struct InheritedTypeSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3652,7 +3652,7 @@ public struct InheritedTypeSyntax: SyntaxProtocol, SyntaxHashable { /// - ``MatchingPatternConditionSyntax``.``MatchingPatternConditionSyntax/initializer`` /// - ``OptionalBindingConditionSyntax``.``OptionalBindingConditionSyntax/initializer`` /// - ``PatternBindingSyntax``.``PatternBindingSyntax/initializer`` -public struct InitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct InitializerClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3792,7 +3792,7 @@ public struct InitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { /// - `signature`: ``FunctionSignatureSyntax`` /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `body`: ``CodeBlockSyntax``? -public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct InitializerDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4138,7 +4138,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `literal`: `` -public struct IntegerLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct IntegerLiteralExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4234,7 +4234,7 @@ public struct IntegerLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `expression`: ``ExprSyntax`` /// - `isKeyword`: `'is'` /// - `type`: ``TypeSyntax`` -public struct IsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct IsExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4389,7 +4389,7 @@ public struct IsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `isKeyword`: `'is'` /// - `type`: ``TypeSyntax`` -public struct IsTypePatternSyntax: PatternSyntaxProtocol, SyntaxHashable { +public struct IsTypePatternSyntax: PatternSyntaxProtocol, LeafPatternSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift index 84431102b7b..60ac5937095 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesJKLMN.swift @@ -22,7 +22,7 @@ /// ### Contained in /// /// - ``KeyPathComponentListSyntax`` -public struct KeyPathComponentSyntax: SyntaxProtocol, SyntaxHashable { +public struct KeyPathComponentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Component: SyntaxChildChoices, SyntaxHashable { case `property`(KeyPathPropertyComponentSyntax) case `subscript`(KeyPathSubscriptComponentSyntax) @@ -199,7 +199,7 @@ public struct KeyPathComponentSyntax: SyntaxProtocol, SyntaxHashable { /// - `backslash`: `'\'` /// - `root`: ``TypeSyntax``? /// - `components`: ``KeyPathComponentListSyntax`` -public struct KeyPathExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct KeyPathExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -377,7 +377,7 @@ public struct KeyPathExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``KeyPathComponentSyntax``.``KeyPathComponentSyntax/component`` -public struct KeyPathOptionalComponentSyntax: SyntaxProtocol, SyntaxHashable { +public struct KeyPathOptionalComponentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -466,7 +466,7 @@ public struct KeyPathOptionalComponentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``KeyPathComponentSyntax``.``KeyPathComponentSyntax/component`` -public struct KeyPathPropertyComponentSyntax: SyntaxProtocol, SyntaxHashable { +public struct KeyPathPropertyComponentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -594,7 +594,7 @@ public struct KeyPathPropertyComponentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``KeyPathComponentSyntax``.``KeyPathComponentSyntax/component`` -public struct KeyPathSubscriptComponentSyntax: SyntaxProtocol, SyntaxHashable { +public struct KeyPathSubscriptComponentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -775,7 +775,7 @@ public struct KeyPathSubscriptComponentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``LabeledExprListSyntax`` -public struct LabeledExprSyntax: SyntaxProtocol, SyntaxHashable { +public struct LabeledExprSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -958,7 +958,7 @@ public struct LabeledExprSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``SpecializeAttributeArgumentListSyntax`` -public struct LabeledSpecializeArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct LabeledSpecializeArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1142,7 +1142,7 @@ public struct LabeledSpecializeArgumentSyntax: SyntaxProtocol, SyntaxHashable { /// - `label`: `` /// - `colon`: `':'` /// - `statement`: ``StmtSyntax`` -public struct LabeledStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct LabeledStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1301,7 +1301,7 @@ public struct LabeledStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``GenericRequirementSyntax``.``GenericRequirementSyntax/requirement`` -public struct LayoutRequirementSyntax: SyntaxProtocol, SyntaxHashable { +public struct LayoutRequirementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1586,7 +1586,7 @@ public struct LayoutRequirementSyntax: SyntaxProtocol, SyntaxHashable { /// - `signature`: ``FunctionSignatureSyntax`` /// - `definition`: ``InitializerClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? -public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct MacroDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1929,7 +1929,7 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// - `rightParen`: `')'`? /// - `trailingClosure`: ``ClosureExprSyntax``? /// - `additionalTrailingClosures`: ``MultipleTrailingClosureElementListSyntax`` -public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2372,7 +2372,7 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// - `rightParen`: `')'`? /// - `trailingClosure`: ``ClosureExprSyntax``? /// - `additionalTrailingClosures`: ``MultipleTrailingClosureElementListSyntax`` -public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2711,7 +2711,7 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ConditionElementSyntax``.``ConditionElementSyntax/condition`` -public struct MatchingPatternConditionSyntax: SyntaxProtocol, SyntaxHashable { +public struct MatchingPatternConditionSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2889,7 +2889,7 @@ public struct MatchingPatternConditionSyntax: SyntaxProtocol, SyntaxHashable { /// - `base`: ``ExprSyntax``? /// - `period`: `'.'` /// - `declName`: ``DeclReferenceExprSyntax`` -public struct MemberAccessExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct MemberAccessExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3048,7 +3048,7 @@ public struct MemberAccessExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``MemberBlockItemListSyntax`` -public struct MemberBlockItemSyntax: SyntaxProtocol, SyntaxHashable { +public struct MemberBlockItemSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3185,7 +3185,7 @@ public struct MemberBlockItemSyntax: SyntaxProtocol, SyntaxHashable { /// - ``ExtensionDeclSyntax``.``ExtensionDeclSyntax/memberBlock`` /// - ``ProtocolDeclSyntax``.``ProtocolDeclSyntax/memberBlock`` /// - ``StructDeclSyntax``.``StructDeclSyntax/memberBlock`` -public struct MemberBlockSyntax: SyntaxProtocol, SyntaxHashable { +public struct MemberBlockSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3362,7 +3362,7 @@ public struct MemberBlockSyntax: SyntaxProtocol, SyntaxHashable { /// - `period`: `'.'` /// - `name`: (`` | `'self'`) /// - `genericArgumentClause`: ``GenericArgumentClauseSyntax``? -public struct MemberTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct MemberTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3538,7 +3538,7 @@ public struct MemberTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// - `baseType`: ``TypeSyntax`` /// - `period`: `'.'` /// - `metatypeSpecifier`: (`'Type'` | `'Protocol'`) -public struct MetatypeTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct MetatypeTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3690,7 +3690,7 @@ public struct MetatypeTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// - `attributes`: ``AttributeListSyntax`` /// - `modifiers`: ``DeclModifierListSyntax`` /// - `placeholder`: `` -public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct MissingDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3900,7 +3900,7 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `placeholder`: `` -public struct MissingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct MissingExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3990,7 +3990,7 @@ public struct MissingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `placeholder`: `` -public struct MissingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { +public struct MissingPatternSyntax: PatternSyntaxProtocol, LeafPatternSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4080,7 +4080,7 @@ public struct MissingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `placeholder`: `` -public struct MissingStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct MissingStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4170,7 +4170,7 @@ public struct MissingStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `placeholder`: `` -public struct MissingSyntax: SyntaxProtocol, SyntaxHashable { +public struct MissingSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4260,7 +4260,7 @@ public struct MissingSyntax: SyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `placeholder`: `` -public struct MissingTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct MissingTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4354,7 +4354,7 @@ public struct MissingTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``MultipleTrailingClosureElementListSyntax`` -public struct MultipleTrailingClosureElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct MultipleTrailingClosureElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4503,7 +4503,7 @@ public struct MultipleTrailingClosureElementSyntax: SyntaxProtocol, SyntaxHashab /// /// - `genericParameterClause`: ``GenericParameterClauseSyntax`` /// - `type`: ``TypeSyntax`` -public struct NamedOpaqueReturnTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct NamedOpaqueReturnTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4627,7 +4627,7 @@ public struct NamedOpaqueReturnTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `nilKeyword`: `'nil'` -public struct NilLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct NilLiteralExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesOP.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesOP.swift index b8c86485b82..07200ff9d70 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesOP.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesOP.swift @@ -24,7 +24,7 @@ /// ### Contained in /// /// - ``ObjCSelectorPieceListSyntax`` -public struct ObjCSelectorPieceSyntax: SyntaxProtocol, SyntaxHashable { +public struct ObjCSelectorPieceSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -154,7 +154,7 @@ public struct ObjCSelectorPieceSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct OpaqueReturnTypeOfAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct OpaqueReturnTypeOfAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -311,7 +311,7 @@ public struct OpaqueReturnTypeOfAttributeArgumentsSyntax: SyntaxProtocol, Syntax /// - `operatorKeyword`: `'operator'` /// - `name`: (`` | `` | ``) /// - `operatorPrecedenceAndTypes`: ``OperatorPrecedenceAndTypesSyntax``? -public struct OperatorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct OperatorDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -497,7 +497,7 @@ public struct OperatorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``OperatorDeclSyntax``.``OperatorDeclSyntax/operatorPrecedenceAndTypes`` -public struct OperatorPrecedenceAndTypesSyntax: SyntaxProtocol, SyntaxHashable { +public struct OperatorPrecedenceAndTypesSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -682,7 +682,7 @@ public struct OperatorPrecedenceAndTypesSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ConditionElementSyntax``.``ConditionElementSyntax/condition`` -public struct OptionalBindingConditionSyntax: SyntaxProtocol, SyntaxHashable { +public struct OptionalBindingConditionSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -857,7 +857,7 @@ public struct OptionalBindingConditionSyntax: SyntaxProtocol, SyntaxHashable { /// /// - `expression`: ``ExprSyntax`` /// - `questionMark`: `'?'` -public struct OptionalChainingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct OptionalChainingExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -980,7 +980,7 @@ public struct OptionalChainingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `wrappedType`: ``TypeSyntax`` /// - `questionMark`: `'?'` -public struct OptionalTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct OptionalTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1112,7 +1112,7 @@ public struct OptionalTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct OriginallyDefinedInAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct OriginallyDefinedInAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1339,7 +1339,7 @@ public struct OriginallyDefinedInAttributeArgumentsSyntax: SyntaxProtocol, Synta /// /// - `eachKeyword`: `'each'` /// - `pack`: ``ExprSyntax`` -public struct PackElementExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct PackElementExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1462,7 +1462,7 @@ public struct PackElementExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `eachKeyword`: `'each'` /// - `pack`: ``TypeSyntax`` -public struct PackElementTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct PackElementTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1585,7 +1585,7 @@ public struct PackElementTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// /// - `repeatKeyword`: `'repeat'` /// - `repetitionPattern`: ``ExprSyntax`` -public struct PackExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct PackExpansionExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1708,7 +1708,7 @@ public struct PackExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `repeatKeyword`: `'repeat'` /// - `repetitionPattern`: ``TypeSyntax`` -public struct PackExpansionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct PackExpansionTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1840,7 +1840,7 @@ public struct PackExpansionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``PatternBindingListSyntax`` -public struct PatternBindingSyntax: SyntaxProtocol, SyntaxHashable { +public struct PatternBindingSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2060,7 +2060,7 @@ public struct PatternBindingSyntax: SyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `pattern`: ``PatternSyntax`` -public struct PatternExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct PatternExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2151,7 +2151,7 @@ public struct PatternExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``PlatformVersionItemListSyntax`` -public struct PlatformVersionItemSyntax: SyntaxProtocol, SyntaxHashable { +public struct PlatformVersionItemSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2283,7 +2283,7 @@ public struct PlatformVersionItemSyntax: SyntaxProtocol, SyntaxHashable { /// /// - ``AvailabilityArgumentSyntax``.``AvailabilityArgumentSyntax/argument`` /// - ``PlatformVersionItemSyntax``.``PlatformVersionItemSyntax/platformVersion`` -public struct PlatformVersionSyntax: SyntaxProtocol, SyntaxHashable { +public struct PlatformVersionSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2414,7 +2414,7 @@ public struct PlatformVersionSyntax: SyntaxProtocol, SyntaxHashable { /// /// - `base`: ``ExprSyntax``? /// - `config`: ``IfConfigDeclSyntax`` -public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2537,7 +2537,7 @@ public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `expression`: ``ExprSyntax`` /// - `operator`: `` -public struct PostfixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct PostfixOperatorExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2669,7 +2669,7 @@ public struct PostfixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``PoundSourceLocationSyntax``.``PoundSourceLocationSyntax/arguments`` -public struct PoundSourceLocationArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct PoundSourceLocationArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2924,7 +2924,7 @@ public struct PoundSourceLocationArgumentsSyntax: SyntaxProtocol, SyntaxHashable /// - `leftParen`: `'('` /// - `arguments`: ``PoundSourceLocationArgumentsSyntax``? /// - `rightParen`: `')'` -public struct PoundSourceLocationSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct PoundSourceLocationSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3106,7 +3106,7 @@ public struct PoundSourceLocationSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``PrecedenceGroupAttributeListSyntax`` -public struct PrecedenceGroupAssignmentSyntax: SyntaxProtocol, SyntaxHashable { +public struct PrecedenceGroupAssignmentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3264,7 +3264,7 @@ public struct PrecedenceGroupAssignmentSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``PrecedenceGroupAttributeListSyntax`` -public struct PrecedenceGroupAssociativitySyntax: SyntaxProtocol, SyntaxHashable { +public struct PrecedenceGroupAssociativitySyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3422,7 +3422,7 @@ public struct PrecedenceGroupAssociativitySyntax: SyntaxProtocol, SyntaxHashable /// - `leftBrace`: `'{'` /// - `groupAttributes`: ``PrecedenceGroupAttributeListSyntax`` /// - `rightBrace`: `'}'` -public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3765,7 +3765,7 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``PrecedenceGroupNameListSyntax`` -public struct PrecedenceGroupNameSyntax: SyntaxProtocol, SyntaxHashable { +public struct PrecedenceGroupNameSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3895,7 +3895,7 @@ public struct PrecedenceGroupNameSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``PrecedenceGroupAttributeListSyntax`` -public struct PrecedenceGroupRelationSyntax: SyntaxProtocol, SyntaxHashable { +public struct PrecedenceGroupRelationSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4074,7 +4074,7 @@ public struct PrecedenceGroupRelationSyntax: SyntaxProtocol, SyntaxHashable { /// /// - `operator`: `` /// - `expression`: ``ExprSyntax`` -public struct PrefixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct PrefixOperatorExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4202,7 +4202,7 @@ public struct PrefixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``ProtocolDeclSyntax``.``ProtocolDeclSyntax/primaryAssociatedTypeClause`` -public struct PrimaryAssociatedTypeClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct PrimaryAssociatedTypeClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4381,7 +4381,7 @@ public struct PrimaryAssociatedTypeClauseSyntax: SyntaxProtocol, SyntaxHashable /// ### Contained in /// /// - ``PrimaryAssociatedTypeListSyntax`` -public struct PrimaryAssociatedTypeSyntax: SyntaxProtocol, SyntaxHashable { +public struct PrimaryAssociatedTypeSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4520,7 +4520,7 @@ public struct PrimaryAssociatedTypeSyntax: SyntaxProtocol, SyntaxHashable { /// - `inheritanceClause`: ``InheritanceClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `memberBlock`: ``MemberBlockSyntax`` -public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct ProtocolDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesQRS.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesQRS.swift index 48862ac4a0e..4e99dcf8b12 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesQRS.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesQRS.swift @@ -21,7 +21,7 @@ /// - `regex`: `` /// - `closingSlash`: `'/'` /// - `closingPounds`: ``? -public struct RegexLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct RegexLiteralExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -224,7 +224,7 @@ public struct RegexLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `body`: ``CodeBlockSyntax`` /// - `whileKeyword`: `'while'` /// - `condition`: ``ExprSyntax`` -public struct RepeatStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct RepeatStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -406,7 +406,7 @@ public struct RepeatStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// - ``FunctionSignatureSyntax``.``FunctionSignatureSyntax/returnClause`` /// - ``FunctionTypeSyntax``.``FunctionTypeSyntax/returnClause`` /// - ``SubscriptDeclSyntax``.``SubscriptDeclSyntax/returnClause`` -public struct ReturnClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct ReturnClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -529,7 +529,7 @@ public struct ReturnClauseSyntax: SyntaxProtocol, SyntaxHashable { /// /// - `returnKeyword`: `'return'` /// - `expression`: ``ExprSyntax``? -public struct ReturnStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct ReturnStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -657,7 +657,7 @@ public struct ReturnStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``GenericRequirementSyntax``.``GenericRequirementSyntax/requirement`` -public struct SameTypeRequirementSyntax: SyntaxProtocol, SyntaxHashable { +public struct SameTypeRequirementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -805,7 +805,7 @@ public struct SameTypeRequirementSyntax: SyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `elements`: ``ExprListSyntax`` -public struct SequenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct SequenceExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -924,7 +924,7 @@ public struct SequenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - ``AvailabilityLabeledArgumentSyntax``.``AvailabilityLabeledArgumentSyntax/value`` /// - ``PoundSourceLocationArgumentsSyntax``.``PoundSourceLocationArgumentsSyntax/fileName`` -public struct SimpleStringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct SimpleStringLiteralExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1105,7 +1105,7 @@ public struct SimpleStringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable /// /// - `someOrAnySpecifier`: (`'some'` | `'any'`) /// - `constraint`: ``TypeSyntax`` -public struct SomeOrAnyTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct SomeOrAnyTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1229,7 +1229,7 @@ public struct SomeOrAnyTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// - `shebang`: ``? /// - `statements`: ``CodeBlockItemListSyntax`` /// - `endOfFileToken`: `''` -public struct SourceFileSyntax: SyntaxProtocol, SyntaxHashable { +public struct SourceFileSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1414,7 +1414,7 @@ public struct SourceFileSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``SpecializeAttributeArgumentListSyntax`` -public struct SpecializeAvailabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct SpecializeAvailabilityArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1627,7 +1627,7 @@ public struct SpecializeAvailabilityArgumentSyntax: SyntaxProtocol, SyntaxHashab /// ### Contained in /// /// - ``SpecializeAttributeArgumentListSyntax`` -public struct SpecializeTargetFunctionArgumentSyntax: SyntaxProtocol, SyntaxHashable { +public struct SpecializeTargetFunctionArgumentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1824,7 +1824,7 @@ public struct SpecializeTargetFunctionArgumentSyntax: SyntaxProtocol, SyntaxHash /// - ``OriginallyDefinedInAttributeArgumentsSyntax``.``OriginallyDefinedInAttributeArgumentsSyntax/moduleName`` /// - ``UnavailableFromAsyncAttributeArgumentsSyntax``.``UnavailableFromAsyncAttributeArgumentsSyntax/message`` /// - ``UnderscorePrivateAttributeArgumentsSyntax``.``UnderscorePrivateAttributeArgumentsSyntax/filename`` -public struct StringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct StringLiteralExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2055,7 +2055,7 @@ public struct StringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - ``SimpleStringLiteralSegmentListSyntax`` /// - ``StringLiteralSegmentListSyntax`` -public struct StringSegmentSyntax: SyntaxProtocol, SyntaxHashable { +public struct StringSegmentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2204,7 +2204,7 @@ public struct StringSegmentSyntax: SyntaxProtocol, SyntaxHashable { /// - `inheritanceClause`: ``InheritanceClauseSyntax``? /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `memberBlock`: ``MemberBlockSyntax`` -public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct StructDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2555,7 +2555,7 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// - `rightSquare`: `']'` /// - `trailingClosure`: ``ClosureExprSyntax``? /// - `additionalTrailingClosures`: ``MultipleTrailingClosureElementListSyntax`` -public struct SubscriptCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct SubscriptCallExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2840,7 +2840,7 @@ public struct SubscriptCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `returnClause`: ``ReturnClauseSyntax`` /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? /// - `accessorBlock`: ``AccessorBlockSyntax``? -public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct SubscriptDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3174,7 +3174,7 @@ public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `superKeyword`: `'super'` -public struct SuperExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct SuperExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3259,7 +3259,7 @@ public struct SuperExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `withoutTilde`: `` /// - `type`: ``TypeSyntax`` -public struct SuppressedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct SuppressedTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3387,7 +3387,7 @@ public struct SuppressedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``SwitchCaseItemListSyntax`` -public struct SwitchCaseItemSyntax: SyntaxProtocol, SyntaxHashable { +public struct SwitchCaseItemSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3541,7 +3541,7 @@ public struct SwitchCaseItemSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``SwitchCaseSyntax``.``SwitchCaseSyntax/label`` -public struct SwitchCaseLabelSyntax: SyntaxProtocol, SyntaxHashable { +public struct SwitchCaseLabelSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3721,7 +3721,7 @@ public struct SwitchCaseLabelSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``SwitchCaseListSyntax`` -public struct SwitchCaseSyntax: SyntaxProtocol, SyntaxHashable { +public struct SwitchCaseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public enum Label: SyntaxChildChoices, SyntaxHashable { case `default`(SwitchDefaultLabelSyntax) case `case`(SwitchCaseLabelSyntax) @@ -3944,7 +3944,7 @@ public struct SwitchCaseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``SwitchCaseSyntax``.``SwitchCaseSyntax/label`` -public struct SwitchDefaultLabelSyntax: SyntaxProtocol, SyntaxHashable { +public struct SwitchDefaultLabelSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4070,7 +4070,7 @@ public struct SwitchDefaultLabelSyntax: SyntaxProtocol, SyntaxHashable { /// - `leftBrace`: `'{'` /// - `cases`: ``SwitchCaseListSyntax`` /// - `rightBrace`: `'}'` -public struct SwitchExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct SwitchExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesTUVWXYZ.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesTUVWXYZ.swift index 5d49af229c5..a323e1e2618 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesTUVWXYZ.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesTUVWXYZ.swift @@ -21,7 +21,7 @@ /// - `thenExpression`: ``ExprSyntax`` /// - `colon`: `':'` /// - `elseExpression`: ``ExprSyntax`` -public struct TernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct TernaryExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -222,7 +222,7 @@ public struct TernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `throwKeyword`: `'throw'` /// - `expression`: ``ExprSyntax`` -public struct ThrowStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct ThrowStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -346,7 +346,7 @@ public struct ThrowStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// - `tryKeyword`: `'try'` /// - `questionOrExclamationMark`: (`'?'` | `'!'`)? /// - `expression`: ``ExprSyntax`` -public struct TryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct TryExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -496,7 +496,7 @@ public struct TryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `leftParen`: `'('` /// - `elements`: ``LabeledExprListSyntax`` /// - `rightParen`: `')'` -public struct TupleExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct TupleExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -677,7 +677,7 @@ public struct TupleExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``TuplePatternElementListSyntax`` -public struct TuplePatternElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct TuplePatternElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -853,7 +853,7 @@ public struct TuplePatternElementSyntax: SyntaxProtocol, SyntaxHashable { /// - `leftParen`: `'('` /// - `elements`: ``TuplePatternElementListSyntax`` /// - `rightParen`: `')'` -public struct TuplePatternSyntax: PatternSyntaxProtocol, SyntaxHashable { +public struct TuplePatternSyntax: PatternSyntaxProtocol, LeafPatternSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1037,7 +1037,7 @@ public struct TuplePatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``TupleTypeElementListSyntax`` -public struct TupleTypeElementSyntax: SyntaxProtocol, SyntaxHashable { +public struct TupleTypeElementSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1291,7 +1291,7 @@ public struct TupleTypeElementSyntax: SyntaxProtocol, SyntaxHashable { /// - `leftParen`: `'('` /// - `elements`: ``TupleTypeElementListSyntax`` /// - `rightParen`: `')'` -public struct TupleTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { +public struct TupleTypeSyntax: TypeSyntaxProtocol, LeafTypeSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1471,7 +1471,7 @@ public struct TupleTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// - `genericParameterClause`: ``GenericParameterClauseSyntax``? /// - `initializer`: ``TypeInitializerClauseSyntax`` /// - `genericWhereClause`: ``GenericWhereClauseSyntax``? -public struct TypeAliasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct TypeAliasDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1788,7 +1788,7 @@ public struct TypeAliasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// - ``OptionalBindingConditionSyntax``.``OptionalBindingConditionSyntax/typeAnnotation`` /// - ``PatternBindingSyntax``.``PatternBindingSyntax/typeAnnotation`` /// - ``WildcardPatternSyntax``.``WildcardPatternSyntax/typeAnnotation`` -public struct TypeAnnotationSyntax: SyntaxProtocol, SyntaxHashable { +public struct TypeAnnotationSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -1917,7 +1917,7 @@ public struct TypeAnnotationSyntax: SyntaxProtocol, SyntaxHashable { /// - ``ArrowExprSyntax``.``ArrowExprSyntax/effectSpecifiers`` /// - ``ClosureSignatureSyntax``.``ClosureSignatureSyntax/effectSpecifiers`` /// - ``FunctionTypeSyntax``.``FunctionTypeSyntax/effectSpecifiers`` -public struct TypeEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { +public struct TypeEffectSpecifiersSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2039,7 +2039,7 @@ public struct TypeEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `type`: ``TypeSyntax`` -public struct TypeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct TypeExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2129,7 +2129,7 @@ public struct TypeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - ``AssociatedTypeDeclSyntax``.``AssociatedTypeDeclSyntax/initializer`` /// - ``TypeAliasDeclSyntax``.``TypeAliasDeclSyntax/initializer`` -public struct TypeInitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct TypeInitializerClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2259,7 +2259,7 @@ public struct TypeInitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct UnavailableFromAsyncAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct UnavailableFromAsyncAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2415,7 +2415,7 @@ public struct UnavailableFromAsyncAttributeArgumentsSyntax: SyntaxProtocol, Synt /// ### Contained in /// /// - ``AttributeSyntax``.``AttributeSyntax/arguments`` -public struct UnderscorePrivateAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { +public struct UnderscorePrivateAttributeArgumentsSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2564,7 +2564,7 @@ public struct UnderscorePrivateAttributeArgumentsSyntax: SyntaxProtocol, SyntaxH /// /// - `asKeyword`: `'as'` /// - `questionOrExclamationMark`: (`'?'` | `'!'`)? -public struct UnresolvedAsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct UnresolvedAsExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2686,7 +2686,7 @@ public struct UnresolvedAsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// ### Children /// /// - `isKeyword`: `'is'` -public struct UnresolvedIsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct UnresolvedIsExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2772,7 +2772,7 @@ public struct UnresolvedIsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// - `questionMark`: `'?'` /// - `thenExpression`: ``ExprSyntax`` /// - `colon`: `':'` -public struct UnresolvedTernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { +public struct UnresolvedTernaryExprSyntax: ExprSyntaxProtocol, LeafExprSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -2921,7 +2921,7 @@ public struct UnresolvedTernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// /// - `bindingSpecifier`: (`'let'` | `'var'` | `'inout'` | `'_mutating'` | `'_borrowing'` | `'_consuming'`) /// - `pattern`: ``PatternSyntax`` -public struct ValueBindingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { +public struct ValueBindingPatternSyntax: PatternSyntaxProtocol, LeafPatternSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3051,7 +3051,7 @@ public struct ValueBindingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// - `modifiers`: ``DeclModifierListSyntax`` /// - `bindingSpecifier`: (`'let'` | `'var'` | `'inout'` | `'_mutating'` | `'_borrowing'` | `'_consuming'`) /// - `bindings`: ``PatternBindingListSyntax`` -public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { +public struct VariableDeclSyntax: DeclSyntaxProtocol, LeafDeclSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3324,7 +3324,7 @@ public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``VersionComponentListSyntax`` -public struct VersionComponentSyntax: SyntaxProtocol, SyntaxHashable { +public struct VersionComponentSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3459,7 +3459,7 @@ public struct VersionComponentSyntax: SyntaxProtocol, SyntaxHashable { /// - ``AvailabilityLabeledArgumentSyntax``.``AvailabilityLabeledArgumentSyntax/value`` /// - ``CanImportVersionInfoSyntax``.``CanImportVersionInfoSyntax/version`` /// - ``PlatformVersionSyntax``.``PlatformVersionSyntax/version`` -public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { +public struct VersionTupleSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3618,7 +3618,7 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { /// - ``CatchItemSyntax``.``CatchItemSyntax/whereClause`` /// - ``ForStmtSyntax``.``ForStmtSyntax/whereClause`` /// - ``SwitchCaseItemSyntax``.``SwitchCaseItemSyntax/whereClause`` -public struct WhereClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct WhereClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3742,7 +3742,7 @@ public struct WhereClauseSyntax: SyntaxProtocol, SyntaxHashable { /// - `whileKeyword`: `'while'` /// - `conditions`: ``ConditionElementListSyntax`` /// - `body`: ``CodeBlockSyntax`` -public struct WhileStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct WhileStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -3917,7 +3917,7 @@ public struct WhileStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// /// - `wildcard`: `'_'` /// - `typeAnnotation`: ``TypeAnnotationSyntax``? -public struct WildcardPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { +public struct WildcardPatternSyntax: PatternSyntaxProtocol, LeafPatternSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4040,7 +4040,7 @@ public struct WildcardPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// /// - `yieldKeyword`: `'yield'` /// - `yieldedExpressions`: (``YieldedExpressionsClauseSyntax`` | ``ExprSyntax``) -public struct YieldStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { +public struct YieldStmtSyntax: StmtSyntaxProtocol, LeafStmtSyntaxNodeProtocol, SyntaxHashable { public enum YieldedExpressions: SyntaxChildChoices, SyntaxHashable { case `multiple`(YieldedExpressionsClauseSyntax) case `single`(ExprSyntax) @@ -4209,7 +4209,7 @@ public struct YieldStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``YieldedExpressionListSyntax`` -public struct YieldedExpressionSyntax: SyntaxProtocol, SyntaxHashable { +public struct YieldedExpressionSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { @@ -4337,7 +4337,7 @@ public struct YieldedExpressionSyntax: SyntaxProtocol, SyntaxHashable { /// ### Contained in /// /// - ``YieldStmtSyntax``.``YieldStmtSyntax/yieldedExpressions`` -public struct YieldedExpressionsClauseSyntax: SyntaxProtocol, SyntaxHashable { +public struct YieldedExpressionsClauseSyntax: SyntaxProtocol, LeafSyntaxNodeProtocol, SyntaxHashable { public let _syntaxNode: Syntax public init?(_ node: some SyntaxProtocol) { diff --git a/Tests/SwiftParserTest/Parser+EntryTests.swift b/Tests/SwiftParserTest/Parser+EntryTests.swift index 3a788c140bb..d8fca89b57d 100644 --- a/Tests/SwiftParserTest/Parser+EntryTests.swift +++ b/Tests/SwiftParserTest/Parser+EntryTests.swift @@ -18,7 +18,6 @@ public class EntryTests: ParserTestCase { func testTopLevelStringParse() throws { let source = "func test() {}" let tree = Parser.parse(source: source) - XCTAssert(tree.is(SourceFileSyntax.self)) XCTAssert(!tree.hasError) XCTAssertEqual(tree.description, source) } @@ -27,7 +26,6 @@ public class EntryTests: ParserTestCase { var source = "func test() {}" source.makeContiguousUTF8() let tree = source.withUTF8 { Parser.parse(source: $0) } - XCTAssert(tree.is(SourceFileSyntax.self)) XCTAssert(!tree.hasError) XCTAssertEqual(tree.description, source) } diff --git a/Tests/SwiftRefactorTest/ExpandEditorPlaceholdersTests.swift b/Tests/SwiftRefactorTest/ExpandEditorPlaceholdersTests.swift index 0f1ceb64945..813727a0c80 100644 --- a/Tests/SwiftRefactorTest/ExpandEditorPlaceholdersTests.swift +++ b/Tests/SwiftRefactorTest/ExpandEditorPlaceholdersTests.swift @@ -111,7 +111,7 @@ fileprivate func assertRefactorPlaceholderCall( ) throws { var parser = Parser(expr) let call = try XCTUnwrap(ExprSyntax.parse(from: &parser).as(FunctionCallExprSyntax.self), file: file, line: line) - let arg = try XCTUnwrap(call.arguments[call.arguments.index(at: placeholder)].as(LabeledExprSyntax.self), file: file, line: line) + let arg = call.arguments[call.arguments.index(at: placeholder)] let token: TokenSyntax = try XCTUnwrap(arg.expression.as(EditorPlaceholderExprSyntax.self), file: file, line: line).placeholder try assertRefactor(token, context: (), provider: ExpandEditorPlaceholders.self, expected: [SourceEdit.replace(call, with: expected)], file: file, line: line) @@ -126,7 +126,7 @@ fileprivate func assertRefactorPlaceholderToken( ) throws { var parser = Parser(expr) let call = try XCTUnwrap(ExprSyntax.parse(from: &parser).as(FunctionCallExprSyntax.self), file: file, line: line) - let arg = try XCTUnwrap(call.arguments[call.arguments.index(at: placeholder)].as(LabeledExprSyntax.self), file: file, line: line) + let arg = call.arguments[call.arguments.index(at: placeholder)] let token: TokenSyntax = try XCTUnwrap(arg.expression.as(EditorPlaceholderExprSyntax.self), file: file, line: line).placeholder try assertRefactor(token, context: (), provider: ExpandEditorPlaceholders.self, expected: [SourceEdit.replace(token, with: expected)], file: file, line: line) diff --git a/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift b/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift index ed48f878582..2881824af89 100644 --- a/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift +++ b/Tests/SwiftRefactorTest/ReformatIntegerLiteral.swift @@ -19,59 +19,48 @@ import _SwiftSyntaxTestSupport final class ReformatIntegerLiteralTest: XCTestCase { func testSeparatorPlacement() throws { - let tests = [ - ( - #line, literal: ExprSyntax("0b101010101").cast(IntegerLiteralExprSyntax.self), - expectation: ExprSyntax("0b1_0101_0101").cast(IntegerLiteralExprSyntax.self) - ), - ( - #line, literal: ExprSyntax("0xFFFFFFFF").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("0xFFFF_FFFF").cast(IntegerLiteralExprSyntax.self) - ), - (#line, literal: ExprSyntax("0xFFFFF").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("0xF_FFFF").cast(IntegerLiteralExprSyntax.self)), - (#line, literal: ExprSyntax("0o777777").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("0o777_777").cast(IntegerLiteralExprSyntax.self)), - ( - #line, literal: ExprSyntax("424242424242").cast(IntegerLiteralExprSyntax.self), - expectation: ExprSyntax("424_242_424_242").cast(IntegerLiteralExprSyntax.self) - ), - (#line, literal: ExprSyntax("100").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("100").cast(IntegerLiteralExprSyntax.self)), - ( - #line, literal: ExprSyntax("0xF_F_F_F_F_F_F_F").cast(IntegerLiteralExprSyntax.self), - expectation: ExprSyntax("0xFFFF_FFFF").cast(IntegerLiteralExprSyntax.self) - ), - (#line, literal: ExprSyntax("0xFF_F_FF").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("0xF_FFFF").cast(IntegerLiteralExprSyntax.self)), - (#line, literal: ExprSyntax("0o7_77777").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("0o777_777").cast(IntegerLiteralExprSyntax.self)), - ( - #line, literal: ExprSyntax("4_24242424242").cast(IntegerLiteralExprSyntax.self), - expectation: ExprSyntax("424_242_424_242").cast(IntegerLiteralExprSyntax.self) - ), + let tests: [(Int, literal: ExprSyntax, expectation: ExprSyntax)] = [ + (#line, literal: ExprSyntax("0b101010101"), expectation: ExprSyntax("0b1_0101_0101")), + (#line, literal: ExprSyntax("0xFFFFFFFF"), expectation: ExprSyntax("0xFFFF_FFFF")), + (#line, literal: ExprSyntax("0xFFFFF"), expectation: ExprSyntax("0xF_FFFF")), + (#line, literal: ExprSyntax("0o777777"), expectation: ExprSyntax("0o777_777")), + (#line, literal: ExprSyntax("424242424242"), expectation: ExprSyntax("424_242_424_242")), + (#line, literal: ExprSyntax("100"), expectation: ExprSyntax("100")), + (#line, literal: ExprSyntax("0xF_F_F_F_F_F_F_F"), expectation: ExprSyntax("0xFFFF_FFFF")), + (#line, literal: ExprSyntax("0xFF_F_FF"), expectation: ExprSyntax("0xF_FFFF")), + (#line, literal: ExprSyntax("0o7_77777"), expectation: ExprSyntax("0o777_777")), + (#line, literal: ExprSyntax("4_24242424242"), expectation: ExprSyntax("424_242_424_242")), ] for (line, literal, expectation) in tests { - try assertRefactor(literal, context: (), provider: AddSeparatorsToIntegerLiteral.self, expected: expectation, line: UInt(line)) + try assertRefactor( + literal.cast(IntegerLiteralExprSyntax.self), + context: (), + provider: AddSeparatorsToIntegerLiteral.self, + expected: expectation.cast(IntegerLiteralExprSyntax.self), + line: UInt(line) + ) } } func testSeparatorRemoval() throws { - let tests = [ - ( - #line, literal: ExprSyntax("0b1_0_1_0_1_0_1_0_1").cast(IntegerLiteralExprSyntax.self), - expectation: ExprSyntax("0b101010101").cast(IntegerLiteralExprSyntax.self) - ), - ( - #line, literal: ExprSyntax("0xFFF_F_FFFF").cast(IntegerLiteralExprSyntax.self), - expectation: ExprSyntax("0xFFFFFFFF").cast(IntegerLiteralExprSyntax.self) - ), - (#line, literal: ExprSyntax("0xFF_FFF").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("0xFFFFF").cast(IntegerLiteralExprSyntax.self)), - (#line, literal: ExprSyntax("0o777_777").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("0o777777").cast(IntegerLiteralExprSyntax.self)), - ( - #line, literal: ExprSyntax("424_242_424_242").cast(IntegerLiteralExprSyntax.self), - expectation: ExprSyntax("424242424242").cast(IntegerLiteralExprSyntax.self) - ), - (#line, literal: ExprSyntax("100").cast(IntegerLiteralExprSyntax.self), expectation: ExprSyntax("100").cast(IntegerLiteralExprSyntax.self)), + let tests: [(Int, literal: ExprSyntax, expectation: ExprSyntax)] = [ + (#line, literal: ExprSyntax("0b1_0_1_0_1_0_1_0_1"), expectation: ExprSyntax("0b101010101")), + (#line, literal: ExprSyntax("0xFFF_F_FFFF"), expectation: ExprSyntax("0xFFFFFFFF")), + (#line, literal: ExprSyntax("0xFF_FFF"), expectation: ExprSyntax("0xFFFFF")), + (#line, literal: ExprSyntax("0o777_777"), expectation: ExprSyntax("0o777777")), + (#line, literal: ExprSyntax("424_242_424_242"), expectation: ExprSyntax("424242424242")), + (#line, literal: ExprSyntax("100"), expectation: ExprSyntax("100")), ] for (line, literal, expectation) in tests { - try assertRefactor(literal, context: (), provider: RemoveSeparatorsFromIntegerLiteral.self, expected: expectation, line: UInt(line)) + try assertRefactor( + literal.cast(IntegerLiteralExprSyntax.self), + context: (), + provider: RemoveSeparatorsFromIntegerLiteral.self, + expected: expectation.cast(IntegerLiteralExprSyntax.self), + line: UInt(line) + ) } } } diff --git a/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift b/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift index e378e3826c6..4e6ce5428e0 100644 --- a/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/BreakStmtSyntaxTests.swift @@ -17,7 +17,7 @@ import SwiftSyntaxBuilder final class BreakStmtSyntaxTests: XCTestCase { func testBreakStmtSyntax() { let testCases: [UInt: (StmtSyntax, String)] = [ - #line: (BreakStmtSyntax().as(StmtSyntax.self)!, "break"), + #line: (StmtSyntax(BreakStmtSyntax()), "break"), #line: (StmtSyntax("break"), "break"), ] diff --git a/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift b/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift index 5ec8234107c..9b6dc2eb893 100644 --- a/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift @@ -95,7 +95,6 @@ final class StringInterpolationTests: XCTestCase { func testAttributeInterpolation() { let attrSyntax: AttributeSyntax = "@discardableResult" - XCTAssertTrue(attrSyntax.is(AttributeSyntax.self)) XCTAssertEqual(attrSyntax.description, "@discardableResult") } @@ -383,7 +382,6 @@ final class StringInterpolationTests: XCTestCase { _storage = newValue } """ - XCTAssertTrue(setter.is(AccessorDeclSyntax.self)) assertStringsEqualWithDiff( setter.description, """ @@ -432,7 +430,6 @@ final class StringInterpolationTests: XCTestCase { } """ - XCTAssertTrue(codeBlockItem.is(CodeBlockItemSyntax.self)) assertStringsEqualWithDiff( codeBlockItem.description, """ diff --git a/Tests/SwiftSyntaxMacroExpansionTest/CodeItemMacroTests.swift b/Tests/SwiftSyntaxMacroExpansionTest/CodeItemMacroTests.swift index 6a29414859a..1103bb51236 100644 --- a/Tests/SwiftSyntaxMacroExpansionTest/CodeItemMacroTests.swift +++ b/Tests/SwiftSyntaxMacroExpansionTest/CodeItemMacroTests.swift @@ -56,9 +56,7 @@ final class CodeItemMacroTests: XCTestCase { } let errorThrower = node.trailingClosure let identifiers = try node.argumentList.map { argument in - guard let tupleElement = argument.as(LabeledExprSyntax.self), - let declReferenceExpr = tupleElement.expression.as(DeclReferenceExprSyntax.self) - else { + guard let declReferenceExpr = argument.expression.as(DeclReferenceExprSyntax.self) else { throw MacroExpansionErrorMessage("Arguments must be identifiers") } return declReferenceExpr.baseName