From fca27eb30c4e8c6b1dcf3bf4babfefcb8d382218 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 5 Apr 2023 15:54:26 -0700 Subject: [PATCH 01/22] Merge pull request #1490 from ahoppen/ahoppen/trivia-invalid-utf8 Document that `Trivia` cannot represent invalid UTF-8 --- Sources/SwiftSyntax/Syntax.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/SwiftSyntax/Syntax.swift b/Sources/SwiftSyntax/Syntax.swift index c648c486228..3b90ca08be8 100644 --- a/Sources/SwiftSyntax/Syntax.swift +++ b/Sources/SwiftSyntax/Syntax.swift @@ -471,6 +471,12 @@ public extension SyntaxProtocol { /// The leading trivia of this syntax node. Leading trivia is attached to /// the first token syntax contained by this node. Without such token, this /// property will return nil. + /// + /// Note: `Trivia` is not able to represent invalid UTF-8 sequences. To get + /// the leading trivia text including all invalid UTF-8 sequences, use + /// ``` + /// node.syntaxTextBytes.prefix(self.leadingTriviaLength.utf8Length) + /// ``` var leadingTrivia: Trivia { get { return raw.formLeadingTrivia() @@ -483,6 +489,12 @@ public extension SyntaxProtocol { /// The trailing trivia of this syntax node. Trailing trivia is attached to /// the last token syntax contained by this node. Without such token, this /// property will return nil. + /// + /// Note: `Trivia` is not able to represent invalid UTF-8 sequences. To get + /// the leading trivia text including all invalid UTF-8 sequences, use + /// ``` + /// node.syntaxTextBytes[(node.byteSize - node.trailingTriviaLength.utf8Length)...] + /// ``` var trailingTrivia: Trivia { get { return raw.formTrailingTrivia() From 2772089b839288673f4bc62e6f32b99c88916ad3 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 6 Apr 2023 13:16:58 -0700 Subject: [PATCH 02/22] Merge pull request #1497 from andrewjl/andrewjl/fix-xctskip-warning fix XCTSkip warning --- Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift b/Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift index bf0b84c332d..fdbbee31f3b 100644 --- a/Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift +++ b/Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift @@ -29,7 +29,7 @@ public class IncrementalParsingTests: XCTestCase { } public func testReusedNode() throws { - throw XCTSkip("Swift parser does not handle node reuse yet") + try XCTSkipIf(true, "Swift parser does not handle node reuse yet") let original = "struct A {}\nstruct B {}\n" let step: (String, (Int, Int, String)) = From f89e946d083fe584125f54e25148ddafc0b2122d Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Tue, 11 Apr 2023 16:04:05 -0700 Subject: [PATCH 03/22] Merge pull request #1482 from ahoppen/ahoppen/swiftsyntax-public-api Audit the public API of the SwiftSyntax module --- .../SyntaxSupport/Classification.swift | 11 +- .../GenerateSwiftSyntax.swift | 8 +- .../basicformat/BasicFormatFile.swift | 26 +- .../ideutils/SyntaxClassificationFile.swift | 32 +- .../swiftparser/IsLexerClassifiedFile.swift | 77 + .../TokenSpecStaticMembersFile.swift | 2 +- .../ChildNameForDiagnosticsFile.swift | 56 + .../SyntaxKindNameForDiagnosticsFile.swift | 44 + .../TokenNameForDiagnosticsFile.swift | 39 + .../templates/swiftsyntax/KeywordFile.swift | 28 - .../templates/swiftsyntax/MiscFile.swift | 72 - .../swiftsyntax/SyntaxBaseNodesFile.swift | 29 +- .../swiftsyntax/SyntaxCollectionsFile.swift | 13 +- .../swiftsyntax/SyntaxKindFile.swift | 14 + .../swiftsyntax/SyntaxNodeFile.swift | 21 - .../templates/swiftsyntax/TokenKindFile.swift | 45 +- .../AddOneToIntegerLiterals.swift | 2 +- Sources/IDEUtils/SyntaxClassifier.swift | 23 +- .../generated/SyntaxClassification.swift | 82 +- .../generated/BasicFormat.swift | 22 +- Sources/SwiftParser/CMakeLists.txt | 1 + Sources/SwiftParser/Lookahead.swift | 1 + Sources/SwiftParser/TokenPrecedence.swift | 2 +- Sources/SwiftParser/TokenSpec.swift | 2 +- .../generated/IsLexerClassified.swift | 164 ++ .../generated/TokenSpecStaticMembers.swift | 2 +- Sources/SwiftParserDiagnostics/CMakeLists.txt | 7 +- .../LexerDiagnosticMessages.swift | 2 +- .../MissingNodesError.swift | 2 +- .../MissingTokenError.swift | 4 +- .../ParseDiagnosticsGenerator.swift | 4 +- .../generated/ChildNameForDiagnostics.swift | 377 +++ .../SyntaxKindNameForDiagnostics.swift | 398 +++ .../generated/TokenNameForDiagnostics.swift | 120 + .../AddSeparatorsToIntegerLiteral.swift | 2 +- .../FormatRawStringLiteral.swift | 8 +- .../RemoveSeparatorsFromIntegerLiteral.swift | 2 +- Sources/SwiftSyntax/CMakeLists.txt | 1 - Sources/SwiftSyntax/SourcePresence.swift | 6 +- Sources/SwiftSyntax/Syntax.swift | 67 +- Sources/SwiftSyntax/SyntaxArena.swift | 4 +- Sources/SwiftSyntax/SyntaxChildren.swift | 4 +- Sources/SwiftSyntax/TokenSyntax.swift | 28 +- Sources/SwiftSyntax/generated/Keyword.swift | 122 - Sources/SwiftSyntax/generated/Misc.swift | 1372 ---------- .../generated/SyntaxBaseNodes.swift | 295 +- .../generated/SyntaxCollections.swift | 423 +-- .../SwiftSyntax/generated/SyntaxKind.swift | 541 ++++ Sources/SwiftSyntax/generated/TokenKind.swift | 212 +- .../syntaxNodes/SyntaxDeclNodes.swift | 796 ------ .../syntaxNodes/SyntaxExprNodes.swift | 928 ------- .../generated/syntaxNodes/SyntaxNodes.swift | 2406 +---------------- .../syntaxNodes/SyntaxPatternNodes.swift | 107 - .../syntaxNodes/SyntaxStmtNodes.swift | 316 --- .../syntaxNodes/SyntaxTypeNodes.swift | 321 --- .../ConvenienceInitializers.swift | 2 +- .../SyntaxComparison.swift | 2 +- .../SyntaxProtocol+Initializer.swift | 2 +- Tests/SwiftSyntaxTest/RawSyntaxTests.swift | 2 +- .../SyntaxCollectionsTests.swift | 4 +- utils/group.json | 1 - 61 files changed, 2371 insertions(+), 7335 deletions(-) create mode 100644 CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/IsLexerClassifiedFile.swift create mode 100644 CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/ChildNameForDiagnosticsFile.swift create mode 100644 CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/SyntaxKindNameForDiagnosticsFile.swift create mode 100644 CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/TokenNameForDiagnosticsFile.swift delete mode 100644 CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/MiscFile.swift create mode 100644 Sources/SwiftParser/generated/IsLexerClassified.swift create mode 100644 Sources/SwiftParserDiagnostics/generated/ChildNameForDiagnostics.swift create mode 100644 Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift create mode 100644 Sources/SwiftParserDiagnostics/generated/TokenNameForDiagnostics.swift delete mode 100644 Sources/SwiftSyntax/generated/Misc.swift diff --git a/CodeGeneration/Sources/SyntaxSupport/Classification.swift b/CodeGeneration/Sources/SyntaxSupport/Classification.swift index 0b1f5337734..1e04d5fe6e0 100644 --- a/CodeGeneration/Sources/SyntaxSupport/Classification.swift +++ b/CodeGeneration/Sources/SyntaxSupport/Classification.swift @@ -28,16 +28,15 @@ public class SyntaxClassification { public class ChildClassification { public let parent: Node public let childIndex: Int - public let isToken: Bool - public let classification: SyntaxClassification? - public let force: Bool + public let child: Child + public var isToken: Bool { child.isToken } + public var classification: SyntaxClassification? { child.classification } + public var force: Bool { child.forceClassification } public init(node: Node, childIndex: Int, child: Child) { self.parent = node self.childIndex = childIndex - self.isToken = child.syntaxKind.hasSuffix("Token") - self.classification = child.classification - self.force = child.forceClassification + self.child = child } } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift b/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift index fb56944b477..3c32c01409a 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift @@ -22,6 +22,7 @@ private let generatedDirName = "generated" private let swiftBasicFormatGeneratedDir = ["SwiftBasicFormat", generatedDirName] private let ideUtilsGeneratedDir = ["IDEUtils", generatedDirName] private let swiftParserGeneratedDir = ["SwiftParser", generatedDirName] +private let swiftParserDiagnosticsGeneratedDir = ["SwiftParserDiagnostics", generatedDirName] private let swiftSyntaxGeneratedDir = ["SwiftSyntax", generatedDirName] private let swiftSyntaxBuilderGeneratedDir = ["SwiftSyntaxBuilder", generatedDirName] private let BASE_KIND_FILES = [ @@ -86,13 +87,18 @@ struct GenerateSwiftSyntax: ParsableCommand { // SwiftParser GeneratedFileSpec(swiftParserGeneratedDir + ["DeclarationModifier.swift"], declarationModifierFile), + GeneratedFileSpec(swiftParserGeneratedDir + ["IsLexerClassified.swift"], isLexerClassifiedFile), GeneratedFileSpec(swiftParserGeneratedDir + ["Parser+Entry.swift"], parserEntryFile), GeneratedFileSpec(swiftParserGeneratedDir + ["TokenSpecStaticMembers.swift"], tokenSpecStaticMembersFile), GeneratedFileSpec(swiftParserGeneratedDir + ["TypeAttribute.swift"], typeAttributeFile), + // SwiftParserDiagnostics + GeneratedFileSpec(swiftParserDiagnosticsGeneratedDir + ["ChildNameForDiagnostics.swift"], childNameForDiagnosticFile), + GeneratedFileSpec(swiftParserDiagnosticsGeneratedDir + ["SyntaxKindNameForDiagnostics.swift"], syntaxKindNameForDiagnosticFile), + GeneratedFileSpec(swiftParserDiagnosticsGeneratedDir + ["TokenNameForDiagnostics.swift"], tokenNameForDiagnosticFile), + // SwiftSyntax GeneratedFileSpec(swiftSyntaxGeneratedDir + ["Keyword.swift"], keywordFile), - GeneratedFileSpec(swiftSyntaxGeneratedDir + ["Misc.swift"], miscFile), GeneratedFileSpec(swiftSyntaxGeneratedDir + ["raw", "RawSyntaxNodes.swift"], rawSyntaxNodesFile), GeneratedFileSpec(swiftSyntaxGeneratedDir + ["raw", "RawSyntaxValidation.swift"], rawSyntaxValidationFile), GeneratedFileSpec(swiftSyntaxGeneratedDir + ["SyntaxAnyVisitor.swift"], syntaxAnyVisitorFile), diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift index 3d057088086..05eeabd1119 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift @@ -62,11 +62,11 @@ let basicFormatFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { DeclSyntax( """ open override func visitPre(_ node: Syntax) { - if let keyPath = getKeyPath(node), shouldIndent(keyPath) { + if let keyPath = node.keyPathInParent, shouldIndent(keyPath) { indentationLevel += 1 } if let parent = node.parent, childrenSeparatedByNewline(parent) { - putNextTokenOnNewLine = true && node.previousToken != nil + putNextTokenOnNewLine = true && node.previousToken(viewMode: .sourceAccurate) != nil } } """ @@ -74,7 +74,7 @@ let basicFormatFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { DeclSyntax( """ open override func visitPost(_ node: Syntax) { - if let keyPath = getKeyPath(node), shouldIndent(keyPath) { + if let keyPath = node.keyPathInParent, shouldIndent(keyPath) { indentationLevel -= 1 } } @@ -92,7 +92,7 @@ let basicFormatFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { if requiresTrailingSpace(node) && trailingTrivia.isEmpty { trailingTrivia += .space } - if let keyPath = getKeyPath(Syntax(node)), requiresLeadingNewline(keyPath), !(leadingTrivia.first?.isNewline ?? false), !shouldOmitNewline(node) { + if let keyPath = node.keyPathInParent, requiresLeadingNewline(keyPath), !(leadingTrivia.first?.isNewline ?? false), !shouldOmitNewline(node) { leadingTrivia = .newline + leadingTrivia } var isOnNewline: Bool = (lastRewrittenToken?.trailingTrivia.pieces.last?.isNewline == true) @@ -206,7 +206,7 @@ let basicFormatFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { try FunctionDeclSyntax("open func requiresLeadingSpace(_ token: TokenSyntax) -> Bool") { StmtSyntax( """ - if let keyPath = getKeyPath(token), let requiresLeadingSpace = requiresLeadingSpace(keyPath) { + if let keyPath = token.keyPathInParent, let requiresLeadingSpace = requiresLeadingSpace(keyPath) { return requiresLeadingSpace } """ @@ -268,7 +268,7 @@ let basicFormatFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { try FunctionDeclSyntax("open func requiresTrailingSpace(_ token: TokenSyntax) -> Bool") { StmtSyntax( """ - if let keyPath = getKeyPath(token), let requiresTrailingSpace = requiresTrailingSpace(keyPath) { + if let keyPath = token.keyPathInParent, let requiresTrailingSpace = requiresTrailingSpace(keyPath) { return requiresTrailingSpace } """ @@ -311,19 +311,5 @@ let basicFormatFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { } } } - - DeclSyntax( - """ - private func getKeyPath(_ node: T) -> AnyKeyPath? { - guard let parent = node.parent else { - return nil - } - guard case .layout(let childrenKeyPaths) = parent.kind.syntaxNodeType.structure else { - return nil - } - return childrenKeyPaths[node.indexInParent] - } - """ - ) } } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/ideutils/SyntaxClassificationFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/ideutils/SyntaxClassificationFile.swift index 1db6948b9f9..92d3b5c60fb 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/ideutils/SyntaxClassificationFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/ideutils/SyntaxClassificationFile.swift @@ -53,35 +53,17 @@ let syntaxClassificationFile = SourceFileSyntax(leadingTrivia: copyrightHeader) /// - childKind: The node syntax kind. /// - Returns: A pair of classification and whether it is "forced", or nil if /// no classification is attached. - internal static func classify( - parentKind: SyntaxKind, indexInParent: Int, childKind: SyntaxKind - ) -> (SyntaxClassification, Bool)? + internal static func classify(_ keyPath: AnyKeyPath) -> (SyntaxClassification, Bool)? """ ) { - try IfExprSyntax( - """ - // Separate checks for token nodes (most common checks) versus checks for layout nodes. - if childKind == .token - """ - ) { - try SwitchExprSyntax("switch (parentKind, indexInParent)") { - for childClassification in node_child_classifications where childClassification.isToken { - SwitchCaseSyntax("case (.\(raw: childClassification.parent.swiftSyntaxKind), \(raw: childClassification.childIndex)):") { - StmtSyntax("return (.\(raw: childClassification.classification!.swiftName), \(raw: childClassification.force))") - } + try SwitchExprSyntax("switch keyPath") { + for childClassification in node_child_classifications { + SwitchCaseSyntax("case \\\(raw: childClassification.parent.type.syntaxBaseName).\(raw: childClassification.child.swiftName):") { + StmtSyntax("return (.\(raw: childClassification.classification!.swiftName), \(raw: childClassification.force))") } - - SwitchCaseSyntax("default: return nil") } - } else: { - try SwitchExprSyntax("switch (parentKind, indexInParent)") { - for childClassification in node_child_classifications where !childClassification.isToken { - SwitchCaseSyntax("case (.\(raw: childClassification.parent.swiftSyntaxKind), \(raw: childClassification.childIndex)):") { - StmtSyntax("return (.\(raw: childClassification.classification!.swiftName), \(raw: childClassification.force))") - } - } - - SwitchCaseSyntax("default: return nil") + SwitchCaseSyntax("default:") { + StmtSyntax("return nil") } } } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/IsLexerClassifiedFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/IsLexerClassifiedFile.swift new file mode 100644 index 00000000000..af92b5b11ed --- /dev/null +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/IsLexerClassifiedFile.swift @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax +import SwiftSyntaxBuilder +import SyntaxSupport +import Utils + +let isLexerClassifiedFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { + DeclSyntax("import SwiftSyntax") + + try! ExtensionDeclSyntax( + """ + extension Keyword + """ + ) { + try! VariableDeclSyntax( + """ + /// Whether the token kind is switched from being an identifier to being a keyword in the lexer. + /// This is true for keywords that used to be considered non-contextual. + var isLexerClassified: Bool + """ + ) { + try! SwitchExprSyntax("switch self") { + for keyword in KEYWORDS { + if keyword.isLexerClassified { + SwitchCaseSyntax("case .\(raw: keyword.escapedName): return true") + } + } + SwitchCaseSyntax("default: return false") + } + } + } + + try! ExtensionDeclSyntax( + """ + extension TokenKind + """ + ) { + try! VariableDeclSyntax( + """ + /// Returns `true` if the token is a Swift keyword. + /// + /// Keywords are reserved unconditionally for use by Swift and may not + /// appear as identifiers in any position without being escaped. For example, + /// `class`, `func`, or `import`. + public var isLexerClassifiedKeyword: Bool + """ + ) { + try! SwitchExprSyntax("switch self") { + SwitchCaseSyntax("case .eof:") { + StmtSyntax("return false") + } + + for token in SYNTAX_TOKENS where token.isKeyword { + SwitchCaseSyntax("case .\(raw: token.swiftKind):") { + StmtSyntax("return true") + } + } + + SwitchCaseSyntax("case .keyword(let keyword):") { + StmtSyntax("return keyword.isLexerClassified") + } + SwitchCaseSyntax("default: return false") + } + } + } +} diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/TokenSpecStaticMembersFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/TokenSpecStaticMembersFile.swift index 6ade244e5ac..971ec7c3f03 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/TokenSpecStaticMembersFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/TokenSpecStaticMembersFile.swift @@ -16,7 +16,7 @@ import SyntaxSupport import Utils let tokenSpecStaticMembersFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { - DeclSyntax("import SwiftSyntax") + DeclSyntax("@_spi(RawSyntax) import SwiftSyntax") try! ExtensionDeclSyntax("extension TokenSpec") { DeclSyntax("static var eof: TokenSpec { return TokenSpec(.eof) }") diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/ChildNameForDiagnosticsFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/ChildNameForDiagnosticsFile.swift new file mode 100644 index 00000000000..b0de7450f29 --- /dev/null +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/ChildNameForDiagnosticsFile.swift @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax +import SwiftSyntaxBuilder +import SyntaxSupport +import Utils + +let childNameForDiagnosticFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { + DeclSyntax("import SwiftSyntax") + + try! FunctionDeclSyntax( + "private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String?" + ) { + try! SwitchExprSyntax("switch keyPath") { + for node in NON_BASE_SYNTAX_NODES where !node.isSyntaxCollection { + for child in node.children { + if let nameForDiagnostics = child.nameForDiagnostics { + SwitchCaseSyntax("case \\\(raw: node.type.syntaxBaseName).\(raw: child.swiftName):") { + StmtSyntax(#"return "\#(raw: nameForDiagnostics)""#) + } + } + } + } + SwitchCaseSyntax( + """ + default: + return nil + """ + ) + } + } + + DeclSyntax( + """ + extension SyntaxProtocol { + var childNameInParent: String? { + guard let keyPath = self.keyPathInParent else { + return nil + } + return childNameForDiagnostics(keyPath) + } + } + """ + ) + +} diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/SyntaxKindNameForDiagnosticsFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/SyntaxKindNameForDiagnosticsFile.swift new file mode 100644 index 00000000000..fefa05cc789 --- /dev/null +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/SyntaxKindNameForDiagnosticsFile.swift @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax +import SwiftSyntaxBuilder +import SyntaxSupport +import Utils + +let syntaxKindNameForDiagnosticFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { + DeclSyntax("import SwiftSyntax") + + try! ExtensionDeclSyntax("extension SyntaxKind") { + try VariableDeclSyntax("var nameForDiagnostics: String?") { + try SwitchExprSyntax("switch self") { + SwitchCaseSyntax("case .token:") { + StmtSyntax(#"return "token""#) + } + + for node in NON_BASE_SYNTAX_NODES { + if let nameForDiagnostics = node.nameForDiagnostics { + SwitchCaseSyntax("case .\(raw: node.swiftSyntaxKind):") { + StmtSyntax("return \"\(raw: nameForDiagnostics)\"") + } + } + } + SwitchCaseSyntax( + """ + default: + return nil + """ + ) + } + } + } +} diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/TokenNameForDiagnosticsFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/TokenNameForDiagnosticsFile.swift new file mode 100644 index 00000000000..0f09ee1d5ec --- /dev/null +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparserdiagnostics/TokenNameForDiagnosticsFile.swift @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax +import SwiftSyntaxBuilder +import SyntaxSupport +import Utils + +let tokenNameForDiagnosticFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { + DeclSyntax("@_spi(RawSyntax) import SwiftSyntax") + + try! ExtensionDeclSyntax("extension TokenKind") { + try! VariableDeclSyntax("var nameForDiagnostics: String") { + try! SwitchExprSyntax("switch self") { + SwitchCaseSyntax("case .eof:") { + StmtSyntax(#"return "end of file""#) + } + + for token in SYNTAX_TOKENS where token.swiftKind != "keyword" { + SwitchCaseSyntax("case .\(raw: token.swiftKind):") { + StmtSyntax("return #\"\(raw: token.nameForDiagnostics)\"#") + } + } + SwitchCaseSyntax("case .keyword(let keyword):") { + StmtSyntax("return String(syntaxText: keyword.defaultText)") + } + } + } + } +} diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/KeywordFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/KeywordFile.swift index 2a8b04d14ca..3b94cc4a46e 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/KeywordFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/KeywordFile.swift @@ -22,17 +22,6 @@ let lookupTable = ArrayExprSyntax(leftSquare: .leftSquareBracketToken(trailingTr } let keywordFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { - DeclSyntax( - """ - /// Make `StaticString` equatable so we can use it as the raw value for Keyword. - extension StaticString: Equatable { - public static func == (lhs: StaticString, rhs: StaticString) -> Bool { - return SyntaxText(lhs) == SyntaxText(rhs) - } - } - """ - ) - try! EnumDeclSyntax( """ @frozen // FIXME: Not actually stable, works around a miscompile @@ -61,23 +50,6 @@ let keywordFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { } } - try! VariableDeclSyntax( - """ - /// Whether the token kind is switched from being an identifier to being a keyword in the lexer. - /// This is true for keywords that used to be considered non-contextual. - public var isLexerClassified: Bool - """ - ) { - try! SwitchExprSyntax("switch self") { - for keyword in KEYWORDS { - if keyword.isLexerClassified { - SwitchCaseSyntax("case .\(raw: keyword.escapedName): return true") - } - } - SwitchCaseSyntax("default: return false") - } - } - DeclSyntax( """ /// This is really unfortunate. Really, we should have a `switch` in diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/MiscFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/MiscFile.swift deleted file mode 100644 index 795eaeddb1f..00000000000 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/MiscFile.swift +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -import SwiftSyntax -import SwiftSyntaxBuilder -import SyntaxSupport -import Utils - -let miscFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { - try! ExtensionDeclSyntax("extension Syntax") { - try VariableDeclSyntax("public static var structure: SyntaxNodeStructure") { - let choices = ArrayExprSyntax { - ArrayElementSyntax( - leadingTrivia: .newline, - expression: ExprSyntax(".node(TokenSyntax.self)") - ) - - for node in NON_BASE_SYNTAX_NODES { - ArrayElementSyntax( - leadingTrivia: .newline, - expression: ExprSyntax(".node(\(raw: node.name).self)") - ) - } - } - - StmtSyntax("return .choices(\(choices))") - } - } - - try! ExtensionDeclSyntax("extension SyntaxKind") { - try VariableDeclSyntax("public var syntaxNodeType: SyntaxProtocol.Type") { - try SwitchExprSyntax("switch self") { - SwitchCaseSyntax("case .token:") { - StmtSyntax("return TokenSyntax.self") - } - - for node in NON_BASE_SYNTAX_NODES { - SwitchCaseSyntax("case .\(raw: node.swiftSyntaxKind):") { - StmtSyntax("return \(raw: node.name).self") - } - } - } - } - - try VariableDeclSyntax("public var nameForDiagnostics: String?") { - try SwitchExprSyntax("switch self") { - SwitchCaseSyntax("case .token:") { - StmtSyntax(#"return "token""#) - } - - for node in NON_BASE_SYNTAX_NODES { - SwitchCaseSyntax("case .\(raw: node.swiftSyntaxKind):") { - if let nameForDiagnostics = node.nameForDiagnostics { - StmtSyntax("return \"\(raw: nameForDiagnostics)\"") - } else { - StmtSyntax("return nil") - } - } - } - } - } - } -} diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift index 5639dba947f..f441aa96fdc 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift @@ -232,14 +232,6 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { StmtSyntax("return .choices(\(choices))") } - - DeclSyntax( - """ - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return Syntax(self).childNameForDiagnostics(index) - } - """ - ) } DeclSyntax( @@ -254,4 +246,25 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { """ ) } + + try! ExtensionDeclSyntax("extension Syntax") { + try VariableDeclSyntax("public static var structure: SyntaxNodeStructure") { + let choices = ArrayExprSyntax { + ArrayElementSyntax( + leadingTrivia: .newline, + expression: ExprSyntax(".node(TokenSyntax.self)") + ) + + for node in NON_BASE_SYNTAX_NODES { + ArrayElementSyntax( + leadingTrivia: .newline, + expression: ExprSyntax(".node(\(raw: node.name).self)") + ) + } + } + + StmtSyntax("return .choices(\(choices))") + } + } + } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift index c38b9fd7aa5..35308524513 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift @@ -136,8 +136,7 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { DeclSyntax( """ - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } """ @@ -180,7 +179,7 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { DeclSyntax( """ /// The number of elements, `present` or `missing`, in this collection. - public var count: Int { return raw.layoutView!.children.count } + public var count: Int { return layoutView.children.count } """ ) @@ -314,14 +313,6 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { } """ ) - - DeclSyntax( - """ - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } - """ - ) } try! ExtensionDeclSyntax( diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxKindFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxKindFile.swift index 9932d6adbda..ab780c870fd 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxKindFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxKindFile.swift @@ -55,5 +55,19 @@ let syntaxKindFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { } } } + + try VariableDeclSyntax("public var syntaxNodeType: SyntaxProtocol.Type") { + try SwitchExprSyntax("switch self") { + SwitchCaseSyntax("case .token:") { + StmtSyntax("return TokenSyntax.self") + } + + for node in NON_BASE_SYNTAX_NODES { + SwitchCaseSyntax("case .\(raw: node.swiftSyntaxKind):") { + StmtSyntax("return \(raw: node.name).self") + } + } + } + } } } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift index 611db94870d..c0f00930116 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift @@ -258,27 +258,6 @@ func syntaxNode(emitKind: String) -> SourceFileSyntax { StmtSyntax("return .layout(\(layout))") } - - try! FunctionDeclSyntax("public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String?") { - try! SwitchExprSyntax("switch index.data?.indexInParent") { - for (index, child) in node.children.enumerated() { - SwitchCaseSyntax("case \(raw: index):") { - if let nameForDiagnostics = child.nameForDiagnostics { - StmtSyntax(#"return "\#(raw: nameForDiagnostics)""#) - } else { - StmtSyntax("return nil") - } - } - } - - SwitchCaseSyntax( - """ - default: - fatalError("Invalid index") - """ - ) - } - } } try! ExtensionDeclSyntax("extension \(raw: node.name): CustomReflectable") { diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/TokenKindFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/TokenKindFile.swift index f2d3cba606a..3b9fb00cf0c 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/TokenKindFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/TokenKindFile.swift @@ -96,50 +96,6 @@ let tokenKindFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { } } - try! VariableDeclSyntax("public var nameForDiagnostics: String") { - try! SwitchExprSyntax("switch self") { - SwitchCaseSyntax("case .eof:") { - StmtSyntax(#"return "end of file""#) - } - - for token in SYNTAX_TOKENS where token.swiftKind != "keyword" { - SwitchCaseSyntax("case .\(raw: token.swiftKind):") { - StmtSyntax("return #\"\(raw: token.nameForDiagnostics)\"#") - } - } - SwitchCaseSyntax("case .keyword(let keyword):") { - StmtSyntax("return String(syntaxText: keyword.defaultText)") - } - } - } - - try VariableDeclSyntax( - """ - /// Returns `true` if the token is a Swift keyword. - /// - /// Keywords are reserved unconditionally for use by Swift and may not - /// appear as identifiers in any position without being escaped. For example, - /// `class`, `func`, or `import`. - public var isLexerClassifiedKeyword: Bool - """ - ) { - try SwitchExprSyntax("switch self") { - SwitchCaseSyntax("case .eof:") { - StmtSyntax("return false") - } - - for token in SYNTAX_TOKENS where token.swiftKind != "keyword" { - SwitchCaseSyntax("case .\(raw: token.swiftKind):") { - StmtSyntax("return \(raw: token.isKeyword)") - } - } - - SwitchCaseSyntax("case .keyword(let keyword):") { - StmtSyntax("return keyword.isLexerClassified") - } - } - } - try VariableDeclSyntax( """ /// Returns `true` if the token is a Swift punctuator. @@ -197,6 +153,7 @@ let tokenKindFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { // `RawTokenBaseKind` for equality. With the raw value, it compiles down to // a primitive integer compare, without, it calls into `__derived_enum_equals`. @frozen // FIXME: Not actually stable, works around a miscompile + @_spi(RawSyntax) public enum RawTokenKind: UInt8, Equatable, Hashable """ ) { diff --git a/Examples/Sources/AddOneToIntegerLiterals/AddOneToIntegerLiterals.swift b/Examples/Sources/AddOneToIntegerLiterals/AddOneToIntegerLiterals.swift index 696b30b07d5..b236587d625 100644 --- a/Examples/Sources/AddOneToIntegerLiterals/AddOneToIntegerLiterals.swift +++ b/Examples/Sources/AddOneToIntegerLiterals/AddOneToIntegerLiterals.swift @@ -31,7 +31,7 @@ private class AddOneToIntegerLiterals: SyntaxRewriter { let int = Int(integerText)! // Create a new integer literal token with `int + 1` as its text. - let newIntegerLiteralToken = token.withKind(.integerLiteral("\(int + 1)")) + let newIntegerLiteralToken = token.with(\.tokenKind, .integerLiteral("\(int + 1)")) // Return the new integer literal. return newIntegerLiteralToken diff --git a/Sources/IDEUtils/SyntaxClassifier.swift b/Sources/IDEUtils/SyntaxClassifier.swift index 797629f87cc..7fba69d10f9 100644 --- a/Sources/IDEUtils/SyntaxClassifier.swift +++ b/Sources/IDEUtils/SyntaxClassifier.swift @@ -17,12 +17,8 @@ fileprivate extension SyntaxProtocol { var contextualClassif: (SyntaxClassification, Bool)? = nil var curData = Syntax(self) repeat { - guard let parent = curData.parent else { break } - contextualClassif = SyntaxClassification.classify( - parentKind: parent.raw.kind, - indexInParent: curData.indexInParent, - childKind: raw.kind - ) + guard let parent = curData.parent, let keyPath = curData.keyPathInParent else { break } + contextualClassif = SyntaxClassification.classify(keyPath) curData = parent } while contextualClassif == nil return contextualClassif @@ -35,7 +31,7 @@ extension TokenSyntax { let contextualClassification = self.contextualClassification let relativeOffset = leadingTriviaLength.utf8Length let absoluteOffset = position.utf8Offset + relativeOffset - return TokenKindAndText(kind: rawTokenKind, text: tokenView.rawText).classify( + return TokenKindAndText(kind: tokenView.rawKind, text: tokenView.rawText).classify( offset: absoluteOffset, contextualClassification: contextualClassification ) @@ -200,16 +196,17 @@ private struct ClassificationVisitor { for case (let index, let child?) in children.enumerated() { - let classficiation = SyntaxClassification.classify( - parentKind: descriptor.node.kind, - indexInParent: index, - childKind: child.kind - ) + let classification: (SyntaxClassification, Bool)? + if case .layout(let layout) = descriptor.node.kind.syntaxNodeType.structure { + classification = SyntaxClassification.classify(layout[index]) + } else { + classification = nil + } let result = visit( .init( node: child, byteOffset: byteOffset, - contextualClassification: classficiation ?? descriptor.contextualClassification + contextualClassification: classification ?? descriptor.contextualClassification ) ) if result == .break { diff --git a/Sources/IDEUtils/generated/SyntaxClassification.swift b/Sources/IDEUtils/generated/SyntaxClassification.swift index b4a9f336ec7..0a5076ebdba 100644 --- a/Sources/IDEUtils/generated/SyntaxClassification.swift +++ b/Sources/IDEUtils/generated/SyntaxClassification.swift @@ -65,52 +65,42 @@ extension SyntaxClassification { /// - childKind: The node syntax kind. /// - Returns: A pair of classification and whether it is "forced", or nil if /// no classification is attached. - internal static func classify( - parentKind: SyntaxKind, indexInParent: Int, childKind: SyntaxKind - ) -> (SyntaxClassification, Bool)? { - // Separate checks for token nodes (most common checks) versus checks for layout nodes. - if childKind == .token { - switch (parentKind, indexInParent) { - case (.availabilityVersionRestriction, 1): - return (.keyword, false) - case (.declModifier, 1): - return (.attribute, false) - case (.expressionSegment, 5): - return (.stringInterpolationAnchor, true) - case (.expressionSegment, 9): - return (.stringInterpolationAnchor, true) - case (.forInStmt, 5): - return (.keyword, false) - case (.ifConfigClause, 1): - return (.buildConfigId, false) - case (.ifConfigDecl, 3): - return (.buildConfigId, false) - case (.memberTypeIdentifier, 5): - return (.typeIdentifier, false) - case (.operatorDecl, 7): - return (.operatorIdentifier, false) - case (.precedenceGroupAssociativity, 1): - return (.keyword, false) - case (.precedenceGroupRelation, 1): - return (.keyword, false) - case (.simpleTypeIdentifier, 1): - return (.typeIdentifier, false) - default: - return nil - } - }else { - switch (parentKind, indexInParent) { - case (.attribute, 3): - return (.attribute, false) - case (.availabilityVersionRestrictionListEntry, 1): - return (.keyword, false) - case (.ifConfigClause, 3): - return (.buildConfigId, false) - case (.operatorDecl, 3): - return (.attribute, false) - default: - return nil - } + internal static func classify(_ keyPath: AnyKeyPath) -> (SyntaxClassification, Bool)? { + switch keyPath { + case \AttributeSyntax.attributeName: + return (.attribute, false) + case \AvailabilityVersionRestrictionListEntrySyntax.availabilityVersionRestriction: + return (.keyword, false) + case \AvailabilityVersionRestrictionSyntax.platform: + return (.keyword, false) + case \DeclModifierSyntax.name: + return (.attribute, false) + case \ExpressionSegmentSyntax.leftParen: + return (.stringInterpolationAnchor, true) + case \ExpressionSegmentSyntax.rightParen: + return (.stringInterpolationAnchor, true) + case \ForInStmtSyntax.awaitKeyword: + return (.keyword, false) + case \IfConfigClauseSyntax.poundKeyword: + return (.buildConfigId, false) + case \IfConfigClauseSyntax.condition: + return (.buildConfigId, false) + case \IfConfigDeclSyntax.poundEndif: + return (.buildConfigId, false) + case \MemberTypeIdentifierSyntax.name: + return (.typeIdentifier, false) + case \OperatorDeclSyntax.modifiers: + return (.attribute, false) + case \OperatorDeclSyntax.identifier: + return (.operatorIdentifier, false) + case \PrecedenceGroupAssociativitySyntax.associativityKeyword: + return (.keyword, false) + case \PrecedenceGroupRelationSyntax.higherThanOrLowerThan: + return (.keyword, false) + case \SimpleTypeIdentifierSyntax.name: + return (.typeIdentifier, false) + default: + return nil } } } diff --git a/Sources/SwiftBasicFormat/generated/BasicFormat.swift b/Sources/SwiftBasicFormat/generated/BasicFormat.swift index 8eef6f259d6..ea095d499bc 100644 --- a/Sources/SwiftBasicFormat/generated/BasicFormat.swift +++ b/Sources/SwiftBasicFormat/generated/BasicFormat.swift @@ -30,16 +30,16 @@ open class BasicFormat: SyntaxRewriter { private var putNextTokenOnNewLine: Bool = false open override func visitPre(_ node: Syntax) { - if let keyPath = getKeyPath(node), shouldIndent(keyPath) { + if let keyPath = node.keyPathInParent, shouldIndent(keyPath) { indentationLevel += 1 } if let parent = node.parent, childrenSeparatedByNewline(parent) { - putNextTokenOnNewLine = true && node.previousToken != nil + putNextTokenOnNewLine = true && node.previousToken(viewMode: .sourceAccurate) != nil } } open override func visitPost(_ node: Syntax) { - if let keyPath = getKeyPath(node), shouldIndent(keyPath) { + if let keyPath = node.keyPathInParent, shouldIndent(keyPath) { indentationLevel -= 1 } } @@ -53,7 +53,7 @@ open class BasicFormat: SyntaxRewriter { if requiresTrailingSpace(node) && trailingTrivia.isEmpty { trailingTrivia += .space } - if let keyPath = getKeyPath(Syntax(node)), requiresLeadingNewline(keyPath), !(leadingTrivia.first?.isNewline ?? false), !shouldOmitNewline(node) { + if let keyPath = node.keyPathInParent, requiresLeadingNewline(keyPath), !(leadingTrivia.first?.isNewline ?? false), !shouldOmitNewline(node) { leadingTrivia = .newline + leadingTrivia } var isOnNewline: Bool = (lastRewrittenToken?.trailingTrivia.pieces.last?.isNewline == true) @@ -178,7 +178,7 @@ open class BasicFormat: SyntaxRewriter { } open func requiresLeadingSpace(_ token: TokenSyntax) -> Bool { - if let keyPath = getKeyPath(token), let requiresLeadingSpace = requiresLeadingSpace(keyPath) { + if let keyPath = token.keyPathInParent, let requiresLeadingSpace = requiresLeadingSpace(keyPath) { return requiresLeadingSpace } switch (token.previousToken(viewMode: .sourceAccurate)?.tokenKind, token.tokenKind) { @@ -233,7 +233,7 @@ open class BasicFormat: SyntaxRewriter { } open func requiresTrailingSpace(_ token: TokenSyntax) -> Bool { - if let keyPath = getKeyPath(token), let requiresTrailingSpace = requiresTrailingSpace(keyPath) { + if let keyPath = token.keyPathInParent, let requiresTrailingSpace = requiresTrailingSpace(keyPath) { return requiresTrailingSpace } switch (token.tokenKind, token.nextToken(viewMode: .sourceAccurate)?.tokenKind) { @@ -365,14 +365,4 @@ open class BasicFormat: SyntaxRewriter { return false } } - - private func getKeyPath(_ node: T) -> AnyKeyPath? { - guard let parent = node.parent else { - return nil - } - guard case .layout(let childrenKeyPaths) = parent.kind.syntaxNodeType.structure else { - return nil - } - return childrenKeyPaths[node.indexInParent] - } } diff --git a/Sources/SwiftParser/CMakeLists.txt b/Sources/SwiftParser/CMakeLists.txt index ceb81796173..45b41144fce 100644 --- a/Sources/SwiftParser/CMakeLists.txt +++ b/Sources/SwiftParser/CMakeLists.txt @@ -35,6 +35,7 @@ add_swift_host_library(SwiftParser Types.swift generated/DeclarationModifier.swift + generated/IsLexerClassified.swift generated/Parser+Entry.swift generated/TokenSpecStaticMembers.swift generated/TypeAttribute.swift diff --git a/Sources/SwiftParser/Lookahead.swift b/Sources/SwiftParser/Lookahead.swift index 14ab301871a..94d687afe1f 100644 --- a/Sources/SwiftParser/Lookahead.swift +++ b/Sources/SwiftParser/Lookahead.swift @@ -90,6 +90,7 @@ extension Parser.Lookahead { self.currentToken = self.lexemes.advance() } + @_spi(RawSyntax) public mutating func consumeAnyToken(remapping: RawTokenKind) { self.consumeAnyToken() } diff --git a/Sources/SwiftParser/TokenPrecedence.swift b/Sources/SwiftParser/TokenPrecedence.swift index 93049d329a3..dede4f7a18e 100644 --- a/Sources/SwiftParser/TokenPrecedence.swift +++ b/Sources/SwiftParser/TokenPrecedence.swift @@ -15,7 +15,7 @@ /// Describes how distinctive a token is for parser recovery. When expecting a /// token, tokens with a lower token precedence may be skipped and considered /// unexpected. -public enum TokenPrecedence: Comparable { +enum TokenPrecedence: Comparable { /// An unknown token. This is known garbage and should always be allowed to be skipped. case unknownToken /// Tokens that can be used similar to variable names or literals diff --git a/Sources/SwiftParser/TokenSpec.swift b/Sources/SwiftParser/TokenSpec.swift index 429981aa7d5..642a92daa1d 100644 --- a/Sources/SwiftParser/TokenSpec.swift +++ b/Sources/SwiftParser/TokenSpec.swift @@ -137,7 +137,7 @@ struct TokenSpec { @inline(__always) static func ~= (kind: TokenSpec, token: TokenSyntax) -> Bool { return kind.matches( - rawTokenKind: token.rawTokenKind, + rawTokenKind: token.tokenView.rawKind, keyword: Keyword(token.tokenView.rawText), atStartOfLine: token.leadingTrivia.contains(where: { $0.isNewline }) ) diff --git a/Sources/SwiftParser/generated/IsLexerClassified.swift b/Sources/SwiftParser/generated/IsLexerClassified.swift new file mode 100644 index 00000000000..caf7c25a11c --- /dev/null +++ b/Sources/SwiftParser/generated/IsLexerClassified.swift @@ -0,0 +1,164 @@ +//// Automatically generated by generate-swiftsyntax +//// Do not edit directly! +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax + +extension Keyword { + /// Whether the token kind is switched from being an identifier to being a keyword in the lexer. + /// This is true for keywords that used to be considered non-contextual. + var isLexerClassified: Bool { + switch self { + case .`Any`: + return true + case .`as`: + return true + case .`associatedtype`: + return true + case .`break`: + return true + case .`case`: + return true + case .`catch`: + return true + case .`class`: + return true + case .`continue`: + return true + case .`default`: + return true + case .`defer`: + return true + case .`deinit`: + return true + case .`do`: + return true + case .`else`: + return true + case .`enum`: + return true + case .`extension`: + return true + case .`fallthrough`: + return true + case .`false`: + return true + case .`fileprivate`: + return true + case .`for`: + return true + case .`func`: + return true + case .`guard`: + return true + case .`if`: + return true + case .`import`: + return true + case .`in`: + return true + case .`init`: + return true + case .`inout`: + return true + case .`internal`: + return true + case .`is`: + return true + case .`let`: + return true + case .`nil`: + return true + case .`operator`: + return true + case .`precedencegroup`: + return true + case .`private`: + return true + case .`protocol`: + return true + case .`public`: + return true + case .`repeat`: + return true + case .`rethrows`: + return true + case .`return`: + return true + case .`self`: + return true + case .`Self`: + return true + case .`static`: + return true + case .`struct`: + return true + case .`subscript`: + return true + case .`super`: + return true + case .`switch`: + return true + case .`throw`: + return true + case .`throws`: + return true + case .`true`: + return true + case .`try`: + return true + case .`typealias`: + return true + case .`var`: + return true + case .`where`: + return true + case .`while`: + return true + default: + return false + } + } +} + +extension TokenKind { + /// Returns `true` if the token is a Swift keyword. + /// + /// Keywords are reserved unconditionally for use by Swift and may not + /// appear as identifiers in any position without being escaped. For example, + /// `class`, `func`, or `import`. + public var isLexerClassifiedKeyword: Bool { + switch self { + case .eof: + return false + case .poundAvailableKeyword: + return true + case .poundElseKeyword: + return true + case .poundElseifKeyword: + return true + case .poundEndifKeyword: + return true + case .poundIfKeyword: + return true + case .poundSourceLocationKeyword: + return true + case .poundUnavailableKeyword: + return true + case .keyword(let keyword): + return keyword.isLexerClassified + default: + return false + } + } +} diff --git a/Sources/SwiftParser/generated/TokenSpecStaticMembers.swift b/Sources/SwiftParser/generated/TokenSpecStaticMembers.swift index dd90a837195..9321eef4b86 100644 --- a/Sources/SwiftParser/generated/TokenSpecStaticMembers.swift +++ b/Sources/SwiftParser/generated/TokenSpecStaticMembers.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -import SwiftSyntax +@_spi(RawSyntax) import SwiftSyntax extension TokenSpec { static var eof: TokenSpec { diff --git a/Sources/SwiftParserDiagnostics/CMakeLists.txt b/Sources/SwiftParserDiagnostics/CMakeLists.txt index de7314a2841..91be323333a 100644 --- a/Sources/SwiftParserDiagnostics/CMakeLists.txt +++ b/Sources/SwiftParserDiagnostics/CMakeLists.txt @@ -16,7 +16,12 @@ add_swift_host_library(SwiftParserDiagnostics ParseDiagnosticsGenerator.swift PresenceUtils.swift SyntaxExtensions.swift - Utils.swift) + Utils.swift + + generated/ChildNameForDiagnostics.swift + generated/SyntaxKindNameForDiagnostics.swift + generated/TokenNameForDiagnostics.swift +) target_link_libraries(SwiftParserDiagnostics PUBLIC SwiftBasicFormat diff --git a/Sources/SwiftParserDiagnostics/LexerDiagnosticMessages.swift b/Sources/SwiftParserDiagnostics/LexerDiagnosticMessages.swift index 82f2ccbb7a5..52958b404d8 100644 --- a/Sources/SwiftParserDiagnostics/LexerDiagnosticMessages.swift +++ b/Sources/SwiftParserDiagnostics/LexerDiagnosticMessages.swift @@ -204,7 +204,7 @@ public extension SwiftSyntax.TokenDiagnostic { .replacingFirstOccurence(of: "“", with: #"""#) .replacingLastOccurence(of: "”", with: #"""#) - let fixedToken = token.withKind(TokenKind.fromRaw(kind: rawKind, text: replacedText)) + let fixedToken = token.with(\.tokenKind, TokenKind.fromRaw(kind: rawKind, text: replacedText)) return [ FixIt(message: .replaceCurlyQuoteByNormalQuote, changes: [.replace(oldNode: Syntax(token), newNode: Syntax(fixedToken))]) ] diff --git a/Sources/SwiftParserDiagnostics/MissingNodesError.swift b/Sources/SwiftParserDiagnostics/MissingNodesError.swift index 9e17832a686..bf562748ac3 100644 --- a/Sources/SwiftParserDiagnostics/MissingNodesError.swift +++ b/Sources/SwiftParserDiagnostics/MissingNodesError.swift @@ -347,7 +347,7 @@ extension ParseDiagnosticsGenerator { missingNodes += [sibling] } else if sibling.isMissingAllTokens && sibling.hasTokens { missingNodes += [sibling] - } else if sibling.isCollection && sibling.children(viewMode: .sourceAccurate).count == 0 { + } else if sibling.kind.isSyntaxCollection && sibling.children(viewMode: .sourceAccurate).count == 0 { // Skip over any syntax collections without any elements while looking ahead for further missing nodes. } else { // Otherwise we have found a present node, so stop looking ahead. diff --git a/Sources/SwiftParserDiagnostics/MissingTokenError.swift b/Sources/SwiftParserDiagnostics/MissingTokenError.swift index 791cfe52855..24b84119710 100644 --- a/Sources/SwiftParserDiagnostics/MissingTokenError.swift +++ b/Sources/SwiftParserDiagnostics/MissingTokenError.swift @@ -27,7 +27,7 @@ extension ParseDiagnosticsGenerator { // this token. let handled: Bool - switch (missingToken.rawTokenKind, invalidToken.rawTokenKind) { + switch (missingToken.tokenView.rawKind, invalidToken.tokenView.rawKind) { case (.identifier, _): handled = handleInvalidIdentifier(invalidToken: invalidToken, missingToken: missingToken, invalidTokenContainer: invalidTokenContainer) case (.multilineStringQuote, .multilineStringQuote): @@ -103,7 +103,7 @@ extension ParseDiagnosticsGenerator { ] if let identifier = missingToken.nextToken(viewMode: .all), - identifier.rawTokenKind == .identifier, + identifier.tokenView.rawKind == .identifier, identifier.presence == .missing { // The extraneous whitespace caused a missing identifier, output a diff --git a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift index 181e546b9c3..e559a211d47 100644 --- a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift +++ b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift @@ -20,9 +20,9 @@ fileprivate extension TokenSyntax { var negatedAvailabilityKeyword: TokenSyntax { switch self.tokenKind { case .poundAvailableKeyword: - return self.withKind(.poundUnavailableKeyword) + return self.with(\.tokenKind, .poundUnavailableKeyword) case .poundUnavailableKeyword: - return self.withKind(.poundAvailableKeyword) + return self.with(\.tokenKind, .poundAvailableKeyword) default: preconditionFailure("The availability token of an AvailabilityConditionSyntax should always be #available or #unavailable") } diff --git a/Sources/SwiftParserDiagnostics/generated/ChildNameForDiagnostics.swift b/Sources/SwiftParserDiagnostics/generated/ChildNameForDiagnostics.swift new file mode 100644 index 00000000000..c1fe58ff4f3 --- /dev/null +++ b/Sources/SwiftParserDiagnostics/generated/ChildNameForDiagnostics.swift @@ -0,0 +1,377 @@ +//// Automatically generated by generate-swiftsyntax +//// Do not edit directly! +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax + +private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String? { + switch keyPath { + case \AccessPathComponentSyntax.name: + return "name" + case \AccessorDeclSyntax.attributes: + return "attributes" + case \AccessorDeclSyntax.modifier: + return "modifiers" + case \AccessorDeclSyntax.parameter: + return "parameter" + case \AccessorParameterSyntax.name: + return "name" + case \ActorDeclSyntax.attributes: + return "attributes" + case \ActorDeclSyntax.modifiers: + return "modifiers" + case \ActorDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \ActorDeclSyntax.inheritanceClause: + return "type inheritance clause" + case \ActorDeclSyntax.genericWhereClause: + return "generic where clause" + case \ArrayElementSyntax.expression: + return "value" + case \AssociatedtypeDeclSyntax.attributes: + return "attributes" + case \AssociatedtypeDeclSyntax.modifiers: + return "modifiers" + case \AssociatedtypeDeclSyntax.inheritanceClause: + return "inheritance clause" + case \AssociatedtypeDeclSyntax.genericWhereClause: + return "generic where clause" + case \AttributeSyntax.attributeName: + return "name" + case \AvailabilityEntrySyntax.label: + return "label" + case \AvailabilityLabeledArgumentSyntax.label: + return "label" + case \AvailabilityLabeledArgumentSyntax.value: + return "value" + case \AvailabilityVersionRestrictionSyntax.platform: + return "platform" + case \AvailabilityVersionRestrictionSyntax.version: + return "version" + case \BreakStmtSyntax.label: + return "label" + case \ClassDeclSyntax.attributes: + return "attributes" + case \ClassDeclSyntax.modifiers: + return "modifiers" + case \ClassDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \ClassDeclSyntax.inheritanceClause: + return "inheritance clause" + case \ClassDeclSyntax.genericWhereClause: + return "generic where clause" + case \ClosureParamSyntax.name: + return "name" + case \ClosureParameterClauseSyntax.parameterList: + return "parameters" + case \ClosureParameterSyntax.attributes: + return "attributes" + case \ClosureParameterSyntax.modifiers: + return "modifiers" + case \ClosureParameterSyntax.type: + return "type" + case \ClosureSignatureSyntax.attributes: + return "attributes" + case \CodeBlockSyntax.statements: + return "statements" + case \ContinueStmtSyntax.label: + return "label" + case \DeclNameSyntax.declBaseName: + return "base name" + case \DeclNameSyntax.declNameArguments: + return "arguments" + case \DeinitializerDeclSyntax.attributes: + return "attributes" + case \DeinitializerDeclSyntax.modifiers: + return "modifiers" + case \DictionaryElementSyntax.keyExpression: + return "key" + case \DictionaryElementSyntax.valueExpression: + return "value" + case \DictionaryTypeSyntax.keyType: + return "key type" + case \DictionaryTypeSyntax.valueType: + return "value type" + case \DifferentiabilityParamsClauseSyntax.parameters: + return "parameters" + case \DoStmtSyntax.body: + return "body" + case \DocumentationAttributeArgumentSyntax.label: + return "label" + case \EnumCaseDeclSyntax.attributes: + return "attributes" + case \EnumCaseDeclSyntax.modifiers: + return "modifiers" + case \EnumCaseDeclSyntax.elements: + return "elements" + case \EnumCaseElementSyntax.associatedValue: + return "associated values" + case \EnumCaseParameterClauseSyntax.parameterList: + return "parameters" + case \EnumCaseParameterSyntax.modifiers: + return "modifiers" + case \EnumCaseParameterSyntax.type: + return "type" + case \EnumCaseParameterSyntax.defaultArgument: + return "default argument" + case \EnumDeclSyntax.attributes: + return "attributes" + case \EnumDeclSyntax.modifiers: + return "modifiers" + case \EnumDeclSyntax.genericParameters: + return "generic parameter clause" + case \EnumDeclSyntax.inheritanceClause: + return "inheritance clause" + case \EnumDeclSyntax.genericWhereClause: + return "generic where clause" + case \ExtensionDeclSyntax.attributes: + return "attributes" + case \ExtensionDeclSyntax.modifiers: + return "modifiers" + case \ExtensionDeclSyntax.inheritanceClause: + return "inheritance clause" + case \ExtensionDeclSyntax.genericWhereClause: + return "generic where clause" + case \ForInStmtSyntax.body: + return "body" + case \FunctionCallExprSyntax.calledExpression: + return "called expression" + case \FunctionCallExprSyntax.argumentList: + return "arguments" + case \FunctionCallExprSyntax.trailingClosure: + return "trailing closure" + case \FunctionCallExprSyntax.additionalTrailingClosures: + return "trailing closures" + case \FunctionDeclSyntax.attributes: + return "attributes" + case \FunctionDeclSyntax.modifiers: + return "modifiers" + case \FunctionDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \FunctionDeclSyntax.signature: + return "function signature" + case \FunctionDeclSyntax.genericWhereClause: + return "generic where clause" + case \FunctionParameterSyntax.attributes: + return "attributes" + case \FunctionParameterSyntax.modifiers: + return "modifiers" + case \FunctionParameterSyntax.secondName: + return "internal name" + case \FunctionParameterSyntax.type: + return "type" + case \FunctionParameterSyntax.defaultArgument: + return "default argument" + case \GenericParameterSyntax.each: + return "parameter pack specifier" + case \GenericParameterSyntax.name: + return "name" + case \GenericParameterSyntax.inheritedType: + return "inherited type" + case \GuardStmtSyntax.conditions: + return "condition" + case \GuardStmtSyntax.body: + return "body" + case \IfConfigClauseSyntax.condition: + return "condition" + case \IfExprSyntax.body: + return "body" + case \IfExprSyntax.elseBody: + return "else body" + case \ImplementsAttributeArgumentsSyntax.type: + return "type" + case \ImplementsAttributeArgumentsSyntax.declBaseName: + return "declaration base name" + case \ImplementsAttributeArgumentsSyntax.declNameArguments: + return "declaration name arguments" + case \ImportDeclSyntax.attributes: + return "attributes" + case \ImportDeclSyntax.modifiers: + return "modifiers" + case \InitializerDeclSyntax.attributes: + return "attributes" + case \InitializerDeclSyntax.modifiers: + return "modifiers" + case \InitializerDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \InitializerDeclSyntax.signature: + return "function signature" + case \InitializerDeclSyntax.genericWhereClause: + return "generic where clause" + case \KeyPathExprSyntax.root: + return "root" + case \KeyPathSubscriptComponentSyntax.argumentList: + return "arguments" + case \LabeledSpecializeEntrySyntax.label: + return "label" + case \LabeledSpecializeEntrySyntax.value: + return "value" + case \LabeledStmtSyntax.labelName: + return "label name" + case \LayoutRequirementSyntax.typeIdentifier: + return "constrained type" + case \LayoutRequirementSyntax.size: + return "size" + case \LayoutRequirementSyntax.alignment: + return "alignment" + case \MacroDeclSyntax.attributes: + return "attributes" + case \MacroDeclSyntax.modifiers: + return "modifiers" + case \MacroDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \MacroDeclSyntax.signature: + return "macro signature" + case \MacroDeclSyntax.definition: + return "macro definition" + case \MacroDeclSyntax.genericWhereClause: + return "generic where clause" + case \MemberAccessExprSyntax.base: + return "base" + case \MemberAccessExprSyntax.name: + return "name" + case \MemberTypeIdentifierSyntax.baseType: + return "base type" + case \MemberTypeIdentifierSyntax.name: + return "name" + case \MetatypeTypeSyntax.baseType: + return "base type" + case \MultipleTrailingClosureElementSyntax.label: + return "label" + case \ObjCSelectorPieceSyntax.name: + return "name" + case \OperatorDeclSyntax.attributes: + return "attributes" + case \OperatorDeclSyntax.modifiers: + return "modifiers" + case \OperatorPrecedenceAndTypesSyntax.precedenceGroup: + return "precedence group" + case \ParameterClauseSyntax.parameterList: + return "parameters" + case \PatternBindingSyntax.typeAnnotation: + return "type annotation" + case \PoundSourceLocationArgsSyntax.fileName: + return "file name" + case \PoundSourceLocationArgsSyntax.lineNumber: + return "line number" + case \PoundSourceLocationSyntax.args: + return "arguments" + case \PrecedenceGroupDeclSyntax.attributes: + return "attributes" + case \PrecedenceGroupDeclSyntax.modifiers: + return "modifiers" + case \PrecedenceGroupNameElementSyntax.name: + return "name" + case \PrimaryAssociatedTypeSyntax.name: + return "name" + case \ProtocolDeclSyntax.attributes: + return "attributes" + case \ProtocolDeclSyntax.modifiers: + return "modifiers" + case \ProtocolDeclSyntax.primaryAssociatedTypeClause: + return "primary associated type clause" + case \ProtocolDeclSyntax.inheritanceClause: + return "inheritance clause" + case \ProtocolDeclSyntax.genericWhereClause: + return "generic where clause" + case \QualifiedDeclNameSyntax.baseType: + return "base type" + case \QualifiedDeclNameSyntax.name: + return "base name" + case \QualifiedDeclNameSyntax.arguments: + return "arguments" + case \RepeatWhileStmtSyntax.body: + return "body" + case \RepeatWhileStmtSyntax.condition: + return "condition" + case \ReturnClauseSyntax.returnType: + return "return type" + case \SameTypeRequirementSyntax.leftTypeIdentifier: + return "left-hand type" + case \SameTypeRequirementSyntax.rightTypeIdentifier: + return "right-hand type" + case \StructDeclSyntax.attributes: + return "attributes" + case \StructDeclSyntax.modifiers: + return "modifiers" + case \StructDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \StructDeclSyntax.inheritanceClause: + return "type inheritance clause" + case \StructDeclSyntax.genericWhereClause: + return "generic where clause" + case \SubscriptDeclSyntax.attributes: + return "attributes" + case \SubscriptDeclSyntax.modifiers: + return "modifiers" + case \SubscriptDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \SubscriptDeclSyntax.genericWhereClause: + return "generic where clause" + case \SubscriptExprSyntax.calledExpression: + return "called expression" + case \SubscriptExprSyntax.argumentList: + return "arguments" + case \SubscriptExprSyntax.trailingClosure: + return "trailing closure" + case \SubscriptExprSyntax.additionalTrailingClosures: + return "trailing closures" + case \SwitchCaseSyntax.label: + return "label" + case \TargetFunctionEntrySyntax.label: + return "label" + case \TargetFunctionEntrySyntax.declname: + return "declaration name" + case \TernaryExprSyntax.conditionExpression: + return "condition" + case \TernaryExprSyntax.firstChoice: + return "first choice" + case \TernaryExprSyntax.secondChoice: + return "second choice" + case \TupleExprElementSyntax.label: + return "label" + case \TupleExprElementSyntax.expression: + return "value" + case \TuplePatternElementSyntax.labelName: + return "label" + case \TupleTypeElementSyntax.name: + return "name" + case \TupleTypeElementSyntax.secondName: + return "internal name" + case \TypeInitializerClauseSyntax.value: + return "type" + case \TypealiasDeclSyntax.attributes: + return "attributes" + case \TypealiasDeclSyntax.modifiers: + return "modifiers" + case \TypealiasDeclSyntax.genericParameterClause: + return "generic parameter clause" + case \TypealiasDeclSyntax.genericWhereClause: + return "generic where clause" + case \VariableDeclSyntax.attributes: + return "attributes" + case \VariableDeclSyntax.modifiers: + return "modifiers" + default: + return nil + } +} + +extension SyntaxProtocol { + var childNameInParent: String? { + guard let keyPath = self.keyPathInParent else { + return nil + } + return childNameForDiagnostics(keyPath) + } +} diff --git a/Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift b/Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift new file mode 100644 index 00000000000..e5d39584be2 --- /dev/null +++ b/Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift @@ -0,0 +1,398 @@ +//// Automatically generated by generate-swiftsyntax +//// Do not edit directly! +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax + +extension SyntaxKind { + var nameForDiagnostics: String? { + switch self { + case .token: + return "token" + case .accessorDecl: + return "accessor" + case .actorDecl: + return "actor" + case .arrayElement: + return "array element" + case .arrayExpr: + return "array" + case .arrayType: + return "array type" + case .asExpr: + return "'as'" + case .associatedtypeDecl: + return "associatedtype declaration" + case .attributeList: + return "attributes" + case .attribute: + return "attribute" + case .attributedType: + return "type" + case .availabilityArgument: + return "availability argument" + case .availabilityCondition: + return "availability condition" + case .availabilityEntry: + return "availability entry" + case .availabilityLabeledArgument: + return "availability argument" + case .availabilitySpecList: + return "'@availability' arguments" + case .availabilityVersionRestrictionListEntry: + return "version" + case .availabilityVersionRestrictionList: + return "version list" + case .availabilityVersionRestriction: + return "version restriction" + case .awaitExpr: + return "'await' expression" + case .backDeployedAttributeSpecList: + return "'@backDeployed' arguments" + case .binaryOperatorExpr: + return "operator" + case .booleanLiteralExpr: + return "bool literal" + case .borrowExpr: + return "'_borrow' expression" + case .breakStmt: + return "'break' statement" + case .catchClauseList: + return "'catch' clause" + case .catchClause: + return "'catch' clause" + case .classDecl: + return "class" + case .closureCaptureItemSpecifier: + return "closure capture specifier" + case .closureCaptureItem: + return "closure capture item" + case .closureCaptureSignature: + return "closure capture signature" + case .closureExpr: + return "closure" + case .closureParam: + return "closure parameter" + case .closureParameterClause: + return "parameter clause" + case .closureParameterList: + return "parameter list" + case .closureParameter: + return "parameter" + case .closureSignature: + return "closure signature" + case .codeBlock: + return "code block" + case .compositionType: + return "type composition" + case .conformanceRequirement: + return "conformance requirement" + case .constrainedSugarType: + return "type" + case .continueStmt: + return "'continue' statement" + case .conventionAttributeArguments: + return "@convention(...) arguments" + case .conventionWitnessMethodAttributeArguments: + return "@convention(...) arguments for witness methods" + case .declEffectSpecifiers: + return "effect specifiers" + case .declModifier: + return "modifier" + case .declName: + return "declaration name" + case .deferStmt: + return "'defer' statement" + case .deinitializerDecl: + return "deinitializer" + case .derivativeRegistrationAttributeArguments: + return "attribute arguments" + case .dictionaryElement: + return "dictionary element" + case .dictionaryExpr: + return "dictionary" + case .dictionaryType: + return "dictionary type" + case .differentiabilityParamList: + return "differentiability parameters" + case .differentiabilityParam: + return "differentiability parameter" + case .differentiabilityParamsClause: + return "'@differentiable' argument" + case .differentiabilityParams: + return "differentiability parameters" + case .differentiableAttributeArguments: + return "'@differentiable' arguments" + case .doStmt: + return "'do' statement" + case .documentationAttributeArgument: + return "@_documentation argument" + case .documentationAttributeArguments: + return "@_documentation arguments" + case .dynamicReplacementArguments: + return "@_dynamicReplacement argument" + case .editorPlaceholderDecl: + return "editor placeholder" + case .editorPlaceholderExpr: + return "editor placeholder" + case .effectsArguments: + return "@_effects arguments" + case .enumCaseDecl: + return "enum case" + case .enumCaseParameterClause: + return "parameter clause" + case .enumCaseParameterList: + return "parameter list" + case .enumCaseParameter: + return "parameter" + case .enumDecl: + return "enum" + case .exposeAttributeArguments: + return "@_expose arguments" + case .expressionPattern: + return "pattern" + case .expressionStmt: + return "expression" + case .extensionDecl: + return "extension" + case .fallthroughStmt: + return "'fallthrough' statement" + case .floatLiteralExpr: + return "floating literal" + case .forInStmt: + return "'for' statement" + case .forcedValueExpr: + return "force unwrap" + case .forgetStmt: + return "'forget' statement" + case .functionCallExpr: + return "function call" + case .functionDecl: + return "function" + case .functionParameterList: + return "parameter list" + case .functionParameter: + return "parameter" + case .functionSignature: + return "function signature" + case .functionType: + return "function type" + case .genericArgumentClause: + return "generic argument clause" + case .genericArgument: + return "generic argument" + case .genericParameterClause: + return "generic parameter clause" + case .genericParameter: + return "generic parameter" + case .genericWhereClause: + return "'where' clause" + case .guardStmt: + return "'guard' statement" + case .identifierPattern: + return "pattern" + case .ifConfigClause: + return "conditional compilation clause" + case .ifConfigDecl: + return "conditional compilation block" + case .ifExpr: + return "'if' statement" + case .implementsAttributeArguments: + return "@_implements arguemnts" + case .implicitlyUnwrappedOptionalType: + return "implicitly unwrapped optional type" + case .importDecl: + return "import" + case .inOutExpr: + return "inout expression" + case .inheritedType: + return "inherited type" + case .initializerDecl: + return "initializer" + case .integerLiteralExpr: + return "integer literal" + case .isExpr: + return "'is'" + case .isTypePattern: + return "'is' pattern" + case .keyPathComponent: + return "key path component" + case .keyPathExpr: + return "key path" + case .keyPathOptionalComponent: + return "key path optional component" + case .keyPathPropertyComponent: + return "key path property component" + case .keyPathSubscriptComponent: + return "key path subscript component" + case .labeledSpecializeEntry: + return "attribute argument" + case .labeledStmt: + return "labeled statement" + case .layoutRequirement: + return "layout requirement" + case .macroDecl: + return "macro" + case .macroExpansionDecl: + return "macro expansion" + case .macroExpansionExpr: + return "macro expansion" + case .matchingPatternCondition: + return "pattern matching" + case .memberAccessExpr: + return "member access" + case .memberDeclBlock: + return "member block" + case .memberTypeIdentifier: + return "member type" + case .metatypeType: + return "metatype" + case .missingDecl: + return "declaration" + case .missingExpr: + return "expression" + case .missingPattern: + return "pattern" + case .missingStmt: + return "statement" + case .missingType: + return "type" + case .moveExpr: + return "'_move' expression" + case .multipleTrailingClosureElement: + return "trailing closure" + case .namedOpaqueReturnType: + return "named opaque return type" + case .objCSelectorPiece: + return "Objective-C selector piece" + case .objCSelector: + return "Objective-C selector" + case .opaqueReturnTypeOfAttributeArguments: + return "opaque return type arguments" + case .operatorDecl: + return "operator declaration" + case .optionalBindingCondition: + return "optional binding" + case .optionalChainingExpr: + return "optional chaining" + case .optionalType: + return "optional type" + case .originallyDefinedInArguments: + return "@_originallyDefinedIn arguments" + case .packExpansionType: + return "variadic expansion" + case .packReferenceType: + return "pack reference" + case .parameterClause: + return "parameter clause" + case .postfixUnaryExpr: + return "postfix expression" + case .poundSourceLocationArgs: + return "'#sourceLocation' arguments" + case .poundSourceLocation: + return "'#sourceLocation' directive" + case .precedenceGroupAssignment: + return "'assignment' property of precedencegroup" + case .precedenceGroupAssociativity: + return "'associativity' property of precedencegroup" + case .precedenceGroupDecl: + return "precedencegroup" + case .precedenceGroupRelation: + return "'relation' property of precedencegroup" + case .prefixOperatorExpr: + return "operator" + case .primaryAssociatedTypeClause: + return "primary associated type clause" + case .protocolDecl: + return "protocol" + case .qualifiedDeclName: + return "declaration name" + case .regexLiteralExpr: + return "regex literal" + case .repeatWhileStmt: + return "'repeat' statement" + case .returnStmt: + return "'return' statement" + case .sameTypeRequirement: + return "same type requirement" + case .simpleTypeIdentifier: + return "type" + case .sourceFile: + return "source file" + case .specializeAttributeSpecList: + return "argument to '@_specialize" + case .stringLiteralExpr: + return "string literal" + case .structDecl: + return "struct" + case .subscriptDecl: + return "subscript" + case .subscriptExpr: + return "subscript" + case .switchCase: + return "switch case" + case .switchExpr: + return "'switch' statement" + case .targetFunctionEntry: + return "attribute argument" + case .ternaryExpr: + return "ternay expression" + case .throwStmt: + return "'throw' statement" + case .tryExpr: + return "'try' expression" + case .tupleExpr: + return "tuple" + case .tuplePattern: + return "tuple pattern" + case .tupleType: + return "tuple type" + case .typeAnnotation: + return "type annotation" + case .typeEffectSpecifiers: + return "effect specifiers" + case .typeInheritanceClause: + return "inheritance clause" + case .typealiasDecl: + return "typealias declaration" + case .unavailableFromAsyncArguments: + return "@_unavailableFromAsync argument" + case .underscorePrivateAttributeArguments: + return "@_private argument" + case .unresolvedAsExpr: + return "'as'" + case .unresolvedIsExpr: + return "'is'" + case .unresolvedTernaryExpr: + return "ternary operator" + case .valueBindingPattern: + return "value binding pattern" + case .variableDecl: + return "variable" + case .versionTuple: + return "version tuple" + case .whereClause: + return "'where' clause" + case .whileStmt: + return "'while' statement" + case .wildcardPattern: + return "wildcard pattern" + case .yieldExprList: + return "yield list" + case .yieldStmt: + return "'yield' statement" + default: + return nil + } + } +} diff --git a/Sources/SwiftParserDiagnostics/generated/TokenNameForDiagnostics.swift b/Sources/SwiftParserDiagnostics/generated/TokenNameForDiagnostics.swift new file mode 100644 index 00000000000..6dd7537bb85 --- /dev/null +++ b/Sources/SwiftParserDiagnostics/generated/TokenNameForDiagnostics.swift @@ -0,0 +1,120 @@ +//// Automatically generated by generate-swiftsyntax +//// Do not edit directly! +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +@_spi(RawSyntax) import SwiftSyntax + +extension TokenKind { + var nameForDiagnostics: String { + switch self { + case .eof: + return "end of file" + case .arrow: + return #"->"# + case .atSign: + return #"@"# + case .backslash: + return #"\"# + case .backtick: + return #"`"# + case .binaryOperator: + return #"binary operator"# + case .colon: + return #":"# + case .comma: + return #","# + case .dollarIdentifier: + return #"dollar identifier"# + case .ellipsis: + return #"..."# + case .equal: + return #"="# + case .exclamationMark: + return #"!"# + case .extendedRegexDelimiter: + return #"extended delimiter"# + case .floatingLiteral: + return #"floating literal"# + case .identifier: + return #"identifier"# + case .infixQuestionMark: + return #"?"# + case .integerLiteral: + return #"integer literal"# + case .leftAngle: + return #"<"# + case .leftBrace: + return #"{"# + case .leftParen: + return #"("# + case .leftSquareBracket: + return #"["# + case .multilineStringQuote: + return #"""""# + case .period: + return #"."# + case .postfixOperator: + return #"postfix operator"# + case .postfixQuestionMark: + return #"?"# + case .pound: + return #"#"# + case .poundAvailableKeyword: + return #"#available"# + case .poundElseKeyword: + return #"#else"# + case .poundElseifKeyword: + return #"#elseif"# + case .poundEndifKeyword: + return #"#endif"# + case .poundIfKeyword: + return #"#if"# + case .poundSourceLocationKeyword: + return #"#sourceLocation"# + case .poundUnavailableKeyword: + return #"#unavailable"# + case .prefixAmpersand: + return #"&"# + case .prefixOperator: + return #"prefix operator"# + case .rawStringDelimiter: + return #"raw string delimiter"# + case .regexLiteralPattern: + return #"regex pattern"# + case .regexSlash: + return #"/"# + case .rightAngle: + return #">"# + case .rightBrace: + return #"}"# + case .rightParen: + return #")"# + case .rightSquareBracket: + return #"]"# + case .semicolon: + return #";"# + case .singleQuote: + return #"'"# + case .stringQuote: + return #"""# + case .stringSegment: + return #"string segment"# + case .unknown: + return #"token"# + case .wildcard: + return #"wildcard"# + case .keyword(let keyword): + return String(syntaxText: keyword.defaultText) + } + } +} diff --git a/Sources/SwiftRefactor/AddSeparatorsToIntegerLiteral.swift b/Sources/SwiftRefactor/AddSeparatorsToIntegerLiteral.swift index b75cd020a0e..77f38b6865d 100644 --- a/Sources/SwiftRefactor/AddSeparatorsToIntegerLiteral.swift +++ b/Sources/SwiftRefactor/AddSeparatorsToIntegerLiteral.swift @@ -51,7 +51,7 @@ public struct AddSeparatorsToIntegerLiteral: RefactoringProvider { formattedText += value.byAddingGroupSeparators(at: lit.idealGroupSize) return lit - .with(\.digits, lit.digits.withKind(.integerLiteral(formattedText))) + .with(\.digits, lit.digits.with(\.tokenKind, .integerLiteral(formattedText))) } } diff --git a/Sources/SwiftRefactor/FormatRawStringLiteral.swift b/Sources/SwiftRefactor/FormatRawStringLiteral.swift index ada7682a1e2..738adc3d540 100644 --- a/Sources/SwiftRefactor/FormatRawStringLiteral.swift +++ b/Sources/SwiftRefactor/FormatRawStringLiteral.swift @@ -49,15 +49,15 @@ public struct FormatRawStringLiteral: RefactoringProvider { guard maximumHashes > 0 else { return lit - .with(\.openDelimiter, lit.openDelimiter?.withKind(.rawStringDelimiter(""))) - .with(\.closeDelimiter, lit.closeDelimiter?.withKind(.rawStringDelimiter(""))) + .with(\.openDelimiter, lit.openDelimiter?.with(\.tokenKind, .rawStringDelimiter(""))) + .with(\.closeDelimiter, lit.closeDelimiter?.with(\.tokenKind, .rawStringDelimiter(""))) } let delimiters = String(repeating: "#", count: maximumHashes + 1) return lit - .with(\.openDelimiter, lit.openDelimiter?.withKind(.rawStringDelimiter(delimiters))) - .with(\.closeDelimiter, lit.closeDelimiter?.withKind(.rawStringDelimiter(delimiters))) + .with(\.openDelimiter, lit.openDelimiter?.with(\.tokenKind, .rawStringDelimiter(delimiters))) + .with(\.closeDelimiter, lit.closeDelimiter?.with(\.tokenKind, .rawStringDelimiter(delimiters))) } } diff --git a/Sources/SwiftRefactor/RemoveSeparatorsFromIntegerLiteral.swift b/Sources/SwiftRefactor/RemoveSeparatorsFromIntegerLiteral.swift index 880b543fed8..ddd7c2f1318 100644 --- a/Sources/SwiftRefactor/RemoveSeparatorsFromIntegerLiteral.swift +++ b/Sources/SwiftRefactor/RemoveSeparatorsFromIntegerLiteral.swift @@ -32,6 +32,6 @@ public struct RemoveSeparatorsFromIntegerLiteral: RefactoringProvider { return lit } let formattedText = lit.digits.text.filter({ $0 != "_" }) - return lit.with(\.digits, lit.digits.withKind(.integerLiteral(formattedText))) + return lit.with(\.digits, lit.digits.with(\.tokenKind, .integerLiteral(formattedText))) } } diff --git a/Sources/SwiftSyntax/CMakeLists.txt b/Sources/SwiftSyntax/CMakeLists.txt index 3972f10ee73..2560ee6de90 100644 --- a/Sources/SwiftSyntax/CMakeLists.txt +++ b/Sources/SwiftSyntax/CMakeLists.txt @@ -35,7 +35,6 @@ add_swift_host_library(SwiftSyntax generated/raw/RawSyntaxValidation.swift generated/Keyword.swift - generated/Misc.swift generated/SyntaxAnyVisitor.swift generated/SyntaxBaseNodes.swift generated/SyntaxCollections.swift diff --git a/Sources/SwiftSyntax/SourcePresence.swift b/Sources/SwiftSyntax/SourcePresence.swift index f0bc492fbf7..9dbf122e25a 100644 --- a/Sources/SwiftSyntax/SourcePresence.swift +++ b/Sources/SwiftSyntax/SourcePresence.swift @@ -14,10 +14,10 @@ /// /// A `missing` node does not mean, necessarily, that the source item is /// considered "implicit", but rather that it was not found in the source. -public enum SourcePresence: String { +public enum SourcePresence { /// The syntax was authored by a human and found, or was generated. - case present = "Present" + case present /// The syntax was expected or optional, but not found in the source. - case missing = "Missing" + case missing } diff --git a/Sources/SwiftSyntax/Syntax.swift b/Sources/SwiftSyntax/Syntax.swift index 3b90ca08be8..7e4ce1deb06 100644 --- a/Sources/SwiftSyntax/Syntax.swift +++ b/Sources/SwiftSyntax/Syntax.swift @@ -95,10 +95,6 @@ public struct Syntax: SyntaxProtocol, SyntaxHashable { return self.raw.kind.syntaxNodeType.init(self)! } - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return self.raw.kind.syntaxNodeType.init(self)!.childNameForDiagnostics(index) - } - public func hash(into hasher: inout Hasher) { return data.nodeId.hash(into: &hasher) } @@ -174,12 +170,6 @@ public protocol SyntaxProtocol: CustomStringConvertible, /// The statically allowed structure of the syntax node. static var structure: SyntaxNodeStructure { get } - - /// Return a name with which the child at the given `index` can be referred to - /// in diagnostics. - /// Typically, you want to use `childNameInParent` on the child instead of - /// calling this method on the parent. - func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? } // Casting functions to specialized syntax nodes. @@ -216,18 +206,6 @@ public extension SyntaxProtocol { } } -public extension SyntaxProtocol { - /// If the parent has a dedicated "name for diagnostics" for this node, return it. - /// Otherwise, return `nil`. - var childNameInParent: String? { - if let parent = self.parent, let childName = parent.childNameForDiagnostics(self.index) { - return childName - } else { - return nil - } - } -} - extension SyntaxProtocol { var data: SyntaxData { return _syntaxNode.data @@ -265,19 +243,6 @@ public extension SyntaxProtocol { return SyntaxChildrenIndex(self.data.absoluteInfo) } - /// Whether or not this node is a token one. - var isToken: Bool { - return raw.isToken - } - - /// Whether or not this node represents an SyntaxCollection. - var isCollection: Bool { - // We need to provide a custom implementation for is(SyntaxCollection.self) - // since SyntaxCollection has generic or self requirements and can thus - // not be used as a method argument. - return raw.kind.isSyntaxCollection - } - /// Whether the tree contained by this layout has any /// - missing nodes or /// - unexpected nodes or @@ -306,18 +271,22 @@ public extension SyntaxProtocol { return data.parent.map(Syntax.init(_:)) } - /// The index of this node in the parent's children. - var indexInParent: Int { - return data.indexInParent - } - /// Whether or not this node has a parent. var hasParent: Bool { return parent != nil } - /// Recursively walks through the tree to find the token semantically before - /// this node. + var keyPathInParent: AnyKeyPath? { + guard let parent = self.parent else { + return nil + } + guard case .layout(let childrenKeyPaths) = parent.kind.syntaxNodeType.structure else { + return nil + } + return childrenKeyPaths[data.indexInParent] + } + + @available(*, deprecated, message: "Use previousToken(viewMode:) instead") var previousToken: TokenSyntax? { return self.previousToken(viewMode: .sourceAccurate) } @@ -342,8 +311,7 @@ public extension SyntaxProtocol { return parent.previousToken(viewMode: viewMode) } - /// Recursively walks through the tree to find the next token semantically - /// after this node. + @available(*, deprecated, message: "Use nextToken(viewMode:) instead") var nextToken: TokenSyntax? { return self.nextToken(viewMode: .sourceAccurate) } @@ -365,8 +333,7 @@ public extension SyntaxProtocol { return parent.nextToken(viewMode: viewMode) } - /// Returns the first token in this syntax node in the source accurate view of - /// the syntax tree. + @available(*, deprecated, message: "Use firstToken(viewMode: .sourceAccurate) instead") var firstToken: TokenSyntax? { return self.firstToken(viewMode: .sourceAccurate) } @@ -386,7 +353,7 @@ public extension SyntaxProtocol { return nil } - /// Returns the last token node that is part of this syntax node. + @available(*, deprecated, message: "Use lastToken(viewMode: .sourceAccurate) instead") var lastToken: TokenSyntax? { return self.lastToken(viewMode: .sourceAccurate) } @@ -702,12 +669,6 @@ public extension SyntaxProtocol { /// possible types a child node might have. public protocol SyntaxChildChoices: SyntaxProtocol {} -public extension SyntaxChildChoices { - func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return Syntax(self).childNameForDiagnostics(index) - } -} - /// Sequence of tokens that are part of the provided Syntax node. public struct TokenSequence: Sequence { public struct Iterator: IteratorProtocol { diff --git a/Sources/SwiftSyntax/SyntaxArena.swift b/Sources/SwiftSyntax/SyntaxArena.swift index 5a4f03eecb4..d4130987c5d 100644 --- a/Sources/SwiftSyntax/SyntaxArena.swift +++ b/Sources/SwiftSyntax/SyntaxArena.swift @@ -135,8 +135,7 @@ public class SyntaxArena { /// /// "managed" means it's empty, a part of "source buffer", or in the memory /// allocated by the underlying arena. - @_spi(RawSyntax) - public func contains(text: SyntaxText) -> Bool { + func contains(text: SyntaxText) -> Bool { return (text.isEmpty || allocator.contains(address: text.baseAddress!)) } } @@ -165,6 +164,7 @@ public class ParsingSyntaxArena: SyntaxArena { /// The interned buffer is guaranteed to be null-terminated. /// `contains(address _:)` is faster if the address is inside the memory /// range this function returned. + @_spi(RawSyntax) public func internSourceBuffer(_ buffer: UnsafeBufferPointer) -> UnsafeBufferPointer { let allocated = allocator.allocate( UInt8.self, diff --git a/Sources/SwiftSyntax/SyntaxChildren.swift b/Sources/SwiftSyntax/SyntaxChildren.swift index 6eb2d788ef0..bc3d086b84f 100644 --- a/Sources/SwiftSyntax/SyntaxChildren.swift +++ b/Sources/SwiftSyntax/SyntaxChildren.swift @@ -14,7 +14,7 @@ /// The data for an index in a syntax children collection that is not the end /// index. See `SyntaxChildrenIndex` for the representation of the end index. -public struct SyntaxChildrenIndexData: Comparable { +struct SyntaxChildrenIndexData: Comparable { /// The UTF-8 offset of the item at this index in the source file /// See `AbsoluteSyntaxPosition.offset` let offset: UInt32 @@ -25,7 +25,7 @@ public struct SyntaxChildrenIndexData: Comparable { /// See `SyntaxIdentifier.indexIntree` let indexInTree: SyntaxIndexInTree - public static func < ( + static func < ( lhs: SyntaxChildrenIndexData, rhs: SyntaxChildrenIndexData ) -> Bool { diff --git a/Sources/SwiftSyntax/TokenSyntax.swift b/Sources/SwiftSyntax/TokenSyntax.swift index 78f83af3426..838daeff2d1 100644 --- a/Sources/SwiftSyntax/TokenSyntax.swift +++ b/Sources/SwiftSyntax/TokenSyntax.swift @@ -68,22 +68,6 @@ public struct TokenSyntax: SyntaxProtocol, SyntaxHashable { return tokenKind.text } - public var rawTokenKind: RawTokenKind { - return tokenView.rawKind - } - - /// Returns a new TokenSyntax with its kind replaced - /// by the provided token kind. - public func withKind(_ tokenKind: TokenKind) -> TokenSyntax { - guard raw.kind == .token else { - fatalError("TokenSyntax must have token as its raw") - } - let arena = SyntaxArena() - let newRaw = tokenView.withKind(tokenKind, arena: arena) - let newData = data.replacingSelf(newRaw, arena: arena) - return TokenSyntax(newData) - } - /// The leading trivia (spaces, newlines, etc.) associated with this token. public var leadingTrivia: Trivia { get { @@ -110,7 +94,13 @@ public struct TokenSyntax: SyntaxProtocol, SyntaxHashable { return tokenView.formKind() } set { - self = withKind(newValue) + guard raw.kind == .token else { + fatalError("TokenSyntax must have token as its raw") + } + let arena = SyntaxArena() + let newRaw = tokenView.withKind(newValue, arena: arena) + let newData = data.replacingSelf(newRaw, arena: arena) + self = TokenSyntax(newData) } } @@ -139,10 +129,6 @@ public struct TokenSyntax: SyntaxProtocol, SyntaxHashable { return .layout([]) } - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } - /// If the token has a lexical error, the type of the error. public var tokenDiagnostic: TokenDiagnostic? { return tokenView.tokenDiagnostic diff --git a/Sources/SwiftSyntax/generated/Keyword.swift b/Sources/SwiftSyntax/generated/Keyword.swift index 789bab162ac..877671648de 100644 --- a/Sources/SwiftSyntax/generated/Keyword.swift +++ b/Sources/SwiftSyntax/generated/Keyword.swift @@ -12,13 +12,6 @@ // //===----------------------------------------------------------------------===// -/// Make `StaticString` equatable so we can use it as the raw value for Keyword. -extension StaticString: Equatable { - public static func == (lhs: StaticString, rhs: StaticString) -> Bool { - return SyntaxText(lhs) == SyntaxText(rhs) - } -} - @frozen // FIXME: Not actually stable, works around a miscompile public enum Keyword: UInt8, Hashable { case __consuming @@ -735,121 +728,6 @@ public enum Keyword: UInt8, Hashable { } } - /// Whether the token kind is switched from being an identifier to being a keyword in the lexer. - /// This is true for keywords that used to be considered non-contextual. - public var isLexerClassified: Bool { - switch self { - case .`Any`: - return true - case .`as`: - return true - case .`associatedtype`: - return true - case .`break`: - return true - case .`case`: - return true - case .`catch`: - return true - case .`class`: - return true - case .`continue`: - return true - case .`default`: - return true - case .`defer`: - return true - case .`deinit`: - return true - case .`do`: - return true - case .`else`: - return true - case .`enum`: - return true - case .`extension`: - return true - case .`fallthrough`: - return true - case .`false`: - return true - case .`fileprivate`: - return true - case .`for`: - return true - case .`func`: - return true - case .`guard`: - return true - case .`if`: - return true - case .`import`: - return true - case .`in`: - return true - case .`init`: - return true - case .`inout`: - return true - case .`internal`: - return true - case .`is`: - return true - case .`let`: - return true - case .`nil`: - return true - case .`operator`: - return true - case .`precedencegroup`: - return true - case .`private`: - return true - case .`protocol`: - return true - case .`public`: - return true - case .`repeat`: - return true - case .`rethrows`: - return true - case .`return`: - return true - case .`self`: - return true - case .`Self`: - return true - case .`static`: - return true - case .`struct`: - return true - case .`subscript`: - return true - case .`super`: - return true - case .`switch`: - return true - case .`throw`: - return true - case .`throws`: - return true - case .`true`: - return true - case .`try`: - return true - case .`typealias`: - return true - case .`var`: - return true - case .`where`: - return true - case .`while`: - return true - default: - return false - } - } - /// This is really unfortunate. Really, we should have a `switch` in /// `Keyword.defaultText` to return the keyword's kind but the constant lookup /// table is significantly faster. Ideally, we could also get the compiler to diff --git a/Sources/SwiftSyntax/generated/Misc.swift b/Sources/SwiftSyntax/generated/Misc.swift deleted file mode 100644 index 8d549a36a3a..00000000000 --- a/Sources/SwiftSyntax/generated/Misc.swift +++ /dev/null @@ -1,1372 +0,0 @@ -//// Automatically generated by generate-swiftsyntax -//// Do not edit directly! -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -extension Syntax { - public static var structure: SyntaxNodeStructure { - return .choices([ - .node(TokenSyntax.self), - .node(AccessPathComponentSyntax.self), - .node(AccessPathSyntax.self), - .node(AccessorBlockSyntax.self), - .node(AccessorDeclSyntax.self), - .node(AccessorListSyntax.self), - .node(AccessorParameterSyntax.self), - .node(ActorDeclSyntax.self), - .node(ArrayElementListSyntax.self), - .node(ArrayElementSyntax.self), - .node(ArrayExprSyntax.self), - .node(ArrayTypeSyntax.self), - .node(ArrowExprSyntax.self), - .node(AsExprSyntax.self), - .node(AssignmentExprSyntax.self), - .node(AssociatedtypeDeclSyntax.self), - .node(AttributeListSyntax.self), - .node(AttributeSyntax.self), - .node(AttributedTypeSyntax.self), - .node(AvailabilityArgumentSyntax.self), - .node(AvailabilityConditionSyntax.self), - .node(AvailabilityEntrySyntax.self), - .node(AvailabilityLabeledArgumentSyntax.self), - .node(AvailabilitySpecListSyntax.self), - .node(AvailabilityVersionRestrictionListEntrySyntax.self), - .node(AvailabilityVersionRestrictionListSyntax.self), - .node(AvailabilityVersionRestrictionSyntax.self), - .node(AwaitExprSyntax.self), - .node(BackDeployedAttributeSpecListSyntax.self), - .node(BinaryOperatorExprSyntax.self), - .node(BooleanLiteralExprSyntax.self), - .node(BorrowExprSyntax.self), - .node(BreakStmtSyntax.self), - .node(CaseItemListSyntax.self), - .node(CaseItemSyntax.self), - .node(CatchClauseListSyntax.self), - .node(CatchClauseSyntax.self), - .node(CatchItemListSyntax.self), - .node(CatchItemSyntax.self), - .node(ClassDeclSyntax.self), - .node(ClassRestrictionTypeSyntax.self), - .node(ClosureCaptureItemListSyntax.self), - .node(ClosureCaptureItemSpecifierSyntax.self), - .node(ClosureCaptureItemSyntax.self), - .node(ClosureCaptureSignatureSyntax.self), - .node(ClosureExprSyntax.self), - .node(ClosureParamListSyntax.self), - .node(ClosureParamSyntax.self), - .node(ClosureParameterClauseSyntax.self), - .node(ClosureParameterListSyntax.self), - .node(ClosureParameterSyntax.self), - .node(ClosureSignatureSyntax.self), - .node(CodeBlockItemListSyntax.self), - .node(CodeBlockItemSyntax.self), - .node(CodeBlockSyntax.self), - .node(CompositionTypeElementListSyntax.self), - .node(CompositionTypeElementSyntax.self), - .node(CompositionTypeSyntax.self), - .node(ConditionElementListSyntax.self), - .node(ConditionElementSyntax.self), - .node(ConformanceRequirementSyntax.self), - .node(ConstrainedSugarTypeSyntax.self), - .node(ContinueStmtSyntax.self), - .node(ConventionAttributeArgumentsSyntax.self), - .node(ConventionWitnessMethodAttributeArgumentsSyntax.self), - .node(DeclEffectSpecifiersSyntax.self), - .node(DeclModifierDetailSyntax.self), - .node(DeclModifierSyntax.self), - .node(DeclNameArgumentListSyntax.self), - .node(DeclNameArgumentSyntax.self), - .node(DeclNameArgumentsSyntax.self), - .node(DeclNameSyntax.self), - .node(DeferStmtSyntax.self), - .node(DeinitializerDeclSyntax.self), - .node(DerivativeRegistrationAttributeArgumentsSyntax.self), - .node(DesignatedTypeElementSyntax.self), - .node(DesignatedTypeListSyntax.self), - .node(DictionaryElementListSyntax.self), - .node(DictionaryElementSyntax.self), - .node(DictionaryExprSyntax.self), - .node(DictionaryTypeSyntax.self), - .node(DifferentiabilityParamListSyntax.self), - .node(DifferentiabilityParamSyntax.self), - .node(DifferentiabilityParamsClauseSyntax.self), - .node(DifferentiabilityParamsSyntax.self), - .node(DifferentiableAttributeArgumentsSyntax.self), - .node(DiscardAssignmentExprSyntax.self), - .node(DoStmtSyntax.self), - .node(DocumentationAttributeArgumentSyntax.self), - .node(DocumentationAttributeArgumentsSyntax.self), - .node(DynamicReplacementArgumentsSyntax.self), - .node(EditorPlaceholderDeclSyntax.self), - .node(EditorPlaceholderExprSyntax.self), - .node(EffectsArgumentsSyntax.self), - .node(EnumCaseDeclSyntax.self), - .node(EnumCaseElementListSyntax.self), - .node(EnumCaseElementSyntax.self), - .node(EnumCaseParameterClauseSyntax.self), - .node(EnumCaseParameterListSyntax.self), - .node(EnumCaseParameterSyntax.self), - .node(EnumDeclSyntax.self), - .node(ExposeAttributeArgumentsSyntax.self), - .node(ExprListSyntax.self), - .node(ExpressionPatternSyntax.self), - .node(ExpressionSegmentSyntax.self), - .node(ExpressionStmtSyntax.self), - .node(ExtensionDeclSyntax.self), - .node(FallthroughStmtSyntax.self), - .node(FloatLiteralExprSyntax.self), - .node(ForInStmtSyntax.self), - .node(ForcedValueExprSyntax.self), - .node(ForgetStmtSyntax.self), - .node(FunctionCallExprSyntax.self), - .node(FunctionDeclSyntax.self), - .node(FunctionParameterListSyntax.self), - .node(FunctionParameterSyntax.self), - .node(FunctionSignatureSyntax.self), - .node(FunctionTypeSyntax.self), - .node(GenericArgumentClauseSyntax.self), - .node(GenericArgumentListSyntax.self), - .node(GenericArgumentSyntax.self), - .node(GenericParameterClauseSyntax.self), - .node(GenericParameterListSyntax.self), - .node(GenericParameterSyntax.self), - .node(GenericRequirementListSyntax.self), - .node(GenericRequirementSyntax.self), - .node(GenericWhereClauseSyntax.self), - .node(GuardStmtSyntax.self), - .node(IdentifierExprSyntax.self), - .node(IdentifierPatternSyntax.self), - .node(IfConfigClauseListSyntax.self), - .node(IfConfigClauseSyntax.self), - .node(IfConfigDeclSyntax.self), - .node(IfExprSyntax.self), - .node(ImplementsAttributeArgumentsSyntax.self), - .node(ImplicitlyUnwrappedOptionalTypeSyntax.self), - .node(ImportDeclSyntax.self), - .node(InOutExprSyntax.self), - .node(InfixOperatorExprSyntax.self), - .node(InheritedTypeListSyntax.self), - .node(InheritedTypeSyntax.self), - .node(InitializerClauseSyntax.self), - .node(InitializerDeclSyntax.self), - .node(IntegerLiteralExprSyntax.self), - .node(IsExprSyntax.self), - .node(IsTypePatternSyntax.self), - .node(KeyPathComponentListSyntax.self), - .node(KeyPathComponentSyntax.self), - .node(KeyPathExprSyntax.self), - .node(KeyPathOptionalComponentSyntax.self), - .node(KeyPathPropertyComponentSyntax.self), - .node(KeyPathSubscriptComponentSyntax.self), - .node(LabeledSpecializeEntrySyntax.self), - .node(LabeledStmtSyntax.self), - .node(LayoutRequirementSyntax.self), - .node(MacroDeclSyntax.self), - .node(MacroExpansionDeclSyntax.self), - .node(MacroExpansionExprSyntax.self), - .node(MatchingPatternConditionSyntax.self), - .node(MemberAccessExprSyntax.self), - .node(MemberDeclBlockSyntax.self), - .node(MemberDeclListItemSyntax.self), - .node(MemberDeclListSyntax.self), - .node(MemberTypeIdentifierSyntax.self), - .node(MetatypeTypeSyntax.self), - .node(MissingDeclSyntax.self), - .node(MissingExprSyntax.self), - .node(MissingPatternSyntax.self), - .node(MissingStmtSyntax.self), - .node(MissingSyntax.self), - .node(MissingTypeSyntax.self), - .node(ModifierListSyntax.self), - .node(MoveExprSyntax.self), - .node(MultipleTrailingClosureElementListSyntax.self), - .node(MultipleTrailingClosureElementSyntax.self), - .node(NamedOpaqueReturnTypeSyntax.self), - .node(NilLiteralExprSyntax.self), - .node(ObjCSelectorPieceSyntax.self), - .node(ObjCSelectorSyntax.self), - .node(OpaqueReturnTypeOfAttributeArgumentsSyntax.self), - .node(OperatorDeclSyntax.self), - .node(OperatorPrecedenceAndTypesSyntax.self), - .node(OptionalBindingConditionSyntax.self), - .node(OptionalChainingExprSyntax.self), - .node(OptionalTypeSyntax.self), - .node(OriginallyDefinedInArgumentsSyntax.self), - .node(PackElementExprSyntax.self), - .node(PackExpansionExprSyntax.self), - .node(PackExpansionTypeSyntax.self), - .node(PackReferenceTypeSyntax.self), - .node(ParameterClauseSyntax.self), - .node(PatternBindingListSyntax.self), - .node(PatternBindingSyntax.self), - .node(PostfixIfConfigExprSyntax.self), - .node(PostfixUnaryExprSyntax.self), - .node(PoundSourceLocationArgsSyntax.self), - .node(PoundSourceLocationSyntax.self), - .node(PrecedenceGroupAssignmentSyntax.self), - .node(PrecedenceGroupAssociativitySyntax.self), - .node(PrecedenceGroupAttributeListSyntax.self), - .node(PrecedenceGroupDeclSyntax.self), - .node(PrecedenceGroupNameElementSyntax.self), - .node(PrecedenceGroupNameListSyntax.self), - .node(PrecedenceGroupRelationSyntax.self), - .node(PrefixOperatorExprSyntax.self), - .node(PrimaryAssociatedTypeClauseSyntax.self), - .node(PrimaryAssociatedTypeListSyntax.self), - .node(PrimaryAssociatedTypeSyntax.self), - .node(ProtocolDeclSyntax.self), - .node(QualifiedDeclNameSyntax.self), - .node(RegexLiteralExprSyntax.self), - .node(RepeatWhileStmtSyntax.self), - .node(ReturnClauseSyntax.self), - .node(ReturnStmtSyntax.self), - .node(SameTypeRequirementSyntax.self), - .node(SequenceExprSyntax.self), - .node(SimpleTypeIdentifierSyntax.self), - .node(SourceFileSyntax.self), - .node(SpecializeAttributeSpecListSyntax.self), - .node(SpecializeExprSyntax.self), - .node(StringLiteralExprSyntax.self), - .node(StringLiteralSegmentsSyntax.self), - .node(StringSegmentSyntax.self), - .node(StructDeclSyntax.self), - .node(SubscriptDeclSyntax.self), - .node(SubscriptExprSyntax.self), - .node(SuperRefExprSyntax.self), - .node(SwitchCaseLabelSyntax.self), - .node(SwitchCaseListSyntax.self), - .node(SwitchCaseSyntax.self), - .node(SwitchDefaultLabelSyntax.self), - .node(SwitchExprSyntax.self), - .node(TargetFunctionEntrySyntax.self), - .node(TernaryExprSyntax.self), - .node(ThrowStmtSyntax.self), - .node(TryExprSyntax.self), - .node(TupleExprElementListSyntax.self), - .node(TupleExprElementSyntax.self), - .node(TupleExprSyntax.self), - .node(TuplePatternElementListSyntax.self), - .node(TuplePatternElementSyntax.self), - .node(TuplePatternSyntax.self), - .node(TupleTypeElementListSyntax.self), - .node(TupleTypeElementSyntax.self), - .node(TupleTypeSyntax.self), - .node(TypeAnnotationSyntax.self), - .node(TypeEffectSpecifiersSyntax.self), - .node(TypeExprSyntax.self), - .node(TypeInheritanceClauseSyntax.self), - .node(TypeInitializerClauseSyntax.self), - .node(TypealiasDeclSyntax.self), - .node(UnavailableFromAsyncArgumentsSyntax.self), - .node(UnderscorePrivateAttributeArgumentsSyntax.self), - .node(UnexpectedNodesSyntax.self), - .node(UnresolvedAsExprSyntax.self), - .node(UnresolvedIsExprSyntax.self), - .node(UnresolvedPatternExprSyntax.self), - .node(UnresolvedTernaryExprSyntax.self), - .node(ValueBindingPatternSyntax.self), - .node(VariableDeclSyntax.self), - .node(VersionTupleSyntax.self), - .node(WhereClauseSyntax.self), - .node(WhileStmtSyntax.self), - .node(WildcardPatternSyntax.self), - .node(YieldExprListElementSyntax.self), - .node(YieldExprListSyntax.self), - .node(YieldListSyntax.self), - .node(YieldStmtSyntax.self) - ]) - } -} - -extension SyntaxKind { - public var syntaxNodeType: SyntaxProtocol.Type { - switch self { - case .token: - return TokenSyntax.self - case .accessPathComponent: - return AccessPathComponentSyntax.self - case .accessPath: - return AccessPathSyntax.self - case .accessorBlock: - return AccessorBlockSyntax.self - case .accessorDecl: - return AccessorDeclSyntax.self - case .accessorList: - return AccessorListSyntax.self - case .accessorParameter: - return AccessorParameterSyntax.self - case .actorDecl: - return ActorDeclSyntax.self - case .arrayElementList: - return ArrayElementListSyntax.self - case .arrayElement: - return ArrayElementSyntax.self - case .arrayExpr: - return ArrayExprSyntax.self - case .arrayType: - return ArrayTypeSyntax.self - case .arrowExpr: - return ArrowExprSyntax.self - case .asExpr: - return AsExprSyntax.self - case .assignmentExpr: - return AssignmentExprSyntax.self - case .associatedtypeDecl: - return AssociatedtypeDeclSyntax.self - case .attributeList: - return AttributeListSyntax.self - case .attribute: - return AttributeSyntax.self - case .attributedType: - return AttributedTypeSyntax.self - case .availabilityArgument: - return AvailabilityArgumentSyntax.self - case .availabilityCondition: - return AvailabilityConditionSyntax.self - case .availabilityEntry: - return AvailabilityEntrySyntax.self - case .availabilityLabeledArgument: - return AvailabilityLabeledArgumentSyntax.self - case .availabilitySpecList: - return AvailabilitySpecListSyntax.self - case .availabilityVersionRestrictionListEntry: - return AvailabilityVersionRestrictionListEntrySyntax.self - case .availabilityVersionRestrictionList: - return AvailabilityVersionRestrictionListSyntax.self - case .availabilityVersionRestriction: - return AvailabilityVersionRestrictionSyntax.self - case .awaitExpr: - return AwaitExprSyntax.self - case .backDeployedAttributeSpecList: - return BackDeployedAttributeSpecListSyntax.self - case .binaryOperatorExpr: - return BinaryOperatorExprSyntax.self - case .booleanLiteralExpr: - return BooleanLiteralExprSyntax.self - case .borrowExpr: - return BorrowExprSyntax.self - case .breakStmt: - return BreakStmtSyntax.self - case .caseItemList: - return CaseItemListSyntax.self - case .caseItem: - return CaseItemSyntax.self - case .catchClauseList: - return CatchClauseListSyntax.self - case .catchClause: - return CatchClauseSyntax.self - case .catchItemList: - return CatchItemListSyntax.self - case .catchItem: - return CatchItemSyntax.self - case .classDecl: - return ClassDeclSyntax.self - case .classRestrictionType: - return ClassRestrictionTypeSyntax.self - case .closureCaptureItemList: - return ClosureCaptureItemListSyntax.self - case .closureCaptureItemSpecifier: - return ClosureCaptureItemSpecifierSyntax.self - case .closureCaptureItem: - return ClosureCaptureItemSyntax.self - case .closureCaptureSignature: - return ClosureCaptureSignatureSyntax.self - case .closureExpr: - return ClosureExprSyntax.self - case .closureParamList: - return ClosureParamListSyntax.self - case .closureParam: - return ClosureParamSyntax.self - case .closureParameterClause: - return ClosureParameterClauseSyntax.self - case .closureParameterList: - return ClosureParameterListSyntax.self - case .closureParameter: - return ClosureParameterSyntax.self - case .closureSignature: - return ClosureSignatureSyntax.self - case .codeBlockItemList: - return CodeBlockItemListSyntax.self - case .codeBlockItem: - return CodeBlockItemSyntax.self - case .codeBlock: - return CodeBlockSyntax.self - case .compositionTypeElementList: - return CompositionTypeElementListSyntax.self - case .compositionTypeElement: - return CompositionTypeElementSyntax.self - case .compositionType: - return CompositionTypeSyntax.self - case .conditionElementList: - return ConditionElementListSyntax.self - case .conditionElement: - return ConditionElementSyntax.self - case .conformanceRequirement: - return ConformanceRequirementSyntax.self - case .constrainedSugarType: - return ConstrainedSugarTypeSyntax.self - case .continueStmt: - return ContinueStmtSyntax.self - case .conventionAttributeArguments: - return ConventionAttributeArgumentsSyntax.self - case .conventionWitnessMethodAttributeArguments: - return ConventionWitnessMethodAttributeArgumentsSyntax.self - case .declEffectSpecifiers: - return DeclEffectSpecifiersSyntax.self - case .declModifierDetail: - return DeclModifierDetailSyntax.self - case .declModifier: - return DeclModifierSyntax.self - case .declNameArgumentList: - return DeclNameArgumentListSyntax.self - case .declNameArgument: - return DeclNameArgumentSyntax.self - case .declNameArguments: - return DeclNameArgumentsSyntax.self - case .declName: - return DeclNameSyntax.self - case .deferStmt: - return DeferStmtSyntax.self - case .deinitializerDecl: - return DeinitializerDeclSyntax.self - case .derivativeRegistrationAttributeArguments: - return DerivativeRegistrationAttributeArgumentsSyntax.self - case .designatedTypeElement: - return DesignatedTypeElementSyntax.self - case .designatedTypeList: - return DesignatedTypeListSyntax.self - case .dictionaryElementList: - return DictionaryElementListSyntax.self - case .dictionaryElement: - return DictionaryElementSyntax.self - case .dictionaryExpr: - return DictionaryExprSyntax.self - case .dictionaryType: - return DictionaryTypeSyntax.self - case .differentiabilityParamList: - return DifferentiabilityParamListSyntax.self - case .differentiabilityParam: - return DifferentiabilityParamSyntax.self - case .differentiabilityParamsClause: - return DifferentiabilityParamsClauseSyntax.self - case .differentiabilityParams: - return DifferentiabilityParamsSyntax.self - case .differentiableAttributeArguments: - return DifferentiableAttributeArgumentsSyntax.self - case .discardAssignmentExpr: - return DiscardAssignmentExprSyntax.self - case .doStmt: - return DoStmtSyntax.self - case .documentationAttributeArgument: - return DocumentationAttributeArgumentSyntax.self - case .documentationAttributeArguments: - return DocumentationAttributeArgumentsSyntax.self - case .dynamicReplacementArguments: - return DynamicReplacementArgumentsSyntax.self - case .editorPlaceholderDecl: - return EditorPlaceholderDeclSyntax.self - case .editorPlaceholderExpr: - return EditorPlaceholderExprSyntax.self - case .effectsArguments: - return EffectsArgumentsSyntax.self - case .enumCaseDecl: - return EnumCaseDeclSyntax.self - case .enumCaseElementList: - return EnumCaseElementListSyntax.self - case .enumCaseElement: - return EnumCaseElementSyntax.self - case .enumCaseParameterClause: - return EnumCaseParameterClauseSyntax.self - case .enumCaseParameterList: - return EnumCaseParameterListSyntax.self - case .enumCaseParameter: - return EnumCaseParameterSyntax.self - case .enumDecl: - return EnumDeclSyntax.self - case .exposeAttributeArguments: - return ExposeAttributeArgumentsSyntax.self - case .exprList: - return ExprListSyntax.self - case .expressionPattern: - return ExpressionPatternSyntax.self - case .expressionSegment: - return ExpressionSegmentSyntax.self - case .expressionStmt: - return ExpressionStmtSyntax.self - case .extensionDecl: - return ExtensionDeclSyntax.self - case .fallthroughStmt: - return FallthroughStmtSyntax.self - case .floatLiteralExpr: - return FloatLiteralExprSyntax.self - case .forInStmt: - return ForInStmtSyntax.self - case .forcedValueExpr: - return ForcedValueExprSyntax.self - case .forgetStmt: - return ForgetStmtSyntax.self - case .functionCallExpr: - return FunctionCallExprSyntax.self - case .functionDecl: - return FunctionDeclSyntax.self - case .functionParameterList: - return FunctionParameterListSyntax.self - case .functionParameter: - return FunctionParameterSyntax.self - case .functionSignature: - return FunctionSignatureSyntax.self - case .functionType: - return FunctionTypeSyntax.self - case .genericArgumentClause: - return GenericArgumentClauseSyntax.self - case .genericArgumentList: - return GenericArgumentListSyntax.self - case .genericArgument: - return GenericArgumentSyntax.self - case .genericParameterClause: - return GenericParameterClauseSyntax.self - case .genericParameterList: - return GenericParameterListSyntax.self - case .genericParameter: - return GenericParameterSyntax.self - case .genericRequirementList: - return GenericRequirementListSyntax.self - case .genericRequirement: - return GenericRequirementSyntax.self - case .genericWhereClause: - return GenericWhereClauseSyntax.self - case .guardStmt: - return GuardStmtSyntax.self - case .identifierExpr: - return IdentifierExprSyntax.self - case .identifierPattern: - return IdentifierPatternSyntax.self - case .ifConfigClauseList: - return IfConfigClauseListSyntax.self - case .ifConfigClause: - return IfConfigClauseSyntax.self - case .ifConfigDecl: - return IfConfigDeclSyntax.self - case .ifExpr: - return IfExprSyntax.self - case .implementsAttributeArguments: - return ImplementsAttributeArgumentsSyntax.self - case .implicitlyUnwrappedOptionalType: - return ImplicitlyUnwrappedOptionalTypeSyntax.self - case .importDecl: - return ImportDeclSyntax.self - case .inOutExpr: - return InOutExprSyntax.self - case .infixOperatorExpr: - return InfixOperatorExprSyntax.self - case .inheritedTypeList: - return InheritedTypeListSyntax.self - case .inheritedType: - return InheritedTypeSyntax.self - case .initializerClause: - return InitializerClauseSyntax.self - case .initializerDecl: - return InitializerDeclSyntax.self - case .integerLiteralExpr: - return IntegerLiteralExprSyntax.self - case .isExpr: - return IsExprSyntax.self - case .isTypePattern: - return IsTypePatternSyntax.self - case .keyPathComponentList: - return KeyPathComponentListSyntax.self - case .keyPathComponent: - return KeyPathComponentSyntax.self - case .keyPathExpr: - return KeyPathExprSyntax.self - case .keyPathOptionalComponent: - return KeyPathOptionalComponentSyntax.self - case .keyPathPropertyComponent: - return KeyPathPropertyComponentSyntax.self - case .keyPathSubscriptComponent: - return KeyPathSubscriptComponentSyntax.self - case .labeledSpecializeEntry: - return LabeledSpecializeEntrySyntax.self - case .labeledStmt: - return LabeledStmtSyntax.self - case .layoutRequirement: - return LayoutRequirementSyntax.self - case .macroDecl: - return MacroDeclSyntax.self - case .macroExpansionDecl: - return MacroExpansionDeclSyntax.self - case .macroExpansionExpr: - return MacroExpansionExprSyntax.self - case .matchingPatternCondition: - return MatchingPatternConditionSyntax.self - case .memberAccessExpr: - return MemberAccessExprSyntax.self - case .memberDeclBlock: - return MemberDeclBlockSyntax.self - case .memberDeclListItem: - return MemberDeclListItemSyntax.self - case .memberDeclList: - return MemberDeclListSyntax.self - case .memberTypeIdentifier: - return MemberTypeIdentifierSyntax.self - case .metatypeType: - return MetatypeTypeSyntax.self - case .missingDecl: - return MissingDeclSyntax.self - case .missingExpr: - return MissingExprSyntax.self - case .missingPattern: - return MissingPatternSyntax.self - case .missingStmt: - return MissingStmtSyntax.self - case .missing: - return MissingSyntax.self - case .missingType: - return MissingTypeSyntax.self - case .modifierList: - return ModifierListSyntax.self - case .moveExpr: - return MoveExprSyntax.self - case .multipleTrailingClosureElementList: - return MultipleTrailingClosureElementListSyntax.self - case .multipleTrailingClosureElement: - return MultipleTrailingClosureElementSyntax.self - case .namedOpaqueReturnType: - return NamedOpaqueReturnTypeSyntax.self - case .nilLiteralExpr: - return NilLiteralExprSyntax.self - case .objCSelectorPiece: - return ObjCSelectorPieceSyntax.self - case .objCSelector: - return ObjCSelectorSyntax.self - case .opaqueReturnTypeOfAttributeArguments: - return OpaqueReturnTypeOfAttributeArgumentsSyntax.self - case .operatorDecl: - return OperatorDeclSyntax.self - case .operatorPrecedenceAndTypes: - return OperatorPrecedenceAndTypesSyntax.self - case .optionalBindingCondition: - return OptionalBindingConditionSyntax.self - case .optionalChainingExpr: - return OptionalChainingExprSyntax.self - case .optionalType: - return OptionalTypeSyntax.self - case .originallyDefinedInArguments: - return OriginallyDefinedInArgumentsSyntax.self - case .packElementExpr: - return PackElementExprSyntax.self - case .packExpansionExpr: - return PackExpansionExprSyntax.self - case .packExpansionType: - return PackExpansionTypeSyntax.self - case .packReferenceType: - return PackReferenceTypeSyntax.self - case .parameterClause: - return ParameterClauseSyntax.self - case .patternBindingList: - return PatternBindingListSyntax.self - case .patternBinding: - return PatternBindingSyntax.self - case .postfixIfConfigExpr: - return PostfixIfConfigExprSyntax.self - case .postfixUnaryExpr: - return PostfixUnaryExprSyntax.self - case .poundSourceLocationArgs: - return PoundSourceLocationArgsSyntax.self - case .poundSourceLocation: - return PoundSourceLocationSyntax.self - case .precedenceGroupAssignment: - return PrecedenceGroupAssignmentSyntax.self - case .precedenceGroupAssociativity: - return PrecedenceGroupAssociativitySyntax.self - case .precedenceGroupAttributeList: - return PrecedenceGroupAttributeListSyntax.self - case .precedenceGroupDecl: - return PrecedenceGroupDeclSyntax.self - case .precedenceGroupNameElement: - return PrecedenceGroupNameElementSyntax.self - case .precedenceGroupNameList: - return PrecedenceGroupNameListSyntax.self - case .precedenceGroupRelation: - return PrecedenceGroupRelationSyntax.self - case .prefixOperatorExpr: - return PrefixOperatorExprSyntax.self - case .primaryAssociatedTypeClause: - return PrimaryAssociatedTypeClauseSyntax.self - case .primaryAssociatedTypeList: - return PrimaryAssociatedTypeListSyntax.self - case .primaryAssociatedType: - return PrimaryAssociatedTypeSyntax.self - case .protocolDecl: - return ProtocolDeclSyntax.self - case .qualifiedDeclName: - return QualifiedDeclNameSyntax.self - case .regexLiteralExpr: - return RegexLiteralExprSyntax.self - case .repeatWhileStmt: - return RepeatWhileStmtSyntax.self - case .returnClause: - return ReturnClauseSyntax.self - case .returnStmt: - return ReturnStmtSyntax.self - case .sameTypeRequirement: - return SameTypeRequirementSyntax.self - case .sequenceExpr: - return SequenceExprSyntax.self - case .simpleTypeIdentifier: - return SimpleTypeIdentifierSyntax.self - case .sourceFile: - return SourceFileSyntax.self - case .specializeAttributeSpecList: - return SpecializeAttributeSpecListSyntax.self - case .specializeExpr: - return SpecializeExprSyntax.self - case .stringLiteralExpr: - return StringLiteralExprSyntax.self - case .stringLiteralSegments: - return StringLiteralSegmentsSyntax.self - case .stringSegment: - return StringSegmentSyntax.self - case .structDecl: - return StructDeclSyntax.self - case .subscriptDecl: - return SubscriptDeclSyntax.self - case .subscriptExpr: - return SubscriptExprSyntax.self - case .superRefExpr: - return SuperRefExprSyntax.self - case .switchCaseLabel: - return SwitchCaseLabelSyntax.self - case .switchCaseList: - return SwitchCaseListSyntax.self - case .switchCase: - return SwitchCaseSyntax.self - case .switchDefaultLabel: - return SwitchDefaultLabelSyntax.self - case .switchExpr: - return SwitchExprSyntax.self - case .targetFunctionEntry: - return TargetFunctionEntrySyntax.self - case .ternaryExpr: - return TernaryExprSyntax.self - case .throwStmt: - return ThrowStmtSyntax.self - case .tryExpr: - return TryExprSyntax.self - case .tupleExprElementList: - return TupleExprElementListSyntax.self - case .tupleExprElement: - return TupleExprElementSyntax.self - case .tupleExpr: - return TupleExprSyntax.self - case .tuplePatternElementList: - return TuplePatternElementListSyntax.self - case .tuplePatternElement: - return TuplePatternElementSyntax.self - case .tuplePattern: - return TuplePatternSyntax.self - case .tupleTypeElementList: - return TupleTypeElementListSyntax.self - case .tupleTypeElement: - return TupleTypeElementSyntax.self - case .tupleType: - return TupleTypeSyntax.self - case .typeAnnotation: - return TypeAnnotationSyntax.self - case .typeEffectSpecifiers: - return TypeEffectSpecifiersSyntax.self - case .typeExpr: - return TypeExprSyntax.self - case .typeInheritanceClause: - return TypeInheritanceClauseSyntax.self - case .typeInitializerClause: - return TypeInitializerClauseSyntax.self - case .typealiasDecl: - return TypealiasDeclSyntax.self - case .unavailableFromAsyncArguments: - return UnavailableFromAsyncArgumentsSyntax.self - case .underscorePrivateAttributeArguments: - return UnderscorePrivateAttributeArgumentsSyntax.self - case .unexpectedNodes: - return UnexpectedNodesSyntax.self - case .unresolvedAsExpr: - return UnresolvedAsExprSyntax.self - case .unresolvedIsExpr: - return UnresolvedIsExprSyntax.self - case .unresolvedPatternExpr: - return UnresolvedPatternExprSyntax.self - case .unresolvedTernaryExpr: - return UnresolvedTernaryExprSyntax.self - case .valueBindingPattern: - return ValueBindingPatternSyntax.self - case .variableDecl: - return VariableDeclSyntax.self - case .versionTuple: - return VersionTupleSyntax.self - case .whereClause: - return WhereClauseSyntax.self - case .whileStmt: - return WhileStmtSyntax.self - case .wildcardPattern: - return WildcardPatternSyntax.self - case .yieldExprListElement: - return YieldExprListElementSyntax.self - case .yieldExprList: - return YieldExprListSyntax.self - case .yieldList: - return YieldListSyntax.self - case .yieldStmt: - return YieldStmtSyntax.self - } - } - - public var nameForDiagnostics: String? { - switch self { - case .token: - return "token" - case .accessPathComponent: - return nil - case .accessPath: - return nil - case .accessorBlock: - return nil - case .accessorDecl: - return "accessor" - case .accessorList: - return nil - case .accessorParameter: - return nil - case .actorDecl: - return "actor" - case .arrayElementList: - return nil - case .arrayElement: - return "array element" - case .arrayExpr: - return "array" - case .arrayType: - return "array type" - case .arrowExpr: - return nil - case .asExpr: - return "'as'" - case .assignmentExpr: - return nil - case .associatedtypeDecl: - return "associatedtype declaration" - case .attributeList: - return "attributes" - case .attribute: - return "attribute" - case .attributedType: - return "type" - case .availabilityArgument: - return "availability argument" - case .availabilityCondition: - return "availability condition" - case .availabilityEntry: - return "availability entry" - case .availabilityLabeledArgument: - return "availability argument" - case .availabilitySpecList: - return "'@availability' arguments" - case .availabilityVersionRestrictionListEntry: - return "version" - case .availabilityVersionRestrictionList: - return "version list" - case .availabilityVersionRestriction: - return "version restriction" - case .awaitExpr: - return "'await' expression" - case .backDeployedAttributeSpecList: - return "'@backDeployed' arguments" - case .binaryOperatorExpr: - return "operator" - case .booleanLiteralExpr: - return "bool literal" - case .borrowExpr: - return "'_borrow' expression" - case .breakStmt: - return "'break' statement" - case .caseItemList: - return nil - case .caseItem: - return nil - case .catchClauseList: - return "'catch' clause" - case .catchClause: - return "'catch' clause" - case .catchItemList: - return nil - case .catchItem: - return nil - case .classDecl: - return "class" - case .classRestrictionType: - return nil - case .closureCaptureItemList: - return nil - case .closureCaptureItemSpecifier: - return "closure capture specifier" - case .closureCaptureItem: - return "closure capture item" - case .closureCaptureSignature: - return "closure capture signature" - case .closureExpr: - return "closure" - case .closureParamList: - return nil - case .closureParam: - return "closure parameter" - case .closureParameterClause: - return "parameter clause" - case .closureParameterList: - return "parameter list" - case .closureParameter: - return "parameter" - case .closureSignature: - return "closure signature" - case .codeBlockItemList: - return nil - case .codeBlockItem: - return nil - case .codeBlock: - return "code block" - case .compositionTypeElementList: - return nil - case .compositionTypeElement: - return nil - case .compositionType: - return "type composition" - case .conditionElementList: - return nil - case .conditionElement: - return nil - case .conformanceRequirement: - return "conformance requirement" - case .constrainedSugarType: - return "type" - case .continueStmt: - return "'continue' statement" - case .conventionAttributeArguments: - return "@convention(...) arguments" - case .conventionWitnessMethodAttributeArguments: - return "@convention(...) arguments for witness methods" - case .declEffectSpecifiers: - return "effect specifiers" - case .declModifierDetail: - return nil - case .declModifier: - return "modifier" - case .declNameArgumentList: - return nil - case .declNameArgument: - return nil - case .declNameArguments: - return nil - case .declName: - return "declaration name" - case .deferStmt: - return "'defer' statement" - case .deinitializerDecl: - return "deinitializer" - case .derivativeRegistrationAttributeArguments: - return "attribute arguments" - case .designatedTypeElement: - return nil - case .designatedTypeList: - return nil - case .dictionaryElementList: - return nil - case .dictionaryElement: - return "dictionary element" - case .dictionaryExpr: - return "dictionary" - case .dictionaryType: - return "dictionary type" - case .differentiabilityParamList: - return "differentiability parameters" - case .differentiabilityParam: - return "differentiability parameter" - case .differentiabilityParamsClause: - return "'@differentiable' argument" - case .differentiabilityParams: - return "differentiability parameters" - case .differentiableAttributeArguments: - return "'@differentiable' arguments" - case .discardAssignmentExpr: - return nil - case .doStmt: - return "'do' statement" - case .documentationAttributeArgument: - return "@_documentation argument" - case .documentationAttributeArguments: - return "@_documentation arguments" - case .dynamicReplacementArguments: - return "@_dynamicReplacement argument" - case .editorPlaceholderDecl: - return "editor placeholder" - case .editorPlaceholderExpr: - return "editor placeholder" - case .effectsArguments: - return "@_effects arguments" - case .enumCaseDecl: - return "enum case" - case .enumCaseElementList: - return nil - case .enumCaseElement: - return nil - case .enumCaseParameterClause: - return "parameter clause" - case .enumCaseParameterList: - return "parameter list" - case .enumCaseParameter: - return "parameter" - case .enumDecl: - return "enum" - case .exposeAttributeArguments: - return "@_expose arguments" - case .exprList: - return nil - case .expressionPattern: - return "pattern" - case .expressionSegment: - return nil - case .expressionStmt: - return "expression" - case .extensionDecl: - return "extension" - case .fallthroughStmt: - return "'fallthrough' statement" - case .floatLiteralExpr: - return "floating literal" - case .forInStmt: - return "'for' statement" - case .forcedValueExpr: - return "force unwrap" - case .forgetStmt: - return "'forget' statement" - case .functionCallExpr: - return "function call" - case .functionDecl: - return "function" - case .functionParameterList: - return "parameter list" - case .functionParameter: - return "parameter" - case .functionSignature: - return "function signature" - case .functionType: - return "function type" - case .genericArgumentClause: - return "generic argument clause" - case .genericArgumentList: - return nil - case .genericArgument: - return "generic argument" - case .genericParameterClause: - return "generic parameter clause" - case .genericParameterList: - return nil - case .genericParameter: - return "generic parameter" - case .genericRequirementList: - return nil - case .genericRequirement: - return nil - case .genericWhereClause: - return "'where' clause" - case .guardStmt: - return "'guard' statement" - case .identifierExpr: - return nil - case .identifierPattern: - return "pattern" - case .ifConfigClauseList: - return nil - case .ifConfigClause: - return "conditional compilation clause" - case .ifConfigDecl: - return "conditional compilation block" - case .ifExpr: - return "'if' statement" - case .implementsAttributeArguments: - return "@_implements arguemnts" - case .implicitlyUnwrappedOptionalType: - return "implicitly unwrapped optional type" - case .importDecl: - return "import" - case .inOutExpr: - return "inout expression" - case .infixOperatorExpr: - return nil - case .inheritedTypeList: - return nil - case .inheritedType: - return "inherited type" - case .initializerClause: - return nil - case .initializerDecl: - return "initializer" - case .integerLiteralExpr: - return "integer literal" - case .isExpr: - return "'is'" - case .isTypePattern: - return "'is' pattern" - case .keyPathComponentList: - return nil - case .keyPathComponent: - return "key path component" - case .keyPathExpr: - return "key path" - case .keyPathOptionalComponent: - return "key path optional component" - case .keyPathPropertyComponent: - return "key path property component" - case .keyPathSubscriptComponent: - return "key path subscript component" - case .labeledSpecializeEntry: - return "attribute argument" - case .labeledStmt: - return "labeled statement" - case .layoutRequirement: - return "layout requirement" - case .macroDecl: - return "macro" - case .macroExpansionDecl: - return "macro expansion" - case .macroExpansionExpr: - return "macro expansion" - case .matchingPatternCondition: - return "pattern matching" - case .memberAccessExpr: - return "member access" - case .memberDeclBlock: - return "member block" - case .memberDeclListItem: - return nil - case .memberDeclList: - return nil - case .memberTypeIdentifier: - return "member type" - case .metatypeType: - return "metatype" - case .missingDecl: - return "declaration" - case .missingExpr: - return "expression" - case .missingPattern: - return "pattern" - case .missingStmt: - return "statement" - case .missing: - return nil - case .missingType: - return "type" - case .modifierList: - return nil - case .moveExpr: - return "'_move' expression" - case .multipleTrailingClosureElementList: - return nil - case .multipleTrailingClosureElement: - return "trailing closure" - case .namedOpaqueReturnType: - return "named opaque return type" - case .nilLiteralExpr: - return nil - case .objCSelectorPiece: - return "Objective-C selector piece" - case .objCSelector: - return "Objective-C selector" - case .opaqueReturnTypeOfAttributeArguments: - return "opaque return type arguments" - case .operatorDecl: - return "operator declaration" - case .operatorPrecedenceAndTypes: - return nil - case .optionalBindingCondition: - return "optional binding" - case .optionalChainingExpr: - return "optional chaining" - case .optionalType: - return "optional type" - case .originallyDefinedInArguments: - return "@_originallyDefinedIn arguments" - case .packElementExpr: - return nil - case .packExpansionExpr: - return nil - case .packExpansionType: - return "variadic expansion" - case .packReferenceType: - return "pack reference" - case .parameterClause: - return "parameter clause" - case .patternBindingList: - return nil - case .patternBinding: - return nil - case .postfixIfConfigExpr: - return nil - case .postfixUnaryExpr: - return "postfix expression" - case .poundSourceLocationArgs: - return "'#sourceLocation' arguments" - case .poundSourceLocation: - return "'#sourceLocation' directive" - case .precedenceGroupAssignment: - return "'assignment' property of precedencegroup" - case .precedenceGroupAssociativity: - return "'associativity' property of precedencegroup" - case .precedenceGroupAttributeList: - return nil - case .precedenceGroupDecl: - return "precedencegroup" - case .precedenceGroupNameElement: - return nil - case .precedenceGroupNameList: - return nil - case .precedenceGroupRelation: - return "'relation' property of precedencegroup" - case .prefixOperatorExpr: - return "operator" - case .primaryAssociatedTypeClause: - return "primary associated type clause" - case .primaryAssociatedTypeList: - return nil - case .primaryAssociatedType: - return nil - case .protocolDecl: - return "protocol" - case .qualifiedDeclName: - return "declaration name" - case .regexLiteralExpr: - return "regex literal" - case .repeatWhileStmt: - return "'repeat' statement" - case .returnClause: - return nil - case .returnStmt: - return "'return' statement" - case .sameTypeRequirement: - return "same type requirement" - case .sequenceExpr: - return nil - case .simpleTypeIdentifier: - return "type" - case .sourceFile: - return "source file" - case .specializeAttributeSpecList: - return "argument to '@_specialize" - case .specializeExpr: - return nil - case .stringLiteralExpr: - return "string literal" - case .stringLiteralSegments: - return nil - case .stringSegment: - return nil - case .structDecl: - return "struct" - case .subscriptDecl: - return "subscript" - case .subscriptExpr: - return "subscript" - case .superRefExpr: - return nil - case .switchCaseLabel: - return nil - case .switchCaseList: - return nil - case .switchCase: - return "switch case" - case .switchDefaultLabel: - return nil - case .switchExpr: - return "'switch' statement" - case .targetFunctionEntry: - return "attribute argument" - case .ternaryExpr: - return "ternay expression" - case .throwStmt: - return "'throw' statement" - case .tryExpr: - return "'try' expression" - case .tupleExprElementList: - return nil - case .tupleExprElement: - return nil - case .tupleExpr: - return "tuple" - case .tuplePatternElementList: - return nil - case .tuplePatternElement: - return nil - case .tuplePattern: - return "tuple pattern" - case .tupleTypeElementList: - return nil - case .tupleTypeElement: - return nil - case .tupleType: - return "tuple type" - case .typeAnnotation: - return "type annotation" - case .typeEffectSpecifiers: - return "effect specifiers" - case .typeExpr: - return nil - case .typeInheritanceClause: - return "inheritance clause" - case .typeInitializerClause: - return nil - case .typealiasDecl: - return "typealias declaration" - case .unavailableFromAsyncArguments: - return "@_unavailableFromAsync argument" - case .underscorePrivateAttributeArguments: - return "@_private argument" - case .unexpectedNodes: - return nil - case .unresolvedAsExpr: - return "'as'" - case .unresolvedIsExpr: - return "'is'" - case .unresolvedPatternExpr: - return nil - case .unresolvedTernaryExpr: - return "ternary operator" - case .valueBindingPattern: - return "value binding pattern" - case .variableDecl: - return "variable" - case .versionTuple: - return "version tuple" - case .whereClause: - return "'where' clause" - case .whileStmt: - return "'while' statement" - case .wildcardPattern: - return "wildcard pattern" - case .yieldExprListElement: - return nil - case .yieldExprList: - return "yield list" - case .yieldList: - return nil - case .yieldStmt: - return "'yield' statement" - } - } -} diff --git a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift index 304d5334ce8..a4b9fad17eb 100644 --- a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift +++ b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift @@ -147,10 +147,6 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable { .node(VariableDeclSyntax.self) ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return Syntax(self).childNameForDiagnostics(index) - } } extension DeclSyntax: CustomReflectable { @@ -320,10 +316,6 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable { .node(UnresolvedTernaryExprSyntax.self) ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return Syntax(self).childNameForDiagnostics(index) - } } extension ExprSyntax: CustomReflectable { @@ -452,10 +444,6 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable { .node(WildcardPatternSyntax.self) ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return Syntax(self).childNameForDiagnostics(index) - } } extension PatternSyntax: CustomReflectable { @@ -593,10 +581,6 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable { .node(YieldStmtSyntax.self) ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return Syntax(self).childNameForDiagnostics(index) - } } extension StmtSyntax: CustomReflectable { @@ -735,10 +719,6 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable { .node(TupleTypeSyntax.self) ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return Syntax(self).childNameForDiagnostics(index) - } } extension TypeSyntax: CustomReflectable { @@ -748,3 +728,278 @@ extension TypeSyntax: CustomReflectable { return Mirror(reflecting: Syntax(self).asProtocol(SyntaxProtocol.self)) } } + +extension Syntax { + public static var structure: SyntaxNodeStructure { + return .choices([ + .node(TokenSyntax.self), + .node(AccessPathComponentSyntax.self), + .node(AccessPathSyntax.self), + .node(AccessorBlockSyntax.self), + .node(AccessorDeclSyntax.self), + .node(AccessorListSyntax.self), + .node(AccessorParameterSyntax.self), + .node(ActorDeclSyntax.self), + .node(ArrayElementListSyntax.self), + .node(ArrayElementSyntax.self), + .node(ArrayExprSyntax.self), + .node(ArrayTypeSyntax.self), + .node(ArrowExprSyntax.self), + .node(AsExprSyntax.self), + .node(AssignmentExprSyntax.self), + .node(AssociatedtypeDeclSyntax.self), + .node(AttributeListSyntax.self), + .node(AttributeSyntax.self), + .node(AttributedTypeSyntax.self), + .node(AvailabilityArgumentSyntax.self), + .node(AvailabilityConditionSyntax.self), + .node(AvailabilityEntrySyntax.self), + .node(AvailabilityLabeledArgumentSyntax.self), + .node(AvailabilitySpecListSyntax.self), + .node(AvailabilityVersionRestrictionListEntrySyntax.self), + .node(AvailabilityVersionRestrictionListSyntax.self), + .node(AvailabilityVersionRestrictionSyntax.self), + .node(AwaitExprSyntax.self), + .node(BackDeployedAttributeSpecListSyntax.self), + .node(BinaryOperatorExprSyntax.self), + .node(BooleanLiteralExprSyntax.self), + .node(BorrowExprSyntax.self), + .node(BreakStmtSyntax.self), + .node(CaseItemListSyntax.self), + .node(CaseItemSyntax.self), + .node(CatchClauseListSyntax.self), + .node(CatchClauseSyntax.self), + .node(CatchItemListSyntax.self), + .node(CatchItemSyntax.self), + .node(ClassDeclSyntax.self), + .node(ClassRestrictionTypeSyntax.self), + .node(ClosureCaptureItemListSyntax.self), + .node(ClosureCaptureItemSpecifierSyntax.self), + .node(ClosureCaptureItemSyntax.self), + .node(ClosureCaptureSignatureSyntax.self), + .node(ClosureExprSyntax.self), + .node(ClosureParamListSyntax.self), + .node(ClosureParamSyntax.self), + .node(ClosureParameterClauseSyntax.self), + .node(ClosureParameterListSyntax.self), + .node(ClosureParameterSyntax.self), + .node(ClosureSignatureSyntax.self), + .node(CodeBlockItemListSyntax.self), + .node(CodeBlockItemSyntax.self), + .node(CodeBlockSyntax.self), + .node(CompositionTypeElementListSyntax.self), + .node(CompositionTypeElementSyntax.self), + .node(CompositionTypeSyntax.self), + .node(ConditionElementListSyntax.self), + .node(ConditionElementSyntax.self), + .node(ConformanceRequirementSyntax.self), + .node(ConstrainedSugarTypeSyntax.self), + .node(ContinueStmtSyntax.self), + .node(ConventionAttributeArgumentsSyntax.self), + .node(ConventionWitnessMethodAttributeArgumentsSyntax.self), + .node(DeclEffectSpecifiersSyntax.self), + .node(DeclModifierDetailSyntax.self), + .node(DeclModifierSyntax.self), + .node(DeclNameArgumentListSyntax.self), + .node(DeclNameArgumentSyntax.self), + .node(DeclNameArgumentsSyntax.self), + .node(DeclNameSyntax.self), + .node(DeferStmtSyntax.self), + .node(DeinitializerDeclSyntax.self), + .node(DerivativeRegistrationAttributeArgumentsSyntax.self), + .node(DesignatedTypeElementSyntax.self), + .node(DesignatedTypeListSyntax.self), + .node(DictionaryElementListSyntax.self), + .node(DictionaryElementSyntax.self), + .node(DictionaryExprSyntax.self), + .node(DictionaryTypeSyntax.self), + .node(DifferentiabilityParamListSyntax.self), + .node(DifferentiabilityParamSyntax.self), + .node(DifferentiabilityParamsClauseSyntax.self), + .node(DifferentiabilityParamsSyntax.self), + .node(DifferentiableAttributeArgumentsSyntax.self), + .node(DiscardAssignmentExprSyntax.self), + .node(DoStmtSyntax.self), + .node(DocumentationAttributeArgumentSyntax.self), + .node(DocumentationAttributeArgumentsSyntax.self), + .node(DynamicReplacementArgumentsSyntax.self), + .node(EditorPlaceholderDeclSyntax.self), + .node(EditorPlaceholderExprSyntax.self), + .node(EffectsArgumentsSyntax.self), + .node(EnumCaseDeclSyntax.self), + .node(EnumCaseElementListSyntax.self), + .node(EnumCaseElementSyntax.self), + .node(EnumCaseParameterClauseSyntax.self), + .node(EnumCaseParameterListSyntax.self), + .node(EnumCaseParameterSyntax.self), + .node(EnumDeclSyntax.self), + .node(ExposeAttributeArgumentsSyntax.self), + .node(ExprListSyntax.self), + .node(ExpressionPatternSyntax.self), + .node(ExpressionSegmentSyntax.self), + .node(ExpressionStmtSyntax.self), + .node(ExtensionDeclSyntax.self), + .node(FallthroughStmtSyntax.self), + .node(FloatLiteralExprSyntax.self), + .node(ForInStmtSyntax.self), + .node(ForcedValueExprSyntax.self), + .node(ForgetStmtSyntax.self), + .node(FunctionCallExprSyntax.self), + .node(FunctionDeclSyntax.self), + .node(FunctionParameterListSyntax.self), + .node(FunctionParameterSyntax.self), + .node(FunctionSignatureSyntax.self), + .node(FunctionTypeSyntax.self), + .node(GenericArgumentClauseSyntax.self), + .node(GenericArgumentListSyntax.self), + .node(GenericArgumentSyntax.self), + .node(GenericParameterClauseSyntax.self), + .node(GenericParameterListSyntax.self), + .node(GenericParameterSyntax.self), + .node(GenericRequirementListSyntax.self), + .node(GenericRequirementSyntax.self), + .node(GenericWhereClauseSyntax.self), + .node(GuardStmtSyntax.self), + .node(IdentifierExprSyntax.self), + .node(IdentifierPatternSyntax.self), + .node(IfConfigClauseListSyntax.self), + .node(IfConfigClauseSyntax.self), + .node(IfConfigDeclSyntax.self), + .node(IfExprSyntax.self), + .node(ImplementsAttributeArgumentsSyntax.self), + .node(ImplicitlyUnwrappedOptionalTypeSyntax.self), + .node(ImportDeclSyntax.self), + .node(InOutExprSyntax.self), + .node(InfixOperatorExprSyntax.self), + .node(InheritedTypeListSyntax.self), + .node(InheritedTypeSyntax.self), + .node(InitializerClauseSyntax.self), + .node(InitializerDeclSyntax.self), + .node(IntegerLiteralExprSyntax.self), + .node(IsExprSyntax.self), + .node(IsTypePatternSyntax.self), + .node(KeyPathComponentListSyntax.self), + .node(KeyPathComponentSyntax.self), + .node(KeyPathExprSyntax.self), + .node(KeyPathOptionalComponentSyntax.self), + .node(KeyPathPropertyComponentSyntax.self), + .node(KeyPathSubscriptComponentSyntax.self), + .node(LabeledSpecializeEntrySyntax.self), + .node(LabeledStmtSyntax.self), + .node(LayoutRequirementSyntax.self), + .node(MacroDeclSyntax.self), + .node(MacroExpansionDeclSyntax.self), + .node(MacroExpansionExprSyntax.self), + .node(MatchingPatternConditionSyntax.self), + .node(MemberAccessExprSyntax.self), + .node(MemberDeclBlockSyntax.self), + .node(MemberDeclListItemSyntax.self), + .node(MemberDeclListSyntax.self), + .node(MemberTypeIdentifierSyntax.self), + .node(MetatypeTypeSyntax.self), + .node(MissingDeclSyntax.self), + .node(MissingExprSyntax.self), + .node(MissingPatternSyntax.self), + .node(MissingStmtSyntax.self), + .node(MissingSyntax.self), + .node(MissingTypeSyntax.self), + .node(ModifierListSyntax.self), + .node(MoveExprSyntax.self), + .node(MultipleTrailingClosureElementListSyntax.self), + .node(MultipleTrailingClosureElementSyntax.self), + .node(NamedOpaqueReturnTypeSyntax.self), + .node(NilLiteralExprSyntax.self), + .node(ObjCSelectorPieceSyntax.self), + .node(ObjCSelectorSyntax.self), + .node(OpaqueReturnTypeOfAttributeArgumentsSyntax.self), + .node(OperatorDeclSyntax.self), + .node(OperatorPrecedenceAndTypesSyntax.self), + .node(OptionalBindingConditionSyntax.self), + .node(OptionalChainingExprSyntax.self), + .node(OptionalTypeSyntax.self), + .node(OriginallyDefinedInArgumentsSyntax.self), + .node(PackElementExprSyntax.self), + .node(PackExpansionExprSyntax.self), + .node(PackExpansionTypeSyntax.self), + .node(PackReferenceTypeSyntax.self), + .node(ParameterClauseSyntax.self), + .node(PatternBindingListSyntax.self), + .node(PatternBindingSyntax.self), + .node(PostfixIfConfigExprSyntax.self), + .node(PostfixUnaryExprSyntax.self), + .node(PoundSourceLocationArgsSyntax.self), + .node(PoundSourceLocationSyntax.self), + .node(PrecedenceGroupAssignmentSyntax.self), + .node(PrecedenceGroupAssociativitySyntax.self), + .node(PrecedenceGroupAttributeListSyntax.self), + .node(PrecedenceGroupDeclSyntax.self), + .node(PrecedenceGroupNameElementSyntax.self), + .node(PrecedenceGroupNameListSyntax.self), + .node(PrecedenceGroupRelationSyntax.self), + .node(PrefixOperatorExprSyntax.self), + .node(PrimaryAssociatedTypeClauseSyntax.self), + .node(PrimaryAssociatedTypeListSyntax.self), + .node(PrimaryAssociatedTypeSyntax.self), + .node(ProtocolDeclSyntax.self), + .node(QualifiedDeclNameSyntax.self), + .node(RegexLiteralExprSyntax.self), + .node(RepeatWhileStmtSyntax.self), + .node(ReturnClauseSyntax.self), + .node(ReturnStmtSyntax.self), + .node(SameTypeRequirementSyntax.self), + .node(SequenceExprSyntax.self), + .node(SimpleTypeIdentifierSyntax.self), + .node(SourceFileSyntax.self), + .node(SpecializeAttributeSpecListSyntax.self), + .node(SpecializeExprSyntax.self), + .node(StringLiteralExprSyntax.self), + .node(StringLiteralSegmentsSyntax.self), + .node(StringSegmentSyntax.self), + .node(StructDeclSyntax.self), + .node(SubscriptDeclSyntax.self), + .node(SubscriptExprSyntax.self), + .node(SuperRefExprSyntax.self), + .node(SwitchCaseLabelSyntax.self), + .node(SwitchCaseListSyntax.self), + .node(SwitchCaseSyntax.self), + .node(SwitchDefaultLabelSyntax.self), + .node(SwitchExprSyntax.self), + .node(TargetFunctionEntrySyntax.self), + .node(TernaryExprSyntax.self), + .node(ThrowStmtSyntax.self), + .node(TryExprSyntax.self), + .node(TupleExprElementListSyntax.self), + .node(TupleExprElementSyntax.self), + .node(TupleExprSyntax.self), + .node(TuplePatternElementListSyntax.self), + .node(TuplePatternElementSyntax.self), + .node(TuplePatternSyntax.self), + .node(TupleTypeElementListSyntax.self), + .node(TupleTypeElementSyntax.self), + .node(TupleTypeSyntax.self), + .node(TypeAnnotationSyntax.self), + .node(TypeEffectSpecifiersSyntax.self), + .node(TypeExprSyntax.self), + .node(TypeInheritanceClauseSyntax.self), + .node(TypeInitializerClauseSyntax.self), + .node(TypealiasDeclSyntax.self), + .node(UnavailableFromAsyncArgumentsSyntax.self), + .node(UnderscorePrivateAttributeArgumentsSyntax.self), + .node(UnexpectedNodesSyntax.self), + .node(UnresolvedAsExprSyntax.self), + .node(UnresolvedIsExprSyntax.self), + .node(UnresolvedPatternExprSyntax.self), + .node(UnresolvedTernaryExprSyntax.self), + .node(ValueBindingPatternSyntax.self), + .node(VariableDeclSyntax.self), + .node(VersionTupleSyntax.self), + .node(WhereClauseSyntax.self), + .node(WhileStmtSyntax.self), + .node(WildcardPatternSyntax.self), + .node(YieldExprListElementSyntax.self), + .node(YieldExprListSyntax.self), + .node(YieldListSyntax.self), + .node(YieldStmtSyntax.self) + ]) + } +} diff --git a/Sources/SwiftSyntax/generated/SyntaxCollections.swift b/Sources/SwiftSyntax/generated/SyntaxCollections.swift index cb42686c965..715791e6a21 100644 --- a/Sources/SwiftSyntax/generated/SyntaxCollections.swift +++ b/Sources/SwiftSyntax/generated/SyntaxCollections.swift @@ -34,8 +34,7 @@ public struct AccessPathSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -67,7 +66,7 @@ public struct AccessPathSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `AccessPathSyntax` by replacing the underlying layout with @@ -168,10 +167,6 @@ public struct AccessPathSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `AccessPathSyntax` to the `BidirectionalCollection` protocol. @@ -249,8 +244,7 @@ public struct AccessorListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -282,7 +276,7 @@ public struct AccessorListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `AccessorListSyntax` by replacing the underlying layout with @@ -383,10 +377,6 @@ public struct AccessorListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `AccessorListSyntax` to the `BidirectionalCollection` protocol. @@ -464,8 +454,7 @@ public struct ArrayElementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -497,7 +486,7 @@ public struct ArrayElementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ArrayElementListSyntax` by replacing the underlying layout with @@ -598,10 +587,6 @@ public struct ArrayElementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ArrayElementListSyntax` to the `BidirectionalCollection` protocol. @@ -722,8 +707,7 @@ public struct AttributeListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -755,7 +739,7 @@ public struct AttributeListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `AttributeListSyntax` by replacing the underlying layout with @@ -856,10 +840,6 @@ public struct AttributeListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `AttributeListSyntax` to the `BidirectionalCollection` protocol. @@ -937,8 +917,7 @@ public struct AvailabilitySpecListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -970,7 +949,7 @@ public struct AvailabilitySpecListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `AvailabilitySpecListSyntax` by replacing the underlying layout with @@ -1071,10 +1050,6 @@ public struct AvailabilitySpecListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `AvailabilitySpecListSyntax` to the `BidirectionalCollection` protocol. @@ -1152,8 +1127,7 @@ public struct AvailabilityVersionRestrictionListSyntax: SyntaxCollection, Syntax public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -1185,7 +1159,7 @@ public struct AvailabilityVersionRestrictionListSyntax: SyntaxCollection, Syntax /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `AvailabilityVersionRestrictionListSyntax` by replacing the underlying layout with @@ -1286,10 +1260,6 @@ public struct AvailabilityVersionRestrictionListSyntax: SyntaxCollection, Syntax newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `AvailabilityVersionRestrictionListSyntax` to the `BidirectionalCollection` protocol. @@ -1367,8 +1337,7 @@ public struct CaseItemListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -1400,7 +1369,7 @@ public struct CaseItemListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `CaseItemListSyntax` by replacing the underlying layout with @@ -1501,10 +1470,6 @@ public struct CaseItemListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `CaseItemListSyntax` to the `BidirectionalCollection` protocol. @@ -1582,8 +1547,7 @@ public struct CatchClauseListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -1615,7 +1579,7 @@ public struct CatchClauseListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `CatchClauseListSyntax` by replacing the underlying layout with @@ -1716,10 +1680,6 @@ public struct CatchClauseListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `CatchClauseListSyntax` to the `BidirectionalCollection` protocol. @@ -1797,8 +1757,7 @@ public struct CatchItemListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -1830,7 +1789,7 @@ public struct CatchItemListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `CatchItemListSyntax` by replacing the underlying layout with @@ -1931,10 +1890,6 @@ public struct CatchItemListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `CatchItemListSyntax` to the `BidirectionalCollection` protocol. @@ -2012,8 +1967,7 @@ public struct ClosureCaptureItemListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -2045,7 +1999,7 @@ public struct ClosureCaptureItemListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ClosureCaptureItemListSyntax` by replacing the underlying layout with @@ -2146,10 +2100,6 @@ public struct ClosureCaptureItemListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ClosureCaptureItemListSyntax` to the `BidirectionalCollection` protocol. @@ -2227,8 +2177,7 @@ public struct ClosureParamListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -2260,7 +2209,7 @@ public struct ClosureParamListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ClosureParamListSyntax` by replacing the underlying layout with @@ -2361,10 +2310,6 @@ public struct ClosureParamListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ClosureParamListSyntax` to the `BidirectionalCollection` protocol. @@ -2442,8 +2387,7 @@ public struct ClosureParameterListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -2475,7 +2419,7 @@ public struct ClosureParameterListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ClosureParameterListSyntax` by replacing the underlying layout with @@ -2576,10 +2520,6 @@ public struct ClosureParameterListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ClosureParameterListSyntax` to the `BidirectionalCollection` protocol. @@ -2657,8 +2597,7 @@ public struct CodeBlockItemListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -2690,7 +2629,7 @@ public struct CodeBlockItemListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `CodeBlockItemListSyntax` by replacing the underlying layout with @@ -2791,10 +2730,6 @@ public struct CodeBlockItemListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `CodeBlockItemListSyntax` to the `BidirectionalCollection` protocol. @@ -2872,8 +2807,7 @@ public struct CompositionTypeElementListSyntax: SyntaxCollection, SyntaxHashable public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -2905,7 +2839,7 @@ public struct CompositionTypeElementListSyntax: SyntaxCollection, SyntaxHashable /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `CompositionTypeElementListSyntax` by replacing the underlying layout with @@ -3006,10 +2940,6 @@ public struct CompositionTypeElementListSyntax: SyntaxCollection, SyntaxHashable newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `CompositionTypeElementListSyntax` to the `BidirectionalCollection` protocol. @@ -3087,8 +3017,7 @@ public struct ConditionElementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -3120,7 +3049,7 @@ public struct ConditionElementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ConditionElementListSyntax` by replacing the underlying layout with @@ -3221,10 +3150,6 @@ public struct ConditionElementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ConditionElementListSyntax` to the `BidirectionalCollection` protocol. @@ -3302,8 +3227,7 @@ public struct DeclNameArgumentListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -3335,7 +3259,7 @@ public struct DeclNameArgumentListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `DeclNameArgumentListSyntax` by replacing the underlying layout with @@ -3436,10 +3360,6 @@ public struct DeclNameArgumentListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `DeclNameArgumentListSyntax` to the `BidirectionalCollection` protocol. @@ -3517,8 +3437,7 @@ public struct DesignatedTypeListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -3550,7 +3469,7 @@ public struct DesignatedTypeListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `DesignatedTypeListSyntax` by replacing the underlying layout with @@ -3651,10 +3570,6 @@ public struct DesignatedTypeListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `DesignatedTypeListSyntax` to the `BidirectionalCollection` protocol. @@ -3732,8 +3647,7 @@ public struct DictionaryElementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -3765,7 +3679,7 @@ public struct DictionaryElementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `DictionaryElementListSyntax` by replacing the underlying layout with @@ -3866,10 +3780,6 @@ public struct DictionaryElementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `DictionaryElementListSyntax` to the `BidirectionalCollection` protocol. @@ -3947,8 +3857,7 @@ public struct DifferentiabilityParamListSyntax: SyntaxCollection, SyntaxHashable public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -3980,7 +3889,7 @@ public struct DifferentiabilityParamListSyntax: SyntaxCollection, SyntaxHashable /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `DifferentiabilityParamListSyntax` by replacing the underlying layout with @@ -4081,10 +3990,6 @@ public struct DifferentiabilityParamListSyntax: SyntaxCollection, SyntaxHashable newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `DifferentiabilityParamListSyntax` to the `BidirectionalCollection` protocol. @@ -4159,8 +4064,7 @@ public struct DocumentationAttributeArgumentsSyntax: SyntaxCollection, SyntaxHas public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -4192,7 +4096,7 @@ public struct DocumentationAttributeArgumentsSyntax: SyntaxCollection, SyntaxHas /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `DocumentationAttributeArgumentsSyntax` by replacing the underlying layout with @@ -4293,10 +4197,6 @@ public struct DocumentationAttributeArgumentsSyntax: SyntaxCollection, SyntaxHas newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `DocumentationAttributeArgumentsSyntax` to the `BidirectionalCollection` protocol. @@ -4371,8 +4271,7 @@ public struct EffectsArgumentsSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -4404,7 +4303,7 @@ public struct EffectsArgumentsSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `EffectsArgumentsSyntax` by replacing the underlying layout with @@ -4505,10 +4404,6 @@ public struct EffectsArgumentsSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `EffectsArgumentsSyntax` to the `BidirectionalCollection` protocol. @@ -4583,8 +4478,7 @@ public struct EnumCaseElementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -4616,7 +4510,7 @@ public struct EnumCaseElementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `EnumCaseElementListSyntax` by replacing the underlying layout with @@ -4717,10 +4611,6 @@ public struct EnumCaseElementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `EnumCaseElementListSyntax` to the `BidirectionalCollection` protocol. @@ -4798,8 +4688,7 @@ public struct EnumCaseParameterListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -4831,7 +4720,7 @@ public struct EnumCaseParameterListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `EnumCaseParameterListSyntax` by replacing the underlying layout with @@ -4932,10 +4821,6 @@ public struct EnumCaseParameterListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `EnumCaseParameterListSyntax` to the `BidirectionalCollection` protocol. @@ -5010,8 +4895,7 @@ public struct ExprListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -5043,7 +4927,7 @@ public struct ExprListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ExprListSyntax` by replacing the underlying layout with @@ -5144,10 +5028,6 @@ public struct ExprListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ExprListSyntax` to the `BidirectionalCollection` protocol. @@ -5225,8 +5105,7 @@ public struct FunctionParameterListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -5258,7 +5137,7 @@ public struct FunctionParameterListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `FunctionParameterListSyntax` by replacing the underlying layout with @@ -5359,10 +5238,6 @@ public struct FunctionParameterListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `FunctionParameterListSyntax` to the `BidirectionalCollection` protocol. @@ -5440,8 +5315,7 @@ public struct GenericArgumentListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -5473,7 +5347,7 @@ public struct GenericArgumentListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `GenericArgumentListSyntax` by replacing the underlying layout with @@ -5574,10 +5448,6 @@ public struct GenericArgumentListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `GenericArgumentListSyntax` to the `BidirectionalCollection` protocol. @@ -5655,8 +5525,7 @@ public struct GenericParameterListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -5688,7 +5557,7 @@ public struct GenericParameterListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `GenericParameterListSyntax` by replacing the underlying layout with @@ -5789,10 +5658,6 @@ public struct GenericParameterListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `GenericParameterListSyntax` to the `BidirectionalCollection` protocol. @@ -5870,8 +5735,7 @@ public struct GenericRequirementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -5903,7 +5767,7 @@ public struct GenericRequirementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `GenericRequirementListSyntax` by replacing the underlying layout with @@ -6004,10 +5868,6 @@ public struct GenericRequirementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `GenericRequirementListSyntax` to the `BidirectionalCollection` protocol. @@ -6085,8 +5945,7 @@ public struct IfConfigClauseListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -6118,7 +5977,7 @@ public struct IfConfigClauseListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `IfConfigClauseListSyntax` by replacing the underlying layout with @@ -6219,10 +6078,6 @@ public struct IfConfigClauseListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `IfConfigClauseListSyntax` to the `BidirectionalCollection` protocol. @@ -6300,8 +6155,7 @@ public struct InheritedTypeListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -6333,7 +6187,7 @@ public struct InheritedTypeListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `InheritedTypeListSyntax` by replacing the underlying layout with @@ -6434,10 +6288,6 @@ public struct InheritedTypeListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `InheritedTypeListSyntax` to the `BidirectionalCollection` protocol. @@ -6515,8 +6365,7 @@ public struct KeyPathComponentListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -6548,7 +6397,7 @@ public struct KeyPathComponentListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `KeyPathComponentListSyntax` by replacing the underlying layout with @@ -6649,10 +6498,6 @@ public struct KeyPathComponentListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `KeyPathComponentListSyntax` to the `BidirectionalCollection` protocol. @@ -6730,8 +6575,7 @@ public struct MemberDeclListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -6763,7 +6607,7 @@ public struct MemberDeclListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `MemberDeclListSyntax` by replacing the underlying layout with @@ -6864,10 +6708,6 @@ public struct MemberDeclListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `MemberDeclListSyntax` to the `BidirectionalCollection` protocol. @@ -6945,8 +6785,7 @@ public struct ModifierListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -6978,7 +6817,7 @@ public struct ModifierListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ModifierListSyntax` by replacing the underlying layout with @@ -7079,10 +6918,6 @@ public struct ModifierListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ModifierListSyntax` to the `BidirectionalCollection` protocol. @@ -7160,8 +6995,7 @@ public struct MultipleTrailingClosureElementListSyntax: SyntaxCollection, Syntax public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -7193,7 +7027,7 @@ public struct MultipleTrailingClosureElementListSyntax: SyntaxCollection, Syntax /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `MultipleTrailingClosureElementListSyntax` by replacing the underlying layout with @@ -7294,10 +7128,6 @@ public struct MultipleTrailingClosureElementListSyntax: SyntaxCollection, Syntax newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `MultipleTrailingClosureElementListSyntax` to the `BidirectionalCollection` protocol. @@ -7375,8 +7205,7 @@ public struct ObjCSelectorSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -7408,7 +7237,7 @@ public struct ObjCSelectorSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `ObjCSelectorSyntax` by replacing the underlying layout with @@ -7509,10 +7338,6 @@ public struct ObjCSelectorSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `ObjCSelectorSyntax` to the `BidirectionalCollection` protocol. @@ -7590,8 +7415,7 @@ public struct PatternBindingListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -7623,7 +7447,7 @@ public struct PatternBindingListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `PatternBindingListSyntax` by replacing the underlying layout with @@ -7724,10 +7548,6 @@ public struct PatternBindingListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `PatternBindingListSyntax` to the `BidirectionalCollection` protocol. @@ -7860,8 +7680,7 @@ public struct PrecedenceGroupAttributeListSyntax: SyntaxCollection, SyntaxHashab public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -7893,7 +7712,7 @@ public struct PrecedenceGroupAttributeListSyntax: SyntaxCollection, SyntaxHashab /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `PrecedenceGroupAttributeListSyntax` by replacing the underlying layout with @@ -7994,10 +7813,6 @@ public struct PrecedenceGroupAttributeListSyntax: SyntaxCollection, SyntaxHashab newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `PrecedenceGroupAttributeListSyntax` to the `BidirectionalCollection` protocol. @@ -8075,8 +7890,7 @@ public struct PrecedenceGroupNameListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -8108,7 +7922,7 @@ public struct PrecedenceGroupNameListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `PrecedenceGroupNameListSyntax` by replacing the underlying layout with @@ -8209,10 +8023,6 @@ public struct PrecedenceGroupNameListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `PrecedenceGroupNameListSyntax` to the `BidirectionalCollection` protocol. @@ -8290,8 +8100,7 @@ public struct PrimaryAssociatedTypeListSyntax: SyntaxCollection, SyntaxHashable public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -8323,7 +8132,7 @@ public struct PrimaryAssociatedTypeListSyntax: SyntaxCollection, SyntaxHashable /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `PrimaryAssociatedTypeListSyntax` by replacing the underlying layout with @@ -8424,10 +8233,6 @@ public struct PrimaryAssociatedTypeListSyntax: SyntaxCollection, SyntaxHashable newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `PrimaryAssociatedTypeListSyntax` to the `BidirectionalCollection` protocol. @@ -8570,8 +8375,7 @@ public struct SpecializeAttributeSpecListSyntax: SyntaxCollection, SyntaxHashabl public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -8603,7 +8407,7 @@ public struct SpecializeAttributeSpecListSyntax: SyntaxCollection, SyntaxHashabl /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `SpecializeAttributeSpecListSyntax` by replacing the underlying layout with @@ -8704,10 +8508,6 @@ public struct SpecializeAttributeSpecListSyntax: SyntaxCollection, SyntaxHashabl newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `SpecializeAttributeSpecListSyntax` to the `BidirectionalCollection` protocol. @@ -8828,8 +8628,7 @@ public struct StringLiteralSegmentsSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -8861,7 +8660,7 @@ public struct StringLiteralSegmentsSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `StringLiteralSegmentsSyntax` by replacing the underlying layout with @@ -8962,10 +8761,6 @@ public struct StringLiteralSegmentsSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `StringLiteralSegmentsSyntax` to the `BidirectionalCollection` protocol. @@ -9086,8 +8881,7 @@ public struct SwitchCaseListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -9119,7 +8913,7 @@ public struct SwitchCaseListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `SwitchCaseListSyntax` by replacing the underlying layout with @@ -9220,10 +9014,6 @@ public struct SwitchCaseListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `SwitchCaseListSyntax` to the `BidirectionalCollection` protocol. @@ -9301,8 +9091,7 @@ public struct TupleExprElementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -9334,7 +9123,7 @@ public struct TupleExprElementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `TupleExprElementListSyntax` by replacing the underlying layout with @@ -9435,10 +9224,6 @@ public struct TupleExprElementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `TupleExprElementListSyntax` to the `BidirectionalCollection` protocol. @@ -9516,8 +9301,7 @@ public struct TuplePatternElementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -9549,7 +9333,7 @@ public struct TuplePatternElementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `TuplePatternElementListSyntax` by replacing the underlying layout with @@ -9650,10 +9434,6 @@ public struct TuplePatternElementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `TuplePatternElementListSyntax` to the `BidirectionalCollection` protocol. @@ -9731,8 +9511,7 @@ public struct TupleTypeElementListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -9764,7 +9543,7 @@ public struct TupleTypeElementListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `TupleTypeElementListSyntax` by replacing the underlying layout with @@ -9865,10 +9644,6 @@ public struct TupleTypeElementListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `TupleTypeElementListSyntax` to the `BidirectionalCollection` protocol. @@ -9943,8 +9718,7 @@ public struct UnexpectedNodesSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -9976,7 +9750,7 @@ public struct UnexpectedNodesSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `UnexpectedNodesSyntax` by replacing the underlying layout with @@ -10077,10 +9851,6 @@ public struct UnexpectedNodesSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `UnexpectedNodesSyntax` to the `BidirectionalCollection` protocol. @@ -10158,8 +9928,7 @@ public struct YieldExprListSyntax: SyntaxCollection, SyntaxHashable { public let _syntaxNode: Syntax - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { + private var layoutView: RawSyntaxLayoutView { data.raw.layoutView! } @@ -10191,7 +9960,7 @@ public struct YieldExprListSyntax: SyntaxCollection, SyntaxHashable { /// The number of elements, `present` or `missing`, in this collection. public var count: Int { - return raw.layoutView!.children.count + return layoutView.children.count } /// Creates a new `YieldExprListSyntax` by replacing the underlying layout with @@ -10292,10 +10061,6 @@ public struct YieldExprListSyntax: SyntaxCollection, SyntaxHashable { newLayout.removeLast() return replacingLayout(newLayout) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - return nil - } } /// Conformance for `YieldExprListSyntax` to the `BidirectionalCollection` protocol. diff --git a/Sources/SwiftSyntax/generated/SyntaxKind.swift b/Sources/SwiftSyntax/generated/SyntaxKind.swift index 983c8b5b057..e551b4c9b4c 100644 --- a/Sources/SwiftSyntax/generated/SyntaxKind.swift +++ b/Sources/SwiftSyntax/generated/SyntaxKind.swift @@ -401,4 +401,545 @@ public enum SyntaxKind { return false } } + + public var syntaxNodeType: SyntaxProtocol.Type { + switch self { + case .token: + return TokenSyntax.self + case .accessPathComponent: + return AccessPathComponentSyntax.self + case .accessPath: + return AccessPathSyntax.self + case .accessorBlock: + return AccessorBlockSyntax.self + case .accessorDecl: + return AccessorDeclSyntax.self + case .accessorList: + return AccessorListSyntax.self + case .accessorParameter: + return AccessorParameterSyntax.self + case .actorDecl: + return ActorDeclSyntax.self + case .arrayElementList: + return ArrayElementListSyntax.self + case .arrayElement: + return ArrayElementSyntax.self + case .arrayExpr: + return ArrayExprSyntax.self + case .arrayType: + return ArrayTypeSyntax.self + case .arrowExpr: + return ArrowExprSyntax.self + case .asExpr: + return AsExprSyntax.self + case .assignmentExpr: + return AssignmentExprSyntax.self + case .associatedtypeDecl: + return AssociatedtypeDeclSyntax.self + case .attributeList: + return AttributeListSyntax.self + case .attribute: + return AttributeSyntax.self + case .attributedType: + return AttributedTypeSyntax.self + case .availabilityArgument: + return AvailabilityArgumentSyntax.self + case .availabilityCondition: + return AvailabilityConditionSyntax.self + case .availabilityEntry: + return AvailabilityEntrySyntax.self + case .availabilityLabeledArgument: + return AvailabilityLabeledArgumentSyntax.self + case .availabilitySpecList: + return AvailabilitySpecListSyntax.self + case .availabilityVersionRestrictionListEntry: + return AvailabilityVersionRestrictionListEntrySyntax.self + case .availabilityVersionRestrictionList: + return AvailabilityVersionRestrictionListSyntax.self + case .availabilityVersionRestriction: + return AvailabilityVersionRestrictionSyntax.self + case .awaitExpr: + return AwaitExprSyntax.self + case .backDeployedAttributeSpecList: + return BackDeployedAttributeSpecListSyntax.self + case .binaryOperatorExpr: + return BinaryOperatorExprSyntax.self + case .booleanLiteralExpr: + return BooleanLiteralExprSyntax.self + case .borrowExpr: + return BorrowExprSyntax.self + case .breakStmt: + return BreakStmtSyntax.self + case .caseItemList: + return CaseItemListSyntax.self + case .caseItem: + return CaseItemSyntax.self + case .catchClauseList: + return CatchClauseListSyntax.self + case .catchClause: + return CatchClauseSyntax.self + case .catchItemList: + return CatchItemListSyntax.self + case .catchItem: + return CatchItemSyntax.self + case .classDecl: + return ClassDeclSyntax.self + case .classRestrictionType: + return ClassRestrictionTypeSyntax.self + case .closureCaptureItemList: + return ClosureCaptureItemListSyntax.self + case .closureCaptureItemSpecifier: + return ClosureCaptureItemSpecifierSyntax.self + case .closureCaptureItem: + return ClosureCaptureItemSyntax.self + case .closureCaptureSignature: + return ClosureCaptureSignatureSyntax.self + case .closureExpr: + return ClosureExprSyntax.self + case .closureParamList: + return ClosureParamListSyntax.self + case .closureParam: + return ClosureParamSyntax.self + case .closureParameterClause: + return ClosureParameterClauseSyntax.self + case .closureParameterList: + return ClosureParameterListSyntax.self + case .closureParameter: + return ClosureParameterSyntax.self + case .closureSignature: + return ClosureSignatureSyntax.self + case .codeBlockItemList: + return CodeBlockItemListSyntax.self + case .codeBlockItem: + return CodeBlockItemSyntax.self + case .codeBlock: + return CodeBlockSyntax.self + case .compositionTypeElementList: + return CompositionTypeElementListSyntax.self + case .compositionTypeElement: + return CompositionTypeElementSyntax.self + case .compositionType: + return CompositionTypeSyntax.self + case .conditionElementList: + return ConditionElementListSyntax.self + case .conditionElement: + return ConditionElementSyntax.self + case .conformanceRequirement: + return ConformanceRequirementSyntax.self + case .constrainedSugarType: + return ConstrainedSugarTypeSyntax.self + case .continueStmt: + return ContinueStmtSyntax.self + case .conventionAttributeArguments: + return ConventionAttributeArgumentsSyntax.self + case .conventionWitnessMethodAttributeArguments: + return ConventionWitnessMethodAttributeArgumentsSyntax.self + case .declEffectSpecifiers: + return DeclEffectSpecifiersSyntax.self + case .declModifierDetail: + return DeclModifierDetailSyntax.self + case .declModifier: + return DeclModifierSyntax.self + case .declNameArgumentList: + return DeclNameArgumentListSyntax.self + case .declNameArgument: + return DeclNameArgumentSyntax.self + case .declNameArguments: + return DeclNameArgumentsSyntax.self + case .declName: + return DeclNameSyntax.self + case .deferStmt: + return DeferStmtSyntax.self + case .deinitializerDecl: + return DeinitializerDeclSyntax.self + case .derivativeRegistrationAttributeArguments: + return DerivativeRegistrationAttributeArgumentsSyntax.self + case .designatedTypeElement: + return DesignatedTypeElementSyntax.self + case .designatedTypeList: + return DesignatedTypeListSyntax.self + case .dictionaryElementList: + return DictionaryElementListSyntax.self + case .dictionaryElement: + return DictionaryElementSyntax.self + case .dictionaryExpr: + return DictionaryExprSyntax.self + case .dictionaryType: + return DictionaryTypeSyntax.self + case .differentiabilityParamList: + return DifferentiabilityParamListSyntax.self + case .differentiabilityParam: + return DifferentiabilityParamSyntax.self + case .differentiabilityParamsClause: + return DifferentiabilityParamsClauseSyntax.self + case .differentiabilityParams: + return DifferentiabilityParamsSyntax.self + case .differentiableAttributeArguments: + return DifferentiableAttributeArgumentsSyntax.self + case .discardAssignmentExpr: + return DiscardAssignmentExprSyntax.self + case .doStmt: + return DoStmtSyntax.self + case .documentationAttributeArgument: + return DocumentationAttributeArgumentSyntax.self + case .documentationAttributeArguments: + return DocumentationAttributeArgumentsSyntax.self + case .dynamicReplacementArguments: + return DynamicReplacementArgumentsSyntax.self + case .editorPlaceholderDecl: + return EditorPlaceholderDeclSyntax.self + case .editorPlaceholderExpr: + return EditorPlaceholderExprSyntax.self + case .effectsArguments: + return EffectsArgumentsSyntax.self + case .enumCaseDecl: + return EnumCaseDeclSyntax.self + case .enumCaseElementList: + return EnumCaseElementListSyntax.self + case .enumCaseElement: + return EnumCaseElementSyntax.self + case .enumCaseParameterClause: + return EnumCaseParameterClauseSyntax.self + case .enumCaseParameterList: + return EnumCaseParameterListSyntax.self + case .enumCaseParameter: + return EnumCaseParameterSyntax.self + case .enumDecl: + return EnumDeclSyntax.self + case .exposeAttributeArguments: + return ExposeAttributeArgumentsSyntax.self + case .exprList: + return ExprListSyntax.self + case .expressionPattern: + return ExpressionPatternSyntax.self + case .expressionSegment: + return ExpressionSegmentSyntax.self + case .expressionStmt: + return ExpressionStmtSyntax.self + case .extensionDecl: + return ExtensionDeclSyntax.self + case .fallthroughStmt: + return FallthroughStmtSyntax.self + case .floatLiteralExpr: + return FloatLiteralExprSyntax.self + case .forInStmt: + return ForInStmtSyntax.self + case .forcedValueExpr: + return ForcedValueExprSyntax.self + case .forgetStmt: + return ForgetStmtSyntax.self + case .functionCallExpr: + return FunctionCallExprSyntax.self + case .functionDecl: + return FunctionDeclSyntax.self + case .functionParameterList: + return FunctionParameterListSyntax.self + case .functionParameter: + return FunctionParameterSyntax.self + case .functionSignature: + return FunctionSignatureSyntax.self + case .functionType: + return FunctionTypeSyntax.self + case .genericArgumentClause: + return GenericArgumentClauseSyntax.self + case .genericArgumentList: + return GenericArgumentListSyntax.self + case .genericArgument: + return GenericArgumentSyntax.self + case .genericParameterClause: + return GenericParameterClauseSyntax.self + case .genericParameterList: + return GenericParameterListSyntax.self + case .genericParameter: + return GenericParameterSyntax.self + case .genericRequirementList: + return GenericRequirementListSyntax.self + case .genericRequirement: + return GenericRequirementSyntax.self + case .genericWhereClause: + return GenericWhereClauseSyntax.self + case .guardStmt: + return GuardStmtSyntax.self + case .identifierExpr: + return IdentifierExprSyntax.self + case .identifierPattern: + return IdentifierPatternSyntax.self + case .ifConfigClauseList: + return IfConfigClauseListSyntax.self + case .ifConfigClause: + return IfConfigClauseSyntax.self + case .ifConfigDecl: + return IfConfigDeclSyntax.self + case .ifExpr: + return IfExprSyntax.self + case .implementsAttributeArguments: + return ImplementsAttributeArgumentsSyntax.self + case .implicitlyUnwrappedOptionalType: + return ImplicitlyUnwrappedOptionalTypeSyntax.self + case .importDecl: + return ImportDeclSyntax.self + case .inOutExpr: + return InOutExprSyntax.self + case .infixOperatorExpr: + return InfixOperatorExprSyntax.self + case .inheritedTypeList: + return InheritedTypeListSyntax.self + case .inheritedType: + return InheritedTypeSyntax.self + case .initializerClause: + return InitializerClauseSyntax.self + case .initializerDecl: + return InitializerDeclSyntax.self + case .integerLiteralExpr: + return IntegerLiteralExprSyntax.self + case .isExpr: + return IsExprSyntax.self + case .isTypePattern: + return IsTypePatternSyntax.self + case .keyPathComponentList: + return KeyPathComponentListSyntax.self + case .keyPathComponent: + return KeyPathComponentSyntax.self + case .keyPathExpr: + return KeyPathExprSyntax.self + case .keyPathOptionalComponent: + return KeyPathOptionalComponentSyntax.self + case .keyPathPropertyComponent: + return KeyPathPropertyComponentSyntax.self + case .keyPathSubscriptComponent: + return KeyPathSubscriptComponentSyntax.self + case .labeledSpecializeEntry: + return LabeledSpecializeEntrySyntax.self + case .labeledStmt: + return LabeledStmtSyntax.self + case .layoutRequirement: + return LayoutRequirementSyntax.self + case .macroDecl: + return MacroDeclSyntax.self + case .macroExpansionDecl: + return MacroExpansionDeclSyntax.self + case .macroExpansionExpr: + return MacroExpansionExprSyntax.self + case .matchingPatternCondition: + return MatchingPatternConditionSyntax.self + case .memberAccessExpr: + return MemberAccessExprSyntax.self + case .memberDeclBlock: + return MemberDeclBlockSyntax.self + case .memberDeclListItem: + return MemberDeclListItemSyntax.self + case .memberDeclList: + return MemberDeclListSyntax.self + case .memberTypeIdentifier: + return MemberTypeIdentifierSyntax.self + case .metatypeType: + return MetatypeTypeSyntax.self + case .missingDecl: + return MissingDeclSyntax.self + case .missingExpr: + return MissingExprSyntax.self + case .missingPattern: + return MissingPatternSyntax.self + case .missingStmt: + return MissingStmtSyntax.self + case .missing: + return MissingSyntax.self + case .missingType: + return MissingTypeSyntax.self + case .modifierList: + return ModifierListSyntax.self + case .moveExpr: + return MoveExprSyntax.self + case .multipleTrailingClosureElementList: + return MultipleTrailingClosureElementListSyntax.self + case .multipleTrailingClosureElement: + return MultipleTrailingClosureElementSyntax.self + case .namedOpaqueReturnType: + return NamedOpaqueReturnTypeSyntax.self + case .nilLiteralExpr: + return NilLiteralExprSyntax.self + case .objCSelectorPiece: + return ObjCSelectorPieceSyntax.self + case .objCSelector: + return ObjCSelectorSyntax.self + case .opaqueReturnTypeOfAttributeArguments: + return OpaqueReturnTypeOfAttributeArgumentsSyntax.self + case .operatorDecl: + return OperatorDeclSyntax.self + case .operatorPrecedenceAndTypes: + return OperatorPrecedenceAndTypesSyntax.self + case .optionalBindingCondition: + return OptionalBindingConditionSyntax.self + case .optionalChainingExpr: + return OptionalChainingExprSyntax.self + case .optionalType: + return OptionalTypeSyntax.self + case .originallyDefinedInArguments: + return OriginallyDefinedInArgumentsSyntax.self + case .packElementExpr: + return PackElementExprSyntax.self + case .packExpansionExpr: + return PackExpansionExprSyntax.self + case .packExpansionType: + return PackExpansionTypeSyntax.self + case .packReferenceType: + return PackReferenceTypeSyntax.self + case .parameterClause: + return ParameterClauseSyntax.self + case .patternBindingList: + return PatternBindingListSyntax.self + case .patternBinding: + return PatternBindingSyntax.self + case .postfixIfConfigExpr: + return PostfixIfConfigExprSyntax.self + case .postfixUnaryExpr: + return PostfixUnaryExprSyntax.self + case .poundSourceLocationArgs: + return PoundSourceLocationArgsSyntax.self + case .poundSourceLocation: + return PoundSourceLocationSyntax.self + case .precedenceGroupAssignment: + return PrecedenceGroupAssignmentSyntax.self + case .precedenceGroupAssociativity: + return PrecedenceGroupAssociativitySyntax.self + case .precedenceGroupAttributeList: + return PrecedenceGroupAttributeListSyntax.self + case .precedenceGroupDecl: + return PrecedenceGroupDeclSyntax.self + case .precedenceGroupNameElement: + return PrecedenceGroupNameElementSyntax.self + case .precedenceGroupNameList: + return PrecedenceGroupNameListSyntax.self + case .precedenceGroupRelation: + return PrecedenceGroupRelationSyntax.self + case .prefixOperatorExpr: + return PrefixOperatorExprSyntax.self + case .primaryAssociatedTypeClause: + return PrimaryAssociatedTypeClauseSyntax.self + case .primaryAssociatedTypeList: + return PrimaryAssociatedTypeListSyntax.self + case .primaryAssociatedType: + return PrimaryAssociatedTypeSyntax.self + case .protocolDecl: + return ProtocolDeclSyntax.self + case .qualifiedDeclName: + return QualifiedDeclNameSyntax.self + case .regexLiteralExpr: + return RegexLiteralExprSyntax.self + case .repeatWhileStmt: + return RepeatWhileStmtSyntax.self + case .returnClause: + return ReturnClauseSyntax.self + case .returnStmt: + return ReturnStmtSyntax.self + case .sameTypeRequirement: + return SameTypeRequirementSyntax.self + case .sequenceExpr: + return SequenceExprSyntax.self + case .simpleTypeIdentifier: + return SimpleTypeIdentifierSyntax.self + case .sourceFile: + return SourceFileSyntax.self + case .specializeAttributeSpecList: + return SpecializeAttributeSpecListSyntax.self + case .specializeExpr: + return SpecializeExprSyntax.self + case .stringLiteralExpr: + return StringLiteralExprSyntax.self + case .stringLiteralSegments: + return StringLiteralSegmentsSyntax.self + case .stringSegment: + return StringSegmentSyntax.self + case .structDecl: + return StructDeclSyntax.self + case .subscriptDecl: + return SubscriptDeclSyntax.self + case .subscriptExpr: + return SubscriptExprSyntax.self + case .superRefExpr: + return SuperRefExprSyntax.self + case .switchCaseLabel: + return SwitchCaseLabelSyntax.self + case .switchCaseList: + return SwitchCaseListSyntax.self + case .switchCase: + return SwitchCaseSyntax.self + case .switchDefaultLabel: + return SwitchDefaultLabelSyntax.self + case .switchExpr: + return SwitchExprSyntax.self + case .targetFunctionEntry: + return TargetFunctionEntrySyntax.self + case .ternaryExpr: + return TernaryExprSyntax.self + case .throwStmt: + return ThrowStmtSyntax.self + case .tryExpr: + return TryExprSyntax.self + case .tupleExprElementList: + return TupleExprElementListSyntax.self + case .tupleExprElement: + return TupleExprElementSyntax.self + case .tupleExpr: + return TupleExprSyntax.self + case .tuplePatternElementList: + return TuplePatternElementListSyntax.self + case .tuplePatternElement: + return TuplePatternElementSyntax.self + case .tuplePattern: + return TuplePatternSyntax.self + case .tupleTypeElementList: + return TupleTypeElementListSyntax.self + case .tupleTypeElement: + return TupleTypeElementSyntax.self + case .tupleType: + return TupleTypeSyntax.self + case .typeAnnotation: + return TypeAnnotationSyntax.self + case .typeEffectSpecifiers: + return TypeEffectSpecifiersSyntax.self + case .typeExpr: + return TypeExprSyntax.self + case .typeInheritanceClause: + return TypeInheritanceClauseSyntax.self + case .typeInitializerClause: + return TypeInitializerClauseSyntax.self + case .typealiasDecl: + return TypealiasDeclSyntax.self + case .unavailableFromAsyncArguments: + return UnavailableFromAsyncArgumentsSyntax.self + case .underscorePrivateAttributeArguments: + return UnderscorePrivateAttributeArgumentsSyntax.self + case .unexpectedNodes: + return UnexpectedNodesSyntax.self + case .unresolvedAsExpr: + return UnresolvedAsExprSyntax.self + case .unresolvedIsExpr: + return UnresolvedIsExprSyntax.self + case .unresolvedPatternExpr: + return UnresolvedPatternExprSyntax.self + case .unresolvedTernaryExpr: + return UnresolvedTernaryExprSyntax.self + case .valueBindingPattern: + return ValueBindingPatternSyntax.self + case .variableDecl: + return VariableDeclSyntax.self + case .versionTuple: + return VersionTupleSyntax.self + case .whereClause: + return WhereClauseSyntax.self + case .whileStmt: + return WhileStmtSyntax.self + case .wildcardPattern: + return WildcardPatternSyntax.self + case .yieldExprListElement: + return YieldExprListElementSyntax.self + case .yieldExprList: + return YieldExprListSyntax.self + case .yieldList: + return YieldListSyntax.self + case .yieldStmt: + return YieldStmtSyntax.self + } + } } diff --git a/Sources/SwiftSyntax/generated/TokenKind.swift b/Sources/SwiftSyntax/generated/TokenKind.swift index 227f514f270..e3958611ec2 100644 --- a/Sources/SwiftSyntax/generated/TokenKind.swift +++ b/Sources/SwiftSyntax/generated/TokenKind.swift @@ -253,217 +253,6 @@ public enum TokenKind: Hashable { } } - public var nameForDiagnostics: String { - switch self { - case .eof: - return "end of file" - case .arrow: - return #"->"# - case .atSign: - return #"@"# - case .backslash: - return #"\"# - case .backtick: - return #"`"# - case .binaryOperator: - return #"binary operator"# - case .colon: - return #":"# - case .comma: - return #","# - case .dollarIdentifier: - return #"dollar identifier"# - case .ellipsis: - return #"..."# - case .equal: - return #"="# - case .exclamationMark: - return #"!"# - case .extendedRegexDelimiter: - return #"extended delimiter"# - case .floatingLiteral: - return #"floating literal"# - case .identifier: - return #"identifier"# - case .infixQuestionMark: - return #"?"# - case .integerLiteral: - return #"integer literal"# - case .leftAngle: - return #"<"# - case .leftBrace: - return #"{"# - case .leftParen: - return #"("# - case .leftSquareBracket: - return #"["# - case .multilineStringQuote: - return #"""""# - case .period: - return #"."# - case .postfixOperator: - return #"postfix operator"# - case .postfixQuestionMark: - return #"?"# - case .pound: - return #"#"# - case .poundAvailableKeyword: - return #"#available"# - case .poundElseKeyword: - return #"#else"# - case .poundElseifKeyword: - return #"#elseif"# - case .poundEndifKeyword: - return #"#endif"# - case .poundIfKeyword: - return #"#if"# - case .poundSourceLocationKeyword: - return #"#sourceLocation"# - case .poundUnavailableKeyword: - return #"#unavailable"# - case .prefixAmpersand: - return #"&"# - case .prefixOperator: - return #"prefix operator"# - case .rawStringDelimiter: - return #"raw string delimiter"# - case .regexLiteralPattern: - return #"regex pattern"# - case .regexSlash: - return #"/"# - case .rightAngle: - return #">"# - case .rightBrace: - return #"}"# - case .rightParen: - return #")"# - case .rightSquareBracket: - return #"]"# - case .semicolon: - return #";"# - case .singleQuote: - return #"'"# - case .stringQuote: - return #"""# - case .stringSegment: - return #"string segment"# - case .unknown: - return #"token"# - case .wildcard: - return #"wildcard"# - case .keyword(let keyword): - return String(syntaxText: keyword.defaultText) - } - } - - /// Returns `true` if the token is a Swift keyword. - /// - /// Keywords are reserved unconditionally for use by Swift and may not - /// appear as identifiers in any position without being escaped. For example, - /// `class`, `func`, or `import`. - public var isLexerClassifiedKeyword: Bool { - switch self { - case .eof: - return false - case .arrow: - return false - case .atSign: - return false - case .backslash: - return false - case .backtick: - return false - case .binaryOperator: - return false - case .colon: - return false - case .comma: - return false - case .dollarIdentifier: - return false - case .ellipsis: - return false - case .equal: - return false - case .exclamationMark: - return false - case .extendedRegexDelimiter: - return false - case .floatingLiteral: - return false - case .identifier: - return false - case .infixQuestionMark: - return false - case .integerLiteral: - return false - case .leftAngle: - return false - case .leftBrace: - return false - case .leftParen: - return false - case .leftSquareBracket: - return false - case .multilineStringQuote: - return false - case .period: - return false - case .postfixOperator: - return false - case .postfixQuestionMark: - return false - case .pound: - return false - case .poundAvailableKeyword: - return true - case .poundElseKeyword: - return true - case .poundElseifKeyword: - return true - case .poundEndifKeyword: - return true - case .poundIfKeyword: - return true - case .poundSourceLocationKeyword: - return true - case .poundUnavailableKeyword: - return true - case .prefixAmpersand: - return false - case .prefixOperator: - return false - case .rawStringDelimiter: - return false - case .regexLiteralPattern: - return false - case .regexSlash: - return false - case .rightAngle: - return false - case .rightBrace: - return false - case .rightParen: - return false - case .rightSquareBracket: - return false - case .semicolon: - return false - case .singleQuote: - return false - case .stringQuote: - return false - case .stringSegment: - return false - case .unknown: - return false - case .wildcard: - return false - case .keyword(let keyword): - return keyword.isLexerClassified - } - } - /// Returns `true` if the token is a Swift punctuator. /// /// Punctuation tokens generally separate identifiers from each other. For @@ -685,6 +474,7 @@ extension TokenKind: Equatable { // `RawTokenBaseKind` for equality. With the raw value, it compiles down to // a primitive integer compare, without, it calls into `__derived_enum_equals`. @frozen // FIXME: Not actually stable, works around a miscompile +@_spi(RawSyntax) public enum RawTokenKind: UInt8, Equatable, Hashable { case eof case arrow diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift index e746180f2c0..365262da656 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift @@ -248,39 +248,6 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return "parameter" - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - default: - fatalError("Invalid index") - } - } } extension AccessorDeclSyntax: CustomReflectable { @@ -610,47 +577,6 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterMembers ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return "type inheritance clause" - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension ActorDeclSyntax: CustomReflectable { @@ -958,43 +884,6 @@ public struct AssociatedtypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGenericWhereClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "inheritance clause" - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - default: - fatalError("Invalid index") - } - } } extension AssociatedtypeDeclSyntax: CustomReflectable { @@ -1326,47 +1215,6 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterMembers ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return "inheritance clause" - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension ClassDeclSyntax: CustomReflectable { @@ -1596,31 +1444,6 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension DeinitializerDeclSyntax: CustomReflectable { @@ -1714,19 +1537,6 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeIdentifier, \Self.identifier, \Self.unexpectedAfterIdentifier]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension EditorPlaceholderDeclSyntax: CustomReflectable { @@ -1964,31 +1774,6 @@ public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterElements ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return "elements" - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension EnumCaseDeclSyntax: CustomReflectable { @@ -2322,47 +2107,6 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterMembers ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return "inheritance clause" - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension EnumDeclSyntax: CustomReflectable { @@ -2670,43 +2414,6 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterMembers ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "inheritance clause" - case 10: - return nil - case 11: - return "generic where clause" - case 12: - return nil - case 13: - return nil - case 14: - return nil - default: - fatalError("Invalid index") - } - } } extension ExtensionDeclSyntax: CustomReflectable { @@ -3038,47 +2745,6 @@ public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return "function signature" - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension FunctionDeclSyntax: CustomReflectable { @@ -3237,23 +2903,6 @@ public struct IfConfigDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPoundEndif ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension IfConfigDeclSyntax: CustomReflectable { @@ -3516,35 +3165,6 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPath ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension ImportDeclSyntax: CustomReflectable { @@ -3872,47 +3492,6 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return "function signature" - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension InitializerDeclSyntax: CustomReflectable { @@ -4246,47 +3825,6 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGenericWhereClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return "macro signature" - case 12: - return nil - case 13: - return "macro definition" - case 14: - return nil - case 15: - return "generic where clause" - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension MacroDeclSyntax: CustomReflectable { @@ -4621,47 +4159,6 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterAdditionalTrailingClosures ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return nil - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension MacroExpansionDeclSyntax: CustomReflectable { @@ -4839,23 +4336,6 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterModifiers ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension MissingDeclSyntax: CustomReflectable { @@ -5102,35 +4582,6 @@ public struct OperatorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterOperatorPrecedenceAndTypes ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension OperatorDeclSyntax: CustomReflectable { @@ -5316,31 +4767,6 @@ public struct PoundSourceLocationSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "arguments" - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension PoundSourceLocationSyntax: CustomReflectable { @@ -5663,43 +5089,6 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightBrace ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return nil - case 14: - return nil - default: - fatalError("Invalid index") - } - } } extension PrecedenceGroupDeclSyntax: CustomReflectable { @@ -6031,47 +5420,6 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterMembers ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "primary associated type clause" - case 10: - return nil - case 11: - return "inheritance clause" - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension ProtocolDeclSyntax: CustomReflectable { @@ -6405,47 +5753,6 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterMembers ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return "type inheritance clause" - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension StructDeclSyntax: CustomReflectable { @@ -6821,47 +6128,6 @@ public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterAccessor ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return "generic parameter clause" - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension SubscriptDeclSyntax: CustomReflectable { @@ -7169,43 +6435,6 @@ public struct TypealiasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGenericWhereClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "generic parameter clause" - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return "generic where clause" - case 14: - return nil - default: - fatalError("Invalid index") - } - } } extension TypealiasDeclSyntax: CustomReflectable { @@ -7452,31 +6681,6 @@ public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBindings ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension VariableDeclSyntax: CustomReflectable { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift index ba423b3bf91..6a062c3adf3 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift @@ -170,27 +170,6 @@ public struct ArrayExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightSquare ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ArrayExprSyntax: CustomReflectable { @@ -320,23 +299,6 @@ public struct ArrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterArrowToken ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ArrowExprSyntax: CustomReflectable { @@ -516,31 +478,6 @@ public struct AsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTypeName ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension AsExprSyntax: CustomReflectable { @@ -634,19 +571,6 @@ public struct AssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeAssignToken, \Self.assignToken, \Self.unexpectedAfterAssignToken]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension AssignmentExprSyntax: CustomReflectable { @@ -771,23 +695,6 @@ public struct AwaitExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension AwaitExprSyntax: CustomReflectable { @@ -877,19 +784,6 @@ public struct BinaryOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeOperatorToken, \Self.operatorToken, \Self.unexpectedAfterOperatorToken]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension BinaryOperatorExprSyntax: CustomReflectable { @@ -976,19 +870,6 @@ public struct BooleanLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeBooleanLiteral, \Self.booleanLiteral, \Self.unexpectedAfterBooleanLiteral]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension BooleanLiteralExprSyntax: CustomReflectable { @@ -1113,23 +994,6 @@ public struct BorrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension BorrowExprSyntax: CustomReflectable { @@ -1328,31 +1192,6 @@ public struct ClosureExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightBrace ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureExprSyntax: CustomReflectable { @@ -1552,27 +1391,6 @@ public struct DictionaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightSquare ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension DictionaryExprSyntax: CustomReflectable { @@ -1664,19 +1482,6 @@ public struct DiscardAssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeWildcard, \Self.wildcard, \Self.unexpectedAfterWildcard]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension DiscardAssignmentExprSyntax: CustomReflectable { @@ -1763,19 +1568,6 @@ public struct EditorPlaceholderExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeIdentifier, \Self.identifier, \Self.unexpectedAfterIdentifier]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension EditorPlaceholderExprSyntax: CustomReflectable { @@ -1862,19 +1654,6 @@ public struct FloatLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeFloatingDigits, \Self.floatingDigits, \Self.unexpectedAfterFloatingDigits]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension FloatLiteralExprSyntax: CustomReflectable { @@ -1999,23 +1778,6 @@ public struct ForcedValueExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExclamationMark ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ForcedValueExprSyntax: CustomReflectable { @@ -2285,39 +2047,6 @@ public struct FunctionCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterAdditionalTrailingClosures ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "called expression" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "arguments" - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "trailing closure" - case 10: - return nil - case 11: - return "trailing closures" - case 12: - return nil - default: - fatalError("Invalid index") - } - } } extension FunctionCallExprSyntax: CustomReflectable { @@ -2453,23 +2182,6 @@ public struct IdentifierExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterDeclNameArguments ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension IdentifierExprSyntax: CustomReflectable { @@ -2736,35 +2448,6 @@ public struct IfExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterElseBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "body" - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "else body" - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension IfExprSyntax: CustomReflectable { @@ -2898,23 +2581,6 @@ public struct InOutExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension InOutExprSyntax: CustomReflectable { @@ -3068,27 +2734,6 @@ public struct InfixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightOperand ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension InfixOperatorExprSyntax: CustomReflectable { @@ -3180,19 +2825,6 @@ public struct IntegerLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeDigits, \Self.digits, \Self.unexpectedAfterDigits]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension IntegerLiteralExprSyntax: CustomReflectable { @@ -3343,27 +2975,6 @@ public struct IsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTypeName ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension IsExprSyntax: CustomReflectable { @@ -3573,27 +3184,6 @@ public struct KeyPathExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterComponents ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "root" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension KeyPathExprSyntax: CustomReflectable { @@ -3918,47 +3508,6 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterAdditionalTrailingClosures ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return nil - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension MacroExpansionExprSyntax: CustomReflectable { @@ -4189,31 +3738,6 @@ public struct MemberAccessExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterDeclNameArguments ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "base" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "name" - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension MemberAccessExprSyntax: CustomReflectable { @@ -4286,15 +3810,6 @@ public struct MissingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpected]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - default: - fatalError("Invalid index") - } - } } extension MissingExprSyntax: CustomReflectable { @@ -4417,23 +3932,6 @@ public struct MoveExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension MoveExprSyntax: CustomReflectable { @@ -4523,19 +4021,6 @@ public struct NilLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeNilKeyword, \Self.nilKeyword, \Self.unexpectedAfterNilKeyword]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension NilLiteralExprSyntax: CustomReflectable { @@ -4660,23 +4145,6 @@ public struct OptionalChainingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterQuestionMark ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension OptionalChainingExprSyntax: CustomReflectable { @@ -4804,23 +4272,6 @@ public struct PackElementExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPackRefExpr ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PackElementExprSyntax: CustomReflectable { @@ -4948,23 +4399,6 @@ public struct PackExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPatternExpr ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PackExpansionExprSyntax: CustomReflectable { @@ -5123,23 +4557,6 @@ public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterConfig ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PostfixIfConfigExprSyntax: CustomReflectable { @@ -5267,23 +4684,6 @@ public struct PostfixUnaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterOperatorToken ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PostfixUnaryExprSyntax: CustomReflectable { @@ -5411,23 +4811,6 @@ public struct PrefixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPostfixExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PrefixOperatorExprSyntax: CustomReflectable { @@ -5633,35 +5016,6 @@ public struct RegexLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterClosingPounds ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension RegexLiteralExprSyntax: CustomReflectable { @@ -5776,19 +5130,6 @@ public struct SequenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeElements, \Self.elements, \Self.unexpectedAfterElements]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension SequenceExprSyntax: CustomReflectable { @@ -5913,23 +5254,6 @@ public struct SpecializeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGenericArgumentClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension SpecializeExprSyntax: CustomReflectable { @@ -6154,35 +5478,6 @@ public struct StringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterCloseDelimiter ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension StringLiteralExprSyntax: CustomReflectable { @@ -6458,39 +5753,6 @@ public struct SubscriptExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterAdditionalTrailingClosures ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "called expression" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "arguments" - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "trailing closure" - case 10: - return nil - case 11: - return "trailing closures" - case 12: - return nil - default: - fatalError("Invalid index") - } - } } extension SubscriptExprSyntax: CustomReflectable { @@ -6588,19 +5850,6 @@ public struct SuperRefExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeSuperKeyword, \Self.superKeyword, \Self.unexpectedAfterSuperKeyword]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension SuperRefExprSyntax: CustomReflectable { @@ -6822,35 +6071,6 @@ public struct SwitchExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightBrace ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension SwitchExprSyntax: CustomReflectable { @@ -7062,35 +6282,6 @@ public struct TernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterSecondChoice ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "condition" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "first choice" - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "second choice" - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension TernaryExprSyntax: CustomReflectable { @@ -7250,27 +6441,6 @@ public struct TryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension TryExprSyntax: CustomReflectable { @@ -7445,27 +6615,6 @@ public struct TupleExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension TupleExprSyntax: CustomReflectable { @@ -7557,19 +6706,6 @@ public struct TypeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeType, \Self.type, \Self.unexpectedAfterType]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension TypeExprSyntax: CustomReflectable { @@ -7694,23 +6830,6 @@ public struct UnresolvedAsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterQuestionOrExclamationMark ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension UnresolvedAsExprSyntax: CustomReflectable { @@ -7800,19 +6919,6 @@ public struct UnresolvedIsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeIsTok, \Self.isTok, \Self.unexpectedAfterIsTok]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension UnresolvedIsExprSyntax: CustomReflectable { @@ -7899,19 +7005,6 @@ public struct UnresolvedPatternExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforePattern, \Self.pattern, \Self.unexpectedAfterPattern]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension UnresolvedPatternExprSyntax: CustomReflectable { @@ -8062,27 +7155,6 @@ public struct UnresolvedTernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterColonMark ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension UnresolvedTernaryExprSyntax: CustomReflectable { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift index d0cbf86352c..7eba7e0af07 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift @@ -125,23 +125,6 @@ public struct AccessPathComponentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingDot ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "name" - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension AccessPathComponentSyntax: CustomReflectable { @@ -314,27 +297,6 @@ public struct AccessorBlockSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightBrace ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension AccessorBlockSyntax: CustomReflectable { @@ -490,27 +452,6 @@ public struct AccessorParameterSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "name" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension AccessorParameterSyntax: CustomReflectable { @@ -640,23 +581,6 @@ public struct ArrayElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "value" - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ArrayElementSyntax: CustomReflectable { @@ -1128,35 +1052,6 @@ public struct AttributeSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "name" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension AttributeSyntax: CustomReflectable { @@ -1345,23 +1240,6 @@ public struct AvailabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension AvailabilityArgumentSyntax: CustomReflectable { @@ -1560,31 +1438,6 @@ public struct AvailabilityConditionSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension AvailabilityConditionSyntax: CustomReflectable { @@ -1789,31 +1642,6 @@ public struct AvailabilityEntrySyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterSemicolon ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension AvailabilityEntrySyntax: CustomReflectable { @@ -2016,27 +1844,6 @@ public struct AvailabilityLabeledArgumentSyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterValue ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "value" - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension AvailabilityLabeledArgumentSyntax: CustomReflectable { @@ -2167,23 +1974,6 @@ public struct AvailabilityVersionRestrictionListEntrySyntax: SyntaxProtocol, Syn \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension AvailabilityVersionRestrictionListEntrySyntax: CustomReflectable { @@ -2312,23 +2102,6 @@ public struct AvailabilityVersionRestrictionSyntax: SyntaxProtocol, SyntaxHashab \Self.unexpectedAfterVersion ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "platform" - case 2: - return nil - case 3: - return "version" - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension AvailabilityVersionRestrictionSyntax: CustomReflectable { @@ -2504,27 +2277,6 @@ public struct BackDeployedAttributeSpecListSyntax: SyntaxProtocol, SyntaxHashabl \Self.unexpectedAfterVersionList ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension BackDeployedAttributeSpecListSyntax: CustomReflectable { @@ -2680,27 +2432,6 @@ public struct CaseItemSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension CaseItemSyntax: CustomReflectable { @@ -2875,27 +2606,6 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension CatchClauseSyntax: CustomReflectable { @@ -3086,27 +2796,6 @@ public struct CatchItemSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension CatchItemSyntax: CustomReflectable { @@ -3288,31 +2977,6 @@ public struct ClosureCaptureItemSpecifierSyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureCaptureItemSpecifierSyntax: CustomReflectable { @@ -3522,35 +3186,6 @@ public struct ClosureCaptureItemSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureCaptureItemSyntax: CustomReflectable { @@ -3729,27 +3364,6 @@ public struct ClosureCaptureSignatureSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightSquare ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureCaptureSignatureSyntax: CustomReflectable { @@ -3879,23 +3493,6 @@ public struct ClosureParamSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "name" - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureParamSyntax: CustomReflectable { @@ -4071,27 +3668,6 @@ public struct ClosureParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "parameters" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureParameterClauseSyntax: CustomReflectable { @@ -4476,47 +4052,6 @@ public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return "type" - case 12: - return nil - case 13: - return nil - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureParameterSyntax: CustomReflectable { @@ -4821,39 +4356,6 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterInTok ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - default: - fatalError("Invalid index") - } - } } extension ClosureSignatureSyntax: CustomReflectable { @@ -5044,23 +4546,6 @@ public struct CodeBlockItemSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterSemicolon ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension CodeBlockItemSyntax: CustomReflectable { @@ -5233,27 +4718,6 @@ public struct CodeBlockSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightBrace ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "statements" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension CodeBlockSyntax: CustomReflectable { @@ -5383,23 +4847,6 @@ public struct CompositionTypeElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterAmpersand ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension CompositionTypeElementSyntax: CustomReflectable { @@ -5596,23 +5043,6 @@ public struct ConditionElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ConditionElementSyntax: CustomReflectable { @@ -5766,27 +5196,6 @@ public struct ConformanceRequirementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightTypeIdentifier ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ConformanceRequirementSyntax: CustomReflectable { @@ -5995,35 +5404,6 @@ public struct ConventionAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterCTypeString ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension ConventionAttributeArgumentsSyntax: CustomReflectable { @@ -6183,27 +5563,6 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S \Self.unexpectedAfterProtocolName ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ConventionWitnessMethodAttributeArgumentsSyntax: CustomReflectable { @@ -6333,23 +5692,6 @@ public struct DeclEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterThrowsSpecifier ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension DeclEffectSpecifiersSyntax: CustomReflectable { @@ -6503,27 +5845,6 @@ public struct DeclModifierDetailSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension DeclModifierDetailSyntax: CustomReflectable { @@ -6653,23 +5974,6 @@ public struct DeclModifierSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterDetail ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension DeclModifierSyntax: CustomReflectable { @@ -6797,23 +6101,6 @@ public struct DeclNameArgumentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterColon ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension DeclNameArgumentSyntax: CustomReflectable { @@ -6986,27 +6273,6 @@ public struct DeclNameArgumentsSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension DeclNameArgumentsSyntax: CustomReflectable { @@ -7138,23 +6404,6 @@ public struct DeclNameSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterDeclNameArguments ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "base name" - case 2: - return nil - case 3: - return "arguments" - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension DeclNameSyntax: CustomReflectable { @@ -7417,43 +6666,6 @@ public struct DerivativeRegistrationAttributeArgumentsSyntax: SyntaxProtocol, Sy \Self.unexpectedAfterDiffParams ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return nil - case 14: - return nil - default: - fatalError("Invalid index") - } - } } extension DerivativeRegistrationAttributeArgumentsSyntax: CustomReflectable { @@ -7591,23 +6803,6 @@ public struct DesignatedTypeElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterName ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension DesignatedTypeElementSyntax: CustomReflectable { @@ -7787,31 +6982,6 @@ public struct DictionaryElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "key" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "value" - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension DictionaryElementSyntax: CustomReflectable { @@ -7943,23 +7113,6 @@ public struct DifferentiabilityParamSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension DifferentiabilityParamSyntax: CustomReflectable { @@ -8157,27 +7310,6 @@ public struct DifferentiabilityParamsClauseSyntax: SyntaxProtocol, SyntaxHashabl \Self.unexpectedAfterParameters ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "parameters" - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension DifferentiabilityParamsClauseSyntax: CustomReflectable { @@ -8353,27 +7485,6 @@ public struct DifferentiabilityParamsSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension DifferentiabilityParamsSyntax: CustomReflectable { @@ -8583,35 +7694,6 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash \Self.unexpectedAfterWhereClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension DifferentiableAttributeArgumentsSyntax: CustomReflectable { @@ -8840,31 +7922,6 @@ public struct DocumentationAttributeArgumentSyntax: SyntaxProtocol, SyntaxHashab \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension DocumentationAttributeArgumentSyntax: CustomReflectable { @@ -9022,27 +8079,6 @@ public struct DynamicReplacementArgumentsSyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterDeclname ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension DynamicReplacementArgumentsSyntax: CustomReflectable { @@ -9228,31 +8264,6 @@ public struct EnumCaseElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "associated values" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension EnumCaseElementSyntax: CustomReflectable { @@ -9432,27 +8443,6 @@ public struct EnumCaseParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "parameters" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension EnumCaseParameterClauseSyntax: CustomReflectable { @@ -9735,43 +8725,6 @@ public struct EnumCaseParameterSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "modifiers" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "type" - case 10: - return nil - case 11: - return "default argument" - case 12: - return nil - case 13: - return nil - case 14: - return nil - default: - fatalError("Invalid index") - } - } } extension EnumCaseParameterSyntax: CustomReflectable { @@ -9935,27 +8888,6 @@ public struct ExposeAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterCxxName ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ExposeAttributeArgumentsSyntax: CustomReflectable { @@ -10182,35 +9114,6 @@ public struct ExpressionSegmentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension ExpressionSegmentSyntax: CustomReflectable { @@ -10564,51 +9467,6 @@ public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "attributes" - case 2: - return nil - case 3: - return "modifiers" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return "internal name" - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return "type" - case 12: - return nil - case 13: - return nil - case 14: - return nil - case 15: - return "default argument" - case 16: - return nil - case 17: - return nil - case 18: - return nil - default: - fatalError("Invalid index") - } - } } extension FunctionParameterSyntax: CustomReflectable { @@ -10776,27 +9634,6 @@ public struct FunctionSignatureSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterOutput ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension FunctionSignatureSyntax: CustomReflectable { @@ -10971,27 +9808,6 @@ public struct GenericArgumentClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightAngleBracket ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension GenericArgumentClauseSyntax: CustomReflectable { @@ -11121,23 +9937,6 @@ public struct GenericArgumentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension GenericArgumentSyntax: CustomReflectable { @@ -11336,31 +10135,6 @@ public struct GenericParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightAngleBracket ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension GenericParameterClauseSyntax: CustomReflectable { @@ -11662,39 +10436,6 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "parameter pack specifier" - case 4: - return nil - case 5: - return "name" - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "inherited type" - case 10: - return nil - case 11: - return nil - case 12: - return nil - default: - fatalError("Invalid index") - } - } } extension GenericParameterSyntax: CustomReflectable { @@ -11878,27 +10619,10 @@ public struct GenericRequirementSyntax: SyntaxProtocol, SyntaxHashable { return .layout([ \Self.unexpectedBeforeBody, \Self.body, - \Self.unexpectedBetweenBodyAndTrailingComma, - \Self.trailingComma, - \Self.unexpectedAfterTrailingComma - ]) - } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } + \Self.unexpectedBetweenBodyAndTrailingComma, + \Self.trailingComma, + \Self.unexpectedAfterTrailingComma + ]) } } @@ -12046,23 +10770,6 @@ public struct GenericWhereClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRequirementList ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension GenericWhereClauseSyntax: CustomReflectable { @@ -12332,27 +11039,6 @@ public struct IfConfigClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterElements ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "condition" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension IfConfigClauseSyntax: CustomReflectable { @@ -12538,31 +11224,6 @@ public struct ImplementsAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterDeclNameArguments ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "type" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "declaration base name" - case 6: - return nil - case 7: - return "declaration name arguments" - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension ImplementsAttributeArgumentsSyntax: CustomReflectable { @@ -12694,23 +11355,6 @@ public struct InheritedTypeSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension InheritedTypeSyntax: CustomReflectable { @@ -12838,23 +11482,6 @@ public struct InitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterValue ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension InitializerClauseSyntax: CustomReflectable { @@ -13035,23 +11662,6 @@ public struct KeyPathComponentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterComponent ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension KeyPathComponentSyntax: CustomReflectable { @@ -13141,19 +11751,6 @@ public struct KeyPathOptionalComponentSyntax: SyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeQuestionOrExclamationMark, \Self.questionOrExclamationMark, \Self.unexpectedAfterQuestionOrExclamationMark]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension KeyPathOptionalComponentSyntax: CustomReflectable { @@ -13304,27 +11901,6 @@ public struct KeyPathPropertyComponentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGenericArgumentClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension KeyPathPropertyComponentSyntax: CustomReflectable { @@ -13499,27 +12075,6 @@ public struct KeyPathSubscriptComponentSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightBracket ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "arguments" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension KeyPathSubscriptComponentSyntax: CustomReflectable { @@ -13705,31 +12260,6 @@ public struct LabeledSpecializeEntrySyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "value" - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension LabeledSpecializeEntrySyntax: CustomReflectable { @@ -14017,47 +12547,6 @@ public struct LayoutRequirementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "constrained type" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return "size" - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return "alignment" - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension LayoutRequirementSyntax: CustomReflectable { @@ -14249,31 +12738,6 @@ public struct MatchingPatternConditionSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterInitializer ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension MatchingPatternConditionSyntax: CustomReflectable { @@ -14450,27 +12914,6 @@ public struct MemberDeclBlockSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightBrace ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension MemberDeclBlockSyntax: CustomReflectable { @@ -14602,23 +13045,6 @@ public struct MemberDeclListItemSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterSemicolon ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension MemberDeclListItemSyntax: CustomReflectable { @@ -14687,15 +13113,6 @@ public struct MissingSyntax: SyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpected]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - default: - fatalError("Invalid index") - } - } } extension MissingSyntax: CustomReflectable { @@ -14844,27 +13261,6 @@ public struct MultipleTrailingClosureElementSyntax: SyntaxProtocol, SyntaxHashab \Self.unexpectedAfterClosure ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension MultipleTrailingClosureElementSyntax: CustomReflectable { @@ -14994,23 +13390,6 @@ public struct ObjCSelectorPieceSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterColon ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "name" - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ObjCSelectorPieceSyntax: CustomReflectable { @@ -15166,27 +13545,6 @@ public struct OpaqueReturnTypeOfAttributeArgumentsSyntax: SyntaxProtocol, Syntax \Self.unexpectedAfterOrdinal ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension OpaqueReturnTypeOfAttributeArgumentsSyntax: CustomReflectable { @@ -15363,27 +13721,6 @@ public struct OperatorPrecedenceAndTypesSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterDesignatedTypes ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "precedence group" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension OperatorPrecedenceAndTypesSyntax: CustomReflectable { @@ -15565,31 +13902,6 @@ public struct OptionalBindingConditionSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterInitializer ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension OptionalBindingConditionSyntax: CustomReflectable { @@ -15818,35 +14130,6 @@ public struct OriginallyDefinedInArgumentsSyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterPlatforms ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension OriginallyDefinedInArgumentsSyntax: CustomReflectable { @@ -16025,27 +14308,6 @@ public struct ParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "parameters" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ParameterClauseSyntax: CustomReflectable { @@ -16295,35 +14557,6 @@ public struct PatternBindingSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "type annotation" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension PatternBindingSyntax: CustomReflectable { @@ -16587,43 +14820,6 @@ public struct PoundSourceLocationArgsSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterLineNumber ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "file name" - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return "line number" - case 14: - return nil - default: - fatalError("Invalid index") - } - } } extension PoundSourceLocationArgsSyntax: CustomReflectable { @@ -16780,34 +14976,13 @@ public struct PrecedenceGroupAssignmentSyntax: SyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([ \Self.unexpectedBeforeAssignmentKeyword, - \Self.assignmentKeyword, - \Self.unexpectedBetweenAssignmentKeywordAndColon, - \Self.colon, - \Self.unexpectedBetweenColonAndFlag, - \Self.flag, - \Self.unexpectedAfterFlag - ]) - } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } + \Self.assignmentKeyword, + \Self.unexpectedBetweenAssignmentKeywordAndColon, + \Self.colon, + \Self.unexpectedBetweenColonAndFlag, + \Self.flag, + \Self.unexpectedAfterFlag + ]) } } @@ -16965,27 +15140,6 @@ public struct PrecedenceGroupAssociativitySyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterValue ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension PrecedenceGroupAssociativitySyntax: CustomReflectable { @@ -17115,23 +15269,6 @@ public struct PrecedenceGroupNameElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "name" - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PrecedenceGroupNameElementSyntax: CustomReflectable { @@ -17306,27 +15443,6 @@ public struct PrecedenceGroupRelationSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterOtherNames ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension PrecedenceGroupRelationSyntax: CustomReflectable { @@ -17501,27 +15617,6 @@ public struct PrimaryAssociatedTypeClauseSyntax: SyntaxProtocol, SyntaxHashable \Self.unexpectedAfterRightAngleBracket ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension PrimaryAssociatedTypeClauseSyntax: CustomReflectable { @@ -17651,23 +15746,6 @@ public struct PrimaryAssociatedTypeSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "name" - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PrimaryAssociatedTypeSyntax: CustomReflectable { @@ -17889,31 +15967,6 @@ public struct QualifiedDeclNameSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterArguments ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "base type" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "base name" - case 6: - return nil - case 7: - return "arguments" - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension QualifiedDeclNameSyntax: CustomReflectable { @@ -18045,23 +16098,6 @@ public struct ReturnClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterReturnType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "return type" - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ReturnClauseSyntax: CustomReflectable { @@ -18215,27 +16251,6 @@ public struct SameTypeRequirementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightTypeIdentifier ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "left-hand type" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "right-hand type" - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension SameTypeRequirementSyntax: CustomReflectable { @@ -18384,23 +16399,6 @@ public struct SourceFileSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterEOFToken ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension SourceFileSyntax: CustomReflectable { @@ -18490,19 +16488,6 @@ public struct StringSegmentSyntax: SyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeContent, \Self.content, \Self.unexpectedAfterContent]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension StringSegmentSyntax: CustomReflectable { @@ -18672,27 +16657,6 @@ public struct SwitchCaseLabelSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterColon ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension SwitchCaseLabelSyntax: CustomReflectable { @@ -18909,27 +16873,6 @@ public struct SwitchCaseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterStatements ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "label" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension SwitchCaseSyntax: CustomReflectable { @@ -19059,23 +17002,6 @@ public struct SwitchDefaultLabelSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterColon ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension SwitchDefaultLabelSyntax: CustomReflectable { @@ -19259,31 +17185,6 @@ public struct TargetFunctionEntrySyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "declaration name" - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension TargetFunctionEntrySyntax: CustomReflectable { @@ -19467,31 +17368,6 @@ public struct TupleExprElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "value" - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension TupleExprElementSyntax: CustomReflectable { @@ -19675,31 +17551,6 @@ public struct TuplePatternElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension TuplePatternElementSyntax: CustomReflectable { @@ -19987,47 +17838,6 @@ public struct TupleTypeElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTrailingComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "name" - case 4: - return nil - case 5: - return "internal name" - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return nil - case 14: - return nil - case 15: - return nil - case 16: - return nil - default: - fatalError("Invalid index") - } - } } extension TupleTypeElementSyntax: CustomReflectable { @@ -20167,23 +17977,6 @@ public struct TypeAnnotationSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension TypeAnnotationSyntax: CustomReflectable { @@ -20311,23 +18104,6 @@ public struct TypeEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterThrowsSpecifier ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension TypeEffectSpecifiersSyntax: CustomReflectable { @@ -20474,23 +18250,6 @@ public struct TypeInheritanceClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterInheritedTypeCollection ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension TypeInheritanceClauseSyntax: CustomReflectable { @@ -20618,23 +18377,6 @@ public struct TypeInitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterValue ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "type" - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension TypeInitializerClauseSyntax: CustomReflectable { @@ -20788,27 +18530,6 @@ public struct UnavailableFromAsyncArgumentsSyntax: SyntaxProtocol, SyntaxHashabl \Self.unexpectedAfterMessage ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension UnavailableFromAsyncArgumentsSyntax: CustomReflectable { @@ -20964,27 +18685,6 @@ public struct UnderscorePrivateAttributeArgumentsSyntax: SyntaxProtocol, SyntaxH \Self.unexpectedAfterFilename ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension UnderscorePrivateAttributeArgumentsSyntax: CustomReflectable { @@ -21197,35 +18897,6 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPatch ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension VersionTupleSyntax: CustomReflectable { @@ -21359,23 +19030,6 @@ public struct WhereClauseSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGuardResult ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension WhereClauseSyntax: CustomReflectable { @@ -21503,23 +19157,6 @@ public struct YieldExprListElementSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterComma ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension YieldExprListElementSyntax: CustomReflectable { @@ -21692,27 +19329,6 @@ public struct YieldListSyntax: SyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension YieldListSyntax: CustomReflectable { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift index b8d981a60d4..78bdcd1475c 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift @@ -87,19 +87,6 @@ public struct ExpressionPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeExpression, \Self.expression, \Self.unexpectedAfterExpression]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension ExpressionPatternSyntax: CustomReflectable { @@ -186,19 +173,6 @@ public struct IdentifierPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeIdentifier, \Self.identifier, \Self.unexpectedAfterIdentifier]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension IdentifierPatternSyntax: CustomReflectable { @@ -323,23 +297,6 @@ public struct IsTypePatternSyntax: PatternSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension IsTypePatternSyntax: CustomReflectable { @@ -408,15 +365,6 @@ public struct MissingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpected]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - default: - fatalError("Invalid index") - } - } } extension MissingPatternSyntax: CustomReflectable { @@ -584,27 +532,6 @@ public struct TuplePatternSyntax: PatternSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension TuplePatternSyntax: CustomReflectable { @@ -734,23 +661,6 @@ public struct ValueBindingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterValuePattern ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ValueBindingPatternSyntax: CustomReflectable { @@ -878,23 +788,6 @@ public struct WildcardPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTypeAnnotation ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension WildcardPatternSyntax: CustomReflectable { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift index be6a678e6bd..ab7ca1abcaf 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift @@ -125,23 +125,6 @@ public struct BreakStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterLabel ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "label" - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension BreakStmtSyntax: CustomReflectable { @@ -269,23 +252,6 @@ public struct ContinueStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterLabel ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "label" - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ContinueStmtSyntax: CustomReflectable { @@ -413,23 +379,6 @@ public struct DeferStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension DeferStmtSyntax: CustomReflectable { @@ -602,27 +551,6 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterCatchClauses ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "body" - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension DoStmtSyntax: CustomReflectable { @@ -714,19 +642,6 @@ public struct ExpressionStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeExpression, \Self.expression, \Self.unexpectedAfterExpression]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension ExpressionStmtSyntax: CustomReflectable { @@ -813,19 +728,6 @@ public struct FallthroughStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeFallthroughKeyword, \Self.fallthroughKeyword, \Self.unexpectedAfterFallthroughKeyword]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension FallthroughStmtSyntax: CustomReflectable { @@ -1158,55 +1060,6 @@ public struct ForInStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - case 11: - return nil - case 12: - return nil - case 13: - return nil - case 14: - return nil - case 15: - return nil - case 16: - return nil - case 17: - return nil - case 18: - return nil - case 19: - return "body" - case 20: - return nil - default: - fatalError("Invalid index") - } - } } extension ForInStmtSyntax: CustomReflectable { @@ -1350,23 +1203,6 @@ public struct ForgetStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ForgetStmtSyntax: CustomReflectable { @@ -1565,31 +1401,6 @@ public struct GuardStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "condition" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return "body" - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension GuardStmtSyntax: CustomReflectable { @@ -1747,27 +1558,6 @@ public struct LabeledStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterStatement ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "label name" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension LabeledStmtSyntax: CustomReflectable { @@ -1838,15 +1628,6 @@ public struct MissingStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpected]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - default: - fatalError("Invalid index") - } - } } extension MissingStmtSyntax: CustomReflectable { @@ -2021,31 +1802,6 @@ public struct RepeatWhileStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterCondition ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "body" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return "condition" - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension RepeatWhileStmtSyntax: CustomReflectable { @@ -2208,23 +1964,6 @@ public struct ReturnStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ReturnStmtSyntax: CustomReflectable { @@ -2352,23 +2091,6 @@ public struct ThrowStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterExpression ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ThrowStmtSyntax: CustomReflectable { @@ -2541,27 +2263,6 @@ public struct WhileStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBody ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension WhileStmtSyntax: CustomReflectable { @@ -2733,23 +2434,6 @@ public struct YieldStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterYields ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension YieldStmtSyntax: CustomReflectable { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift index 9d7bdc5b953..49860809262 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift @@ -151,27 +151,6 @@ public struct ArrayTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightSquareBracket ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension ArrayTypeSyntax: CustomReflectable { @@ -346,27 +325,6 @@ public struct AttributedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBaseType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension AttributedTypeSyntax: CustomReflectable { @@ -458,19 +416,6 @@ public struct ClassRestrictionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeClassKeyword, \Self.classKeyword, \Self.unexpectedAfterClassKeyword]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension ClassRestrictionTypeSyntax: CustomReflectable { @@ -576,19 +521,6 @@ public struct CompositionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpectedBeforeElements, \Self.elements, \Self.unexpectedAfterElements]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - default: - fatalError("Invalid index") - } - } } extension CompositionTypeSyntax: CustomReflectable { @@ -713,23 +645,6 @@ public struct ConstrainedSugarTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBaseType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ConstrainedSugarTypeSyntax: CustomReflectable { @@ -935,35 +850,6 @@ public struct DictionaryTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightSquareBracket ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return "key type" - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return "value type" - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension DictionaryTypeSyntax: CustomReflectable { @@ -1194,35 +1080,6 @@ public struct FunctionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterOutput ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - case 7: - return nil - case 8: - return nil - case 9: - return nil - case 10: - return nil - default: - fatalError("Invalid index") - } - } } extension FunctionTypeSyntax: CustomReflectable { @@ -1356,23 +1213,6 @@ public struct ImplicitlyUnwrappedOptionalTypeSyntax: TypeSyntaxProtocol, SyntaxH \Self.unexpectedAfterExclamationMark ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension ImplicitlyUnwrappedOptionalTypeSyntax: CustomReflectable { @@ -1552,31 +1392,6 @@ public struct MemberTypeIdentifierSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGenericArgumentClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "base type" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return "name" - case 6: - return nil - case 7: - return nil - case 8: - return nil - default: - fatalError("Invalid index") - } - } } extension MemberTypeIdentifierSyntax: CustomReflectable { @@ -1734,27 +1549,6 @@ public struct MetatypeTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterTypeOrProtocol ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return "base type" - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension MetatypeTypeSyntax: CustomReflectable { @@ -1825,15 +1619,6 @@ public struct MissingTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { public static var structure: SyntaxNodeStructure { return .layout([\Self.unexpected]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - default: - fatalError("Invalid index") - } - } } extension MissingTypeSyntax: CustomReflectable { @@ -1956,23 +1741,6 @@ public struct NamedOpaqueReturnTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterBaseType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension NamedOpaqueReturnTypeSyntax: CustomReflectable { @@ -2100,23 +1868,6 @@ public struct OptionalTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterQuestionMark ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension OptionalTypeSyntax: CustomReflectable { @@ -2244,23 +1995,6 @@ public struct PackExpansionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPatternType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PackExpansionTypeSyntax: CustomReflectable { @@ -2388,23 +2122,6 @@ public struct PackReferenceTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterPackType ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension PackReferenceTypeSyntax: CustomReflectable { @@ -2532,23 +2249,6 @@ public struct SimpleTypeIdentifierSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterGenericArgumentClause ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - default: - fatalError("Invalid index") - } - } } extension SimpleTypeIdentifierSyntax: CustomReflectable { @@ -2721,27 +2421,6 @@ public struct TupleTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { \Self.unexpectedAfterRightParen ]) } - - public func childNameForDiagnostics(_ index: SyntaxChildrenIndex) -> String? { - switch index.data?.indexInParent { - case 0: - return nil - case 1: - return nil - case 2: - return nil - case 3: - return nil - case 4: - return nil - case 5: - return nil - case 6: - return nil - default: - fatalError("Invalid index") - } - } } extension TupleTypeSyntax: CustomReflectable { diff --git a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift index 68c69ddd816..745f9e8a545 100644 --- a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift +++ b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift @@ -283,7 +283,7 @@ extension StringLiteralExprSyntax { } } - let escapedContent = content.escapingForStringLiteral(usingDelimiter: closeDelimiter?.text ?? "", isMultiline: openQuote.rawTokenKind == .multilineStringQuote) + let escapedContent = content.escapingForStringLiteral(usingDelimiter: closeDelimiter?.text ?? "", isMultiline: openQuote.tokenView.rawKind == .multilineStringQuote) let contentToken = TokenSyntax.stringSegment(escapedContent) let segment = StringSegmentSyntax(content: contentToken) let segments = StringLiteralSegmentsSyntax([.stringSegment(segment)]) diff --git a/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift b/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift index fa92f2bc1c3..33b21f06860 100644 --- a/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift +++ b/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift @@ -118,7 +118,7 @@ public extension SyntaxProtocol { return .nodeType } - if isToken { + if self.is(TokenSyntax.self) { if let token = Syntax(self).as(TokenSyntax.self), let baselineToken = Syntax(baseline).as(TokenSyntax.self) { if token.presence != baselineToken.presence { return .presence diff --git a/Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift b/Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift index a0b88d8d0ae..21ac942154f 100644 --- a/Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift +++ b/Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift @@ -114,7 +114,7 @@ extension SyntaxProtocol { private func debugInitCallExpr(includeTrivia: Bool) -> ExprSyntax { let mirror = Mirror(reflecting: self) - if self.isCollection { + if self.kind.isSyntaxCollection { let typeName = String(describing: type(of: self)) return ExprSyntax( FunctionCallExprSyntax(callee: IdentifierExprSyntax(identifier: .identifier(typeName))) { diff --git a/Tests/SwiftSyntaxTest/RawSyntaxTests.swift b/Tests/SwiftSyntaxTest/RawSyntaxTests.swift index c6f1cf49b4b..cc50c50019f 100644 --- a/Tests/SwiftSyntaxTest/RawSyntaxTests.swift +++ b/Tests/SwiftSyntaxTest/RawSyntaxTests.swift @@ -142,7 +142,7 @@ final class RawSyntaxTests: XCTestCase { XCTAssertEqual(ident.description, "\nfoo ") let identSyntax = Syntax(raw: ident.raw).as(TokenSyntax.self)! - let barIdentSyntax = identSyntax.withKind(.keyword(.open)) + let barIdentSyntax = identSyntax.with(\.tokenKind, .keyword(.open)) let barIdent = barIdentSyntax.raw.as(RawTokenSyntax.self)! XCTAssertEqual(barIdent.tokenKind, .keyword) diff --git a/Tests/SwiftSyntaxTest/SyntaxCollectionsTests.swift b/Tests/SwiftSyntaxTest/SyntaxCollectionsTests.swift index 7646f9bcd19..a9dd335a03e 100644 --- a/Tests/SwiftSyntaxTest/SyntaxCollectionsTests.swift +++ b/Tests/SwiftSyntaxTest/SyntaxCollectionsTests.swift @@ -29,10 +29,10 @@ public class SyntaxCollectionsTests: XCTestCase { ]) let newArrayElementList = arrayElementList.appending(integerLiteralElement(1)) - XCTAssert(newArrayElementList.isCollection) + XCTAssert(newArrayElementList.kind.isSyntaxCollection) XCTAssertEqual(newArrayElementList.count, 2) XCTAssertNotNil(newArrayElementList.child(at: 1)) - XCTAssert(!newArrayElementList.child(at: 1)!.isCollection) + XCTAssert(!newArrayElementList.child(at: 1)!.kind.isSyntaxCollection) XCTAssertEqual("\(newArrayElementList.child(at: 1)!)", "1") } diff --git a/utils/group.json b/utils/group.json index 79ea737900a..7a989792a9b 100644 --- a/utils/group.json +++ b/utils/group.json @@ -43,7 +43,6 @@ "SyntaxTransform.swift", "SyntaxText.swift", "SyntaxVisitor.swift", - "Misc.swift", ], "Position": [ "AbsolutePosition.swift", From 5ee8d660a1eedef856b8a6e0193486b2ce1a2242 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 12 Apr 2023 13:21:20 -0700 Subject: [PATCH 04/22] Merge pull request #1519 from kimdv/kimdv/fix-warning Remove warning --- Tests/SwiftSyntaxParserTest/SyntaxTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/SwiftSyntaxParserTest/SyntaxTests.swift b/Tests/SwiftSyntaxParserTest/SyntaxTests.swift index cd6a24e5d49..97ed0b6abaf 100644 --- a/Tests/SwiftSyntaxParserTest/SyntaxTests.swift +++ b/Tests/SwiftSyntaxParserTest/SyntaxTests.swift @@ -95,7 +95,7 @@ public class SyntaxTests: XCTestCase { do { let source = " func f() {}" let tree = try! SyntaxParser.parse(source: source) - let funcKW = tree.firstToken! + let funcKW = tree.firstToken(viewMode: .sourceAccurate)! testFuncKw(funcKW) } do { From db9347b85f187e5abe24ccaac19525f91ee3763f Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 12 Apr 2023 14:00:17 -0700 Subject: [PATCH 05/22] Merge pull request #1520 from kishikawakatsumi/string-literal-escape MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix escape handling for emoji `#️⃣` in string literals --- Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift | 2 +- Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift index 745f9e8a545..0d1335fd36e 100644 --- a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift +++ b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift @@ -249,7 +249,7 @@ extension StringLiteralExprSyntax { continue // Special mode: counting a sequence of pounds until we reach its end. - case (true, "#"): + case (true, _) where c.unicodeScalars.contains("#"): consecutivePounds += 1 maxPounds = max(maxPounds, consecutivePounds) case (true, _): diff --git a/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift b/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift index 2311fbcd50a..76da43a3cf3 100644 --- a/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/StringLiteralTests.swift @@ -71,6 +71,15 @@ final class StringLiteralTests: XCTestCase { ) } + func testEscapePoundEmojis() { + assertBuildResult( + StringLiteralExprSyntax(content: ##"foo"#️⃣"bar"##), + """ + ##"foo"#️⃣"bar"## + """ + ) + } + func testEscapeInteropolation() { assertBuildResult( StringLiteralExprSyntax(content: ###"\##(foobar)\#(foobar)"###), From 794d651dd44008b530f470b3559ebdb5ea0d12e8 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 12 Apr 2023 14:43:04 -0700 Subject: [PATCH 06/22] Merge pull request #1454 from StevenWong12/effectful_properties_diagnostics Split DeclEffectSpecifiers into AccessorEffectSpecifiers and FunctionEffectSpecifiers --- .../Sources/SyntaxSupport/CommonNodes.swift | 26 +- .../Sources/SyntaxSupport/DeclNodes.swift | 6 +- Sources/SwiftParser/Declarations.swift | 6 +- Sources/SwiftParser/Specifiers.swift | 90 +++- .../ParseDiagnosticsGenerator.swift | 6 +- .../SyntaxKindNameForDiagnostics.swift | 6 +- .../generated/SwiftSyntax.md | 3 +- .../generated/SyntaxAnyVisitor.swift | 24 +- .../generated/SyntaxBaseNodes.swift | 3 +- .../SwiftSyntax/generated/SyntaxEnum.swift | 9 +- .../SwiftSyntax/generated/SyntaxKind.swift | 9 +- .../generated/SyntaxRewriter.swift | 75 ++-- .../SwiftSyntax/generated/SyntaxTraits.swift | 6 +- .../generated/SyntaxTransform.swift | 42 +- .../SwiftSyntax/generated/SyntaxVisitor.swift | 75 ++-- .../generated/raw/RawSyntaxNodes.swift | 222 ++++++---- .../generated/raw/RawSyntaxValidation.swift | 25 +- .../syntaxNodes/SyntaxDeclNodes.swift | 6 +- .../generated/syntaxNodes/SyntaxNodes.swift | 387 ++++++++++++------ .../generated/BuildableNodes.swift | 2 +- Tests/SwiftParserTest/DeclarationTests.swift | 22 +- .../translated/EffectfulPropertiesTests.swift | 43 +- 22 files changed, 749 insertions(+), 344 deletions(-) diff --git a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift index 6b6ecf0963b..f9e245d877c 100644 --- a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift @@ -83,9 +83,31 @@ public let COMMON_NODES: [Node] = [ ] ), - // decl-effect-specifiers -> (async | reasync)? (throws | rethrows)? + // accessor-effect-specifiers -> (async)? (throws)? Node( - name: "DeclEffectSpecifiers", + name: "AccessorEffectSpecifiers", + nameForDiagnostics: "accessor specifiers", + kind: "Syntax", + traits: [ + "EffectSpecifiers" + ], + children: [ + Child( + name: "AsyncSpecifier", + kind: .token(choices: [.keyword(text: "async")]), + isOptional: true + ), + Child( + name: "ThrowsSpecifier", + kind: .token(choices: [.keyword(text: "throws")]), + isOptional: true + ), + ] + ), + + // funtion-effect-specifiers -> (async | reasync)? (throws | rethrows)? + Node( + name: "FunctionEffectSpecifiers", nameForDiagnostics: "effect specifiers", kind: "Syntax", traits: [ diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift index 2b2bddfd007..6553aa9b36c 100644 --- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift @@ -96,7 +96,7 @@ public let DECL_NODES: [Node] = [ ), Child( name: "EffectSpecifiers", - kind: .node(kind: "DeclEffectSpecifiers"), + kind: .node(kind: "AccessorEffectSpecifiers"), isOptional: true ), Child( @@ -842,7 +842,7 @@ public let DECL_NODES: [Node] = [ ), // function-signature -> - // '(' parameter-list? ')' decl-effect-specifiers? return-clause? + // '(' parameter-list? ')' function-effect-specifiers? return-clause? Node( name: "FunctionSignature", nameForDiagnostics: "function signature", @@ -854,7 +854,7 @@ public let DECL_NODES: [Node] = [ ), Child( name: "EffectSpecifiers", - kind: .node(kind: "DeclEffectSpecifiers"), + kind: .node(kind: "FunctionEffectSpecifiers"), isOptional: true ), Child( diff --git a/Sources/SwiftParser/Declarations.swift b/Sources/SwiftParser/Declarations.swift index 181595f7e2d..466f83f0a92 100644 --- a/Sources/SwiftParser/Declarations.swift +++ b/Sources/SwiftParser/Declarations.swift @@ -1198,7 +1198,7 @@ extension Parser { parser.parseFunctionParameter() } - var effectSpecifiers = self.parseDeclEffectSpecifiers() + var effectSpecifiers = self.parseFunctionEffectSpecifiers() var output: RawReturnClauseSyntax? @@ -1264,7 +1264,7 @@ extension Parser { parser.parseFunctionParameter() } - var misplacedEffectSpecifiers: RawDeclEffectSpecifiersSyntax? + var misplacedEffectSpecifiers: RawFunctionEffectSpecifiersSyntax? let result = self.parseFunctionReturnClause(effectSpecifiers: &misplacedEffectSpecifiers, allowNamedOpaqueResultType: true) // Parse a 'where' clause if present. @@ -1519,7 +1519,7 @@ extension Parser { parameter = nil } - let effectSpecifiers = self.parseDeclEffectSpecifiers() + let effectSpecifiers = self.parseAccessorEffectSpecifiers() let body = self.parseOptionalCodeBlock() return RawAccessorDeclSyntax( diff --git a/Sources/SwiftParser/Specifiers.swift b/Sources/SwiftParser/Specifiers.swift index 3467666ade5..18749f12b1a 100644 --- a/Sources/SwiftParser/Specifiers.swift +++ b/Sources/SwiftParser/Specifiers.swift @@ -173,7 +173,7 @@ extension RawEffectSpecifiersTrait { } } -extension RawDeclEffectSpecifiersSyntax: RawEffectSpecifiersTrait { +extension RawFunctionEffectSpecifiersSyntax: RawEffectSpecifiersTrait { enum MisspelledAsyncSpecifiers: TokenSpecSet { case await @@ -331,6 +331,86 @@ extension RawTypeEffectSpecifiersSyntax: RawEffectSpecifiersTrait { } } +extension RawAccessorEffectSpecifiersSyntax: RawEffectSpecifiersTrait { + enum MisspelledAsyncSpecifiers: TokenSpecSet { + case await + case reasync + + init?(lexeme: Lexer.Lexeme) { + switch PrepareForKeywordMatch(lexeme) { + case TokenSpec(.await, allowAtStartOfLine: false): self = .await + case TokenSpec(.reasync): self = .reasync + default: return nil + } + } + + var spec: TokenSpec { + switch self { + case .await: return TokenSpec(.await, allowAtStartOfLine: false) + case .reasync: return .keyword(.reasync) + } + } + } + + enum CorrectAsyncTokenKinds: TokenSpecSet { + case async + + init?(lexeme: Lexer.Lexeme) { + switch PrepareForKeywordMatch(lexeme) { + case TokenSpec(.async): self = .async + default: return nil + } + } + + var spec: TokenSpec { + switch self { + case .async: return .keyword(.async) + } + } + } + + enum MisspelledThrowsTokenKinds: TokenSpecSet { + case `rethrows` + case `try` + case `throw` + + init?(lexeme: Lexer.Lexeme) { + switch PrepareForKeywordMatch(lexeme) { + case TokenSpec(.rethrows): self = .rethrows + case TokenSpec(.try, allowAtStartOfLine: false): self = .try + case TokenSpec(.throw, allowAtStartOfLine: false): self = .throw + default: return nil + } + } + + var spec: TokenSpec { + switch self { + case .rethrows: return .keyword(.rethrows) + case .try: return TokenSpec(.try, allowAtStartOfLine: false) + case .throw: return TokenSpec(.throw, allowAtStartOfLine: false) + } + } + } + + enum CorrectThrowsTokenKinds: TokenSpecSet { + case `throws` + + init?(lexeme: Lexer.Lexeme) { + switch PrepareForKeywordMatch(lexeme) { + case TokenSpec(.throws): self = .throws + default: return nil + } + } + + var spec: TokenSpec { + switch self { + case .throws: return .keyword(.throws) + } + } + } + +} + extension TokenConsumer { mutating func at(anyIn specSet1: SpecSet1.Type, or specSet2: SpecSet2.Type) -> (TokenSpec, TokenConsumptionHandle)? { if let (spec, handle) = self.at(anyIn: specSet1) { @@ -423,8 +503,12 @@ extension Parser { return parseEffectSpecifiers(RawTypeEffectSpecifiersSyntax.self) } - mutating func parseDeclEffectSpecifiers() -> RawDeclEffectSpecifiersSyntax? { - return parseEffectSpecifiers(RawDeclEffectSpecifiersSyntax.self) + mutating func parseFunctionEffectSpecifiers() -> RawFunctionEffectSpecifiersSyntax? { + return parseEffectSpecifiers(RawFunctionEffectSpecifiersSyntax.self) + } + + mutating func parseAccessorEffectSpecifiers() -> RawAccessorEffectSpecifiersSyntax? { + return parseEffectSpecifiers(RawAccessorEffectSpecifiersSyntax.self) } /// Consume any misplaced effect specifiers and return them in as unexpected tokens. diff --git a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift index e559a211d47..d0a1d68a20a 100644 --- a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift +++ b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift @@ -385,6 +385,10 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor { return .visitChildren } + public override func visit(_ node: AccessorEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { + return handleEffectSpecifiers(node) + } + public override func visit(_ node: AssociatedtypeDeclSyntax) -> SyntaxVisitorContinueKind { if shouldSkip(node) { return .skipChildren @@ -538,7 +542,7 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor { return .visitChildren } - public override func visit(_ node: DeclEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { + public override func visit(_ node: FunctionEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { return handleEffectSpecifiers(node) } diff --git a/Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift b/Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift index e5d39584be2..b35327cad6d 100644 --- a/Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift +++ b/Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift @@ -21,6 +21,8 @@ extension SyntaxKind { return "token" case .accessorDecl: return "accessor" + case .accessorEffectSpecifiers: + return "accessor specifiers" case .actorDecl: return "actor" case .arrayElement: @@ -105,8 +107,6 @@ extension SyntaxKind { return "@convention(...) arguments" case .conventionWitnessMethodAttributeArguments: return "@convention(...) arguments for witness methods" - case .declEffectSpecifiers: - return "effect specifiers" case .declModifier: return "modifier" case .declName: @@ -179,6 +179,8 @@ extension SyntaxKind { return "function call" case .functionDecl: return "function" + case .functionEffectSpecifiers: + return "effect specifiers" case .functionParameterList: return "parameter list" case .functionParameter: diff --git a/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md b/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md index ef77edd0b94..c3924e1afc6 100644 --- a/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md +++ b/Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md @@ -284,6 +284,7 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code. ### Miscellaneous Syntax - +- - - - @@ -299,7 +300,6 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code. - - - -- - - - @@ -311,6 +311,7 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code. - - - +- - - - diff --git a/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift b/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift index 6132585baae..08f7d2307a1 100644 --- a/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift +++ b/Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift @@ -85,6 +85,14 @@ open class SyntaxAnyVisitor: SyntaxVisitor { visitAnyPost(node._syntaxNode) } + override open func visit(_ node: AccessorEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { + return visitAny(node._syntaxNode) + } + + override open func visitPost(_ node: AccessorEffectSpecifiersSyntax) { + visitAnyPost(node._syntaxNode) + } + override open func visit(_ node: AccessorListSyntax) -> SyntaxVisitorContinueKind { return visitAny(node._syntaxNode) } @@ -565,14 +573,6 @@ open class SyntaxAnyVisitor: SyntaxVisitor { visitAnyPost(node._syntaxNode) } - override open func visit(_ node: DeclEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { - return visitAny(node._syntaxNode) - } - - override open func visitPost(_ node: DeclEffectSpecifiersSyntax) { - visitAnyPost(node._syntaxNode) - } - override open func visit(_ node: DeclModifierDetailSyntax) -> SyntaxVisitorContinueKind { return visitAny(node._syntaxNode) } @@ -957,6 +957,14 @@ open class SyntaxAnyVisitor: SyntaxVisitor { visitAnyPost(node._syntaxNode) } + override open func visit(_ node: FunctionEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { + return visitAny(node._syntaxNode) + } + + override open func visitPost(_ node: FunctionEffectSpecifiersSyntax) { + visitAnyPost(node._syntaxNode) + } + override open func visit(_ node: FunctionParameterListSyntax) -> SyntaxVisitorContinueKind { return visitAny(node._syntaxNode) } diff --git a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift index a4b9fad17eb..0da98428095 100644 --- a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift +++ b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift @@ -737,6 +737,7 @@ extension Syntax { .node(AccessPathSyntax.self), .node(AccessorBlockSyntax.self), .node(AccessorDeclSyntax.self), + .node(AccessorEffectSpecifiersSyntax.self), .node(AccessorListSyntax.self), .node(AccessorParameterSyntax.self), .node(ActorDeclSyntax.self), @@ -797,7 +798,6 @@ extension Syntax { .node(ContinueStmtSyntax.self), .node(ConventionAttributeArgumentsSyntax.self), .node(ConventionWitnessMethodAttributeArgumentsSyntax.self), - .node(DeclEffectSpecifiersSyntax.self), .node(DeclModifierDetailSyntax.self), .node(DeclModifierSyntax.self), .node(DeclNameArgumentListSyntax.self), @@ -846,6 +846,7 @@ extension Syntax { .node(ForgetStmtSyntax.self), .node(FunctionCallExprSyntax.self), .node(FunctionDeclSyntax.self), + .node(FunctionEffectSpecifiersSyntax.self), .node(FunctionParameterListSyntax.self), .node(FunctionParameterSyntax.self), .node(FunctionSignatureSyntax.self), diff --git a/Sources/SwiftSyntax/generated/SyntaxEnum.swift b/Sources/SwiftSyntax/generated/SyntaxEnum.swift index 5c4cb5c976e..8e9144700ab 100644 --- a/Sources/SwiftSyntax/generated/SyntaxEnum.swift +++ b/Sources/SwiftSyntax/generated/SyntaxEnum.swift @@ -20,6 +20,7 @@ public enum SyntaxEnum { case accessPath(AccessPathSyntax) case accessorBlock(AccessorBlockSyntax) case accessorDecl(AccessorDeclSyntax) + case accessorEffectSpecifiers(AccessorEffectSpecifiersSyntax) case accessorList(AccessorListSyntax) case accessorParameter(AccessorParameterSyntax) case actorDecl(ActorDeclSyntax) @@ -80,7 +81,6 @@ public enum SyntaxEnum { case continueStmt(ContinueStmtSyntax) case conventionAttributeArguments(ConventionAttributeArgumentsSyntax) case conventionWitnessMethodAttributeArguments(ConventionWitnessMethodAttributeArgumentsSyntax) - case declEffectSpecifiers(DeclEffectSpecifiersSyntax) case declModifierDetail(DeclModifierDetailSyntax) case declModifier(DeclModifierSyntax) case declNameArgumentList(DeclNameArgumentListSyntax) @@ -129,6 +129,7 @@ public enum SyntaxEnum { case forgetStmt(ForgetStmtSyntax) case functionCallExpr(FunctionCallExprSyntax) case functionDecl(FunctionDeclSyntax) + case functionEffectSpecifiers(FunctionEffectSpecifiersSyntax) case functionParameterList(FunctionParameterListSyntax) case functionParameter(FunctionParameterSyntax) case functionSignature(FunctionSignatureSyntax) @@ -299,6 +300,8 @@ public extension Syntax { return .accessorBlock(AccessorBlockSyntax(self)!) case .accessorDecl: return .accessorDecl(AccessorDeclSyntax(self)!) + case .accessorEffectSpecifiers: + return .accessorEffectSpecifiers(AccessorEffectSpecifiersSyntax(self)!) case .accessorList: return .accessorList(AccessorListSyntax(self)!) case .accessorParameter: @@ -419,8 +422,6 @@ public extension Syntax { return .conventionAttributeArguments(ConventionAttributeArgumentsSyntax(self)!) case .conventionWitnessMethodAttributeArguments: return .conventionWitnessMethodAttributeArguments(ConventionWitnessMethodAttributeArgumentsSyntax(self)!) - case .declEffectSpecifiers: - return .declEffectSpecifiers(DeclEffectSpecifiersSyntax(self)!) case .declModifierDetail: return .declModifierDetail(DeclModifierDetailSyntax(self)!) case .declModifier: @@ -517,6 +518,8 @@ public extension Syntax { return .functionCallExpr(FunctionCallExprSyntax(self)!) case .functionDecl: return .functionDecl(FunctionDeclSyntax(self)!) + case .functionEffectSpecifiers: + return .functionEffectSpecifiers(FunctionEffectSpecifiersSyntax(self)!) case .functionParameterList: return .functionParameterList(FunctionParameterListSyntax(self)!) case .functionParameter: diff --git a/Sources/SwiftSyntax/generated/SyntaxKind.swift b/Sources/SwiftSyntax/generated/SyntaxKind.swift index e551b4c9b4c..518f1f43a0f 100644 --- a/Sources/SwiftSyntax/generated/SyntaxKind.swift +++ b/Sources/SwiftSyntax/generated/SyntaxKind.swift @@ -20,6 +20,7 @@ public enum SyntaxKind { case accessPath case accessorBlock case accessorDecl + case accessorEffectSpecifiers case accessorList case accessorParameter case actorDecl @@ -80,7 +81,6 @@ public enum SyntaxKind { case continueStmt case conventionAttributeArguments case conventionWitnessMethodAttributeArguments - case declEffectSpecifiers case declModifierDetail case declModifier case declNameArgumentList @@ -129,6 +129,7 @@ public enum SyntaxKind { case forgetStmt case functionCallExpr case functionDecl + case functionEffectSpecifiers case functionParameterList case functionParameter case functionSignature @@ -414,6 +415,8 @@ public enum SyntaxKind { return AccessorBlockSyntax.self case .accessorDecl: return AccessorDeclSyntax.self + case .accessorEffectSpecifiers: + return AccessorEffectSpecifiersSyntax.self case .accessorList: return AccessorListSyntax.self case .accessorParameter: @@ -534,8 +537,6 @@ public enum SyntaxKind { return ConventionAttributeArgumentsSyntax.self case .conventionWitnessMethodAttributeArguments: return ConventionWitnessMethodAttributeArgumentsSyntax.self - case .declEffectSpecifiers: - return DeclEffectSpecifiersSyntax.self case .declModifierDetail: return DeclModifierDetailSyntax.self case .declModifier: @@ -632,6 +633,8 @@ public enum SyntaxKind { return FunctionCallExprSyntax.self case .functionDecl: return FunctionDeclSyntax.self + case .functionEffectSpecifiers: + return FunctionEffectSpecifiersSyntax.self case .functionParameterList: return FunctionParameterListSyntax.self case .functionParameter: diff --git a/Sources/SwiftSyntax/generated/SyntaxRewriter.swift b/Sources/SwiftSyntax/generated/SyntaxRewriter.swift index ebe853136c2..c70f90f24a7 100644 --- a/Sources/SwiftSyntax/generated/SyntaxRewriter.swift +++ b/Sources/SwiftSyntax/generated/SyntaxRewriter.swift @@ -53,6 +53,13 @@ open class SyntaxRewriter { return DeclSyntax(visitChildren(node)) } + /// Visit a `AccessorEffectSpecifiersSyntax`. + /// - Parameter node: the node that is being visited + /// - Returns: the rewritten node + open func visit(_ node: AccessorEffectSpecifiersSyntax) -> AccessorEffectSpecifiersSyntax { + return Syntax(visitChildren(node)).cast(AccessorEffectSpecifiersSyntax.self) + } + /// Visit a `AccessorListSyntax`. /// - Parameter node: the node that is being visited /// - Returns: the rewritten node @@ -473,13 +480,6 @@ open class SyntaxRewriter { return Syntax(visitChildren(node)).cast(ConventionWitnessMethodAttributeArgumentsSyntax.self) } - /// Visit a `DeclEffectSpecifiersSyntax`. - /// - Parameter node: the node that is being visited - /// - Returns: the rewritten node - open func visit(_ node: DeclEffectSpecifiersSyntax) -> DeclEffectSpecifiersSyntax { - return Syntax(visitChildren(node)).cast(DeclEffectSpecifiersSyntax.self) - } - /// Visit a `DeclModifierDetailSyntax`. /// - Parameter node: the node that is being visited /// - Returns: the rewritten node @@ -816,6 +816,13 @@ open class SyntaxRewriter { return DeclSyntax(visitChildren(node)) } + /// Visit a `FunctionEffectSpecifiersSyntax`. + /// - Parameter node: the node that is being visited + /// - Returns: the rewritten node + open func visit(_ node: FunctionEffectSpecifiersSyntax) -> FunctionEffectSpecifiersSyntax { + return Syntax(visitChildren(node)).cast(FunctionEffectSpecifiersSyntax.self) + } + /// Visit a `FunctionParameterListSyntax`. /// - Parameter node: the node that is being visited /// - Returns: the rewritten node @@ -2024,6 +2031,20 @@ open class SyntaxRewriter { return Syntax(visit(node)) } + /// Implementation detail of visit(_:). Do not call directly. + private func visitImplAccessorEffectSpecifiersSyntax(_ data: SyntaxData) -> Syntax { + let node = AccessorEffectSpecifiersSyntax(data) + // Accessing _syntaxNode directly is faster than calling Syntax(node) + visitPre(node._syntaxNode) + defer { + visitPost(node._syntaxNode) + } + if let newNode = visitAny(node._syntaxNode) { + return newNode + } + return Syntax(visit(node)) + } + /// Implementation detail of visit(_:). Do not call directly. private func visitImplAccessorListSyntax(_ data: SyntaxData) -> Syntax { let node = AccessorListSyntax(data) @@ -2864,20 +2885,6 @@ open class SyntaxRewriter { return Syntax(visit(node)) } - /// Implementation detail of visit(_:). Do not call directly. - private func visitImplDeclEffectSpecifiersSyntax(_ data: SyntaxData) -> Syntax { - let node = DeclEffectSpecifiersSyntax(data) - // Accessing _syntaxNode directly is faster than calling Syntax(node) - visitPre(node._syntaxNode) - defer { - visitPost(node._syntaxNode) - } - if let newNode = visitAny(node._syntaxNode) { - return newNode - } - return Syntax(visit(node)) - } - /// Implementation detail of visit(_:). Do not call directly. private func visitImplDeclModifierDetailSyntax(_ data: SyntaxData) -> Syntax { let node = DeclModifierDetailSyntax(data) @@ -3550,6 +3557,20 @@ open class SyntaxRewriter { return Syntax(visit(node)) } + /// Implementation detail of visit(_:). Do not call directly. + private func visitImplFunctionEffectSpecifiersSyntax(_ data: SyntaxData) -> Syntax { + let node = FunctionEffectSpecifiersSyntax(data) + // Accessing _syntaxNode directly is faster than calling Syntax(node) + visitPre(node._syntaxNode) + defer { + visitPost(node._syntaxNode) + } + if let newNode = visitAny(node._syntaxNode) { + return newNode + } + return Syntax(visit(node)) + } + /// Implementation detail of visit(_:). Do not call directly. private func visitImplFunctionParameterListSyntax(_ data: SyntaxData) -> Syntax { let node = FunctionParameterListSyntax(data) @@ -5756,6 +5777,8 @@ open class SyntaxRewriter { return visitImplAccessorBlockSyntax case .accessorDecl: return visitImplAccessorDeclSyntax + case .accessorEffectSpecifiers: + return visitImplAccessorEffectSpecifiersSyntax case .accessorList: return visitImplAccessorListSyntax case .accessorParameter: @@ -5876,8 +5899,6 @@ open class SyntaxRewriter { return visitImplConventionAttributeArgumentsSyntax case .conventionWitnessMethodAttributeArguments: return visitImplConventionWitnessMethodAttributeArgumentsSyntax - case .declEffectSpecifiers: - return visitImplDeclEffectSpecifiersSyntax case .declModifierDetail: return visitImplDeclModifierDetailSyntax case .declModifier: @@ -5974,6 +5995,8 @@ open class SyntaxRewriter { return visitImplFunctionCallExprSyntax case .functionDecl: return visitImplFunctionDeclSyntax + case .functionEffectSpecifiers: + return visitImplFunctionEffectSpecifiersSyntax case .functionParameterList: return visitImplFunctionParameterListSyntax case .functionParameter: @@ -6300,6 +6323,8 @@ open class SyntaxRewriter { return visitImplAccessorBlockSyntax(data) case .accessorDecl: return visitImplAccessorDeclSyntax(data) + case .accessorEffectSpecifiers: + return visitImplAccessorEffectSpecifiersSyntax(data) case .accessorList: return visitImplAccessorListSyntax(data) case .accessorParameter: @@ -6420,8 +6445,6 @@ open class SyntaxRewriter { return visitImplConventionAttributeArgumentsSyntax(data) case .conventionWitnessMethodAttributeArguments: return visitImplConventionWitnessMethodAttributeArgumentsSyntax(data) - case .declEffectSpecifiers: - return visitImplDeclEffectSpecifiersSyntax(data) case .declModifierDetail: return visitImplDeclModifierDetailSyntax(data) case .declModifier: @@ -6518,6 +6541,8 @@ open class SyntaxRewriter { return visitImplFunctionCallExprSyntax(data) case .functionDecl: return visitImplFunctionDeclSyntax(data) + case .functionEffectSpecifiers: + return visitImplFunctionEffectSpecifiersSyntax(data) case .functionParameterList: return visitImplFunctionParameterListSyntax(data) case .functionParameter: diff --git a/Sources/SwiftSyntax/generated/SyntaxTraits.swift b/Sources/SwiftSyntax/generated/SyntaxTraits.swift index e10e731d032..1586f0b6fc6 100644 --- a/Sources/SwiftSyntax/generated/SyntaxTraits.swift +++ b/Sources/SwiftSyntax/generated/SyntaxTraits.swift @@ -451,6 +451,8 @@ extension AccessorBlockSyntax: BracedSyntax {} extension AccessorDeclSyntax: AttributedSyntax {} +extension AccessorEffectSpecifiersSyntax: EffectSpecifiersSyntax {} + extension AccessorParameterSyntax: ParenthesizedSyntax {} extension ActorDeclSyntax: DeclGroupSyntax, IdentifiedDeclSyntax, AttributedSyntax {} @@ -485,8 +487,6 @@ extension CodeBlockSyntax: BracedSyntax, WithStatementsSyntax {} extension ConditionElementSyntax: WithTrailingCommaSyntax {} -extension DeclEffectSpecifiersSyntax: EffectSpecifiersSyntax {} - extension DeclModifierDetailSyntax: ParenthesizedSyntax {} extension DeclNameArgumentsSyntax: ParenthesizedSyntax {} @@ -521,6 +521,8 @@ extension ForInStmtSyntax: WithCodeBlockSyntax {} extension FunctionDeclSyntax: IdentifiedDeclSyntax, AttributedSyntax {} +extension FunctionEffectSpecifiersSyntax: EffectSpecifiersSyntax {} + extension FunctionParameterSyntax: WithTrailingCommaSyntax, AttributedSyntax {} extension FunctionTypeSyntax: ParenthesizedSyntax {} diff --git a/Sources/SwiftSyntax/generated/SyntaxTransform.swift b/Sources/SwiftSyntax/generated/SyntaxTransform.swift index 613bdb25f96..40967c51cf5 100644 --- a/Sources/SwiftSyntax/generated/SyntaxTransform.swift +++ b/Sources/SwiftSyntax/generated/SyntaxTransform.swift @@ -39,6 +39,11 @@ public protocol SyntaxTransformVisitor { /// - Returns: the sum of whatever the child visitors return. func visit(_ node: AccessorDeclSyntax) -> ResultType + /// Visiting `AccessorEffectSpecifiersSyntax` specifically. + /// - Parameter node: the node we are visiting. + /// - Returns: the sum of whatever the child visitors return. + func visit(_ node: AccessorEffectSpecifiersSyntax) -> ResultType + /// Visiting `AccessorListSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: the sum of whatever the child visitors return. @@ -339,11 +344,6 @@ public protocol SyntaxTransformVisitor { /// - Returns: the sum of whatever the child visitors return. func visit(_ node: ConventionWitnessMethodAttributeArgumentsSyntax) -> ResultType - /// Visiting `DeclEffectSpecifiersSyntax` specifically. - /// - Parameter node: the node we are visiting. - /// - Returns: the sum of whatever the child visitors return. - func visit(_ node: DeclEffectSpecifiersSyntax) -> ResultType - /// Visiting `DeclModifierDetailSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: the sum of whatever the child visitors return. @@ -584,6 +584,11 @@ public protocol SyntaxTransformVisitor { /// - Returns: the sum of whatever the child visitors return. func visit(_ node: FunctionDeclSyntax) -> ResultType + /// Visiting `FunctionEffectSpecifiersSyntax` specifically. + /// - Parameter node: the node we are visiting. + /// - Returns: the sum of whatever the child visitors return. + func visit(_ node: FunctionEffectSpecifiersSyntax) -> ResultType + /// Visiting `FunctionParameterListSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: the sum of whatever the child visitors return. @@ -1388,6 +1393,13 @@ extension SyntaxTransformVisitor { visitAny(Syntax(node)) } + /// Visiting `AccessorEffectSpecifiersSyntax` specifically. + /// - Parameter node: the node we are visiting. + /// - Returns: nil by default. + public func visit(_ node: AccessorEffectSpecifiersSyntax) -> ResultType { + visitAny(Syntax(node)) + } + /// Visiting `AccessorListSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: nil by default. @@ -1808,13 +1820,6 @@ extension SyntaxTransformVisitor { visitAny(Syntax(node)) } - /// Visiting `DeclEffectSpecifiersSyntax` specifically. - /// - Parameter node: the node we are visiting. - /// - Returns: nil by default. - public func visit(_ node: DeclEffectSpecifiersSyntax) -> ResultType { - visitAny(Syntax(node)) - } - /// Visiting `DeclModifierDetailSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: nil by default. @@ -2151,6 +2156,13 @@ extension SyntaxTransformVisitor { visitAny(Syntax(node)) } + /// Visiting `FunctionEffectSpecifiersSyntax` specifically. + /// - Parameter node: the node we are visiting. + /// - Returns: nil by default. + public func visit(_ node: FunctionEffectSpecifiersSyntax) -> ResultType { + visitAny(Syntax(node)) + } + /// Visiting `FunctionParameterListSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: nil by default. @@ -3241,6 +3253,8 @@ extension SyntaxTransformVisitor { return visit(derived) case .accessorDecl(let derived): return visit(derived) + case .accessorEffectSpecifiers(let derived): + return visit(derived) case .accessorList(let derived): return visit(derived) case .accessorParameter(let derived): @@ -3361,8 +3375,6 @@ extension SyntaxTransformVisitor { return visit(derived) case .conventionWitnessMethodAttributeArguments(let derived): return visit(derived) - case .declEffectSpecifiers(let derived): - return visit(derived) case .declModifierDetail(let derived): return visit(derived) case .declModifier(let derived): @@ -3459,6 +3471,8 @@ extension SyntaxTransformVisitor { return visit(derived) case .functionDecl(let derived): return visit(derived) + case .functionEffectSpecifiers(let derived): + return visit(derived) case .functionParameterList(let derived): return visit(derived) case .functionParameter(let derived): diff --git a/Sources/SwiftSyntax/generated/SyntaxVisitor.swift b/Sources/SwiftSyntax/generated/SyntaxVisitor.swift index 512c3bfd286..0e9e589d93c 100644 --- a/Sources/SwiftSyntax/generated/SyntaxVisitor.swift +++ b/Sources/SwiftSyntax/generated/SyntaxVisitor.swift @@ -82,6 +82,18 @@ open class SyntaxVisitor { open func visitPost(_ node: AccessorDeclSyntax) { } + /// Visiting `AccessorEffectSpecifiersSyntax` specifically. + /// - Parameter node: the node we are visiting. + /// - Returns: how should we continue visiting. + open func visit(_ node: AccessorEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { + return .visitChildren + } + + /// The function called after visiting `AccessorEffectSpecifiersSyntax` and its descendents. + /// - node: the node we just finished visiting. + open func visitPost(_ node: AccessorEffectSpecifiersSyntax) { + } + /// Visiting `AccessorListSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: how should we continue visiting. @@ -802,18 +814,6 @@ open class SyntaxVisitor { open func visitPost(_ node: ConventionWitnessMethodAttributeArgumentsSyntax) { } - /// Visiting `DeclEffectSpecifiersSyntax` specifically. - /// - Parameter node: the node we are visiting. - /// - Returns: how should we continue visiting. - open func visit(_ node: DeclEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { - return .visitChildren - } - - /// The function called after visiting `DeclEffectSpecifiersSyntax` and its descendents. - /// - node: the node we just finished visiting. - open func visitPost(_ node: DeclEffectSpecifiersSyntax) { - } - /// Visiting `DeclModifierDetailSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: how should we continue visiting. @@ -1390,6 +1390,18 @@ open class SyntaxVisitor { open func visitPost(_ node: FunctionDeclSyntax) { } + /// Visiting `FunctionEffectSpecifiersSyntax` specifically. + /// - Parameter node: the node we are visiting. + /// - Returns: how should we continue visiting. + open func visit(_ node: FunctionEffectSpecifiersSyntax) -> SyntaxVisitorContinueKind { + return .visitChildren + } + + /// The function called after visiting `FunctionEffectSpecifiersSyntax` and its descendents. + /// - node: the node we just finished visiting. + open func visitPost(_ node: FunctionEffectSpecifiersSyntax) { + } + /// Visiting `FunctionParameterListSyntax` specifically. /// - Parameter node: the node we are visiting. /// - Returns: how should we continue visiting. @@ -3294,6 +3306,17 @@ open class SyntaxVisitor { visitPost(node) } + /// Implementation detail of doVisit(_:_:). Do not call directly. + private func visitImplAccessorEffectSpecifiersSyntax(_ data: SyntaxData) { + let node = AccessorEffectSpecifiersSyntax(data) + let needsChildren = (visit(node) == .visitChildren) + // Avoid calling into visitChildren if possible. + if needsChildren && !node.raw.layoutView!.children.isEmpty { + visitChildren(node) + } + visitPost(node) + } + /// Implementation detail of doVisit(_:_:). Do not call directly. private func visitImplAccessorListSyntax(_ data: SyntaxData) { let node = AccessorListSyntax(data) @@ -3954,17 +3977,6 @@ open class SyntaxVisitor { visitPost(node) } - /// Implementation detail of doVisit(_:_:). Do not call directly. - private func visitImplDeclEffectSpecifiersSyntax(_ data: SyntaxData) { - let node = DeclEffectSpecifiersSyntax(data) - let needsChildren = (visit(node) == .visitChildren) - // Avoid calling into visitChildren if possible. - if needsChildren && !node.raw.layoutView!.children.isEmpty { - visitChildren(node) - } - visitPost(node) - } - /// Implementation detail of doVisit(_:_:). Do not call directly. private func visitImplDeclModifierDetailSyntax(_ data: SyntaxData) { let node = DeclModifierDetailSyntax(data) @@ -4493,6 +4505,17 @@ open class SyntaxVisitor { visitPost(node) } + /// Implementation detail of doVisit(_:_:). Do not call directly. + private func visitImplFunctionEffectSpecifiersSyntax(_ data: SyntaxData) { + let node = FunctionEffectSpecifiersSyntax(data) + let needsChildren = (visit(node) == .visitChildren) + // Avoid calling into visitChildren if possible. + if needsChildren && !node.raw.layoutView!.children.isEmpty { + visitChildren(node) + } + visitPost(node) + } + /// Implementation detail of doVisit(_:_:). Do not call directly. private func visitImplFunctionParameterListSyntax(_ data: SyntaxData) { let node = FunctionParameterListSyntax(data) @@ -6202,6 +6225,8 @@ open class SyntaxVisitor { visitImplAccessorBlockSyntax(data) case .accessorDecl: visitImplAccessorDeclSyntax(data) + case .accessorEffectSpecifiers: + visitImplAccessorEffectSpecifiersSyntax(data) case .accessorList: visitImplAccessorListSyntax(data) case .accessorParameter: @@ -6322,8 +6347,6 @@ open class SyntaxVisitor { visitImplConventionAttributeArgumentsSyntax(data) case .conventionWitnessMethodAttributeArguments: visitImplConventionWitnessMethodAttributeArgumentsSyntax(data) - case .declEffectSpecifiers: - visitImplDeclEffectSpecifiersSyntax(data) case .declModifierDetail: visitImplDeclModifierDetailSyntax(data) case .declModifier: @@ -6420,6 +6443,8 @@ open class SyntaxVisitor { visitImplFunctionCallExprSyntax(data) case .functionDecl: visitImplFunctionDeclSyntax(data) + case .functionEffectSpecifiers: + visitImplFunctionEffectSpecifiersSyntax(data) case .functionParameterList: visitImplFunctionParameterListSyntax(data) case .functionParameter: diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift index d31bca4bf0d..af768167810 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift @@ -268,7 +268,7 @@ public struct RawAccessorDeclSyntax: RawDeclSyntaxNodeProtocol { _ unexpectedBetweenAccessorKindAndParameter: RawUnexpectedNodesSyntax? = nil, parameter: RawAccessorParameterSyntax?, _ unexpectedBetweenParameterAndEffectSpecifiers: RawUnexpectedNodesSyntax? = nil, - effectSpecifiers: RawDeclEffectSpecifiersSyntax?, + effectSpecifiers: RawAccessorEffectSpecifiersSyntax?, _ unexpectedBetweenEffectSpecifiersAndBody: RawUnexpectedNodesSyntax? = nil, body: RawCodeBlockSyntax?, _ unexpectedAfterBody: RawUnexpectedNodesSyntax? = nil, @@ -330,8 +330,8 @@ public struct RawAccessorDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[8].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var effectSpecifiers: RawDeclEffectSpecifiersSyntax? { - layoutView.children[9].map(RawDeclEffectSpecifiersSyntax.init(raw:)) + public var effectSpecifiers: RawAccessorEffectSpecifiersSyntax? { + layoutView.children[9].map(RawAccessorEffectSpecifiersSyntax.init(raw:)) } public var unexpectedBetweenEffectSpecifiersAndBody: RawUnexpectedNodesSyntax? { @@ -347,6 +347,76 @@ public struct RawAccessorDeclSyntax: RawDeclSyntaxNodeProtocol { } } +@_spi(RawSyntax) +public struct RawAccessorEffectSpecifiersSyntax: RawSyntaxNodeProtocol { + @_spi(RawSyntax) + public var layoutView: RawSyntaxLayoutView { + return raw.layoutView! + } + + public static func isKindOf(_ raw: RawSyntax) -> Bool { + return raw.kind == .accessorEffectSpecifiers + } + + public var raw: RawSyntax + + init(raw: RawSyntax) { + precondition(Self.isKindOf(raw)) + self.raw = raw + } + + private init(unchecked raw: RawSyntax) { + self.raw = raw + } + + public init?(_ other: Node) { + guard Self.isKindOf(other.raw) else { + return nil + } + self.init(unchecked: other.raw) + } + + public init( + _ unexpectedBeforeAsyncSpecifier: RawUnexpectedNodesSyntax? = nil, + asyncSpecifier: RawTokenSyntax?, + _ unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: RawUnexpectedNodesSyntax? = nil, + throwsSpecifier: RawTokenSyntax?, + _ unexpectedAfterThrowsSpecifier: RawUnexpectedNodesSyntax? = nil, + arena: __shared SyntaxArena + ) { + let raw = RawSyntax.makeLayout( + kind: .accessorEffectSpecifiers, uninitializedCount: 5, arena: arena) { layout in + layout.initialize(repeating: nil) + layout[0] = unexpectedBeforeAsyncSpecifier?.raw + layout[1] = asyncSpecifier?.raw + layout[2] = unexpectedBetweenAsyncSpecifierAndThrowsSpecifier?.raw + layout[3] = throwsSpecifier?.raw + layout[4] = unexpectedAfterThrowsSpecifier?.raw + } + self.init(unchecked: raw) + } + + public var unexpectedBeforeAsyncSpecifier: RawUnexpectedNodesSyntax? { + layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) + } + + public var asyncSpecifier: RawTokenSyntax? { + layoutView.children[1].map(RawTokenSyntax.init(raw:)) + } + + public var unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: RawUnexpectedNodesSyntax? { + layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) + } + + public var throwsSpecifier: RawTokenSyntax? { + layoutView.children[3].map(RawTokenSyntax.init(raw:)) + } + + public var unexpectedAfterThrowsSpecifier: RawUnexpectedNodesSyntax? { + layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:)) + } +} + @_spi(RawSyntax) public struct RawAccessorListSyntax: RawSyntaxNodeProtocol { @_spi(RawSyntax) @@ -5298,76 +5368,6 @@ public struct RawConventionWitnessMethodAttributeArgumentsSyntax: RawSyntaxNodeP } } -@_spi(RawSyntax) -public struct RawDeclEffectSpecifiersSyntax: RawSyntaxNodeProtocol { - @_spi(RawSyntax) - public var layoutView: RawSyntaxLayoutView { - return raw.layoutView! - } - - public static func isKindOf(_ raw: RawSyntax) -> Bool { - return raw.kind == .declEffectSpecifiers - } - - public var raw: RawSyntax - - init(raw: RawSyntax) { - precondition(Self.isKindOf(raw)) - self.raw = raw - } - - private init(unchecked raw: RawSyntax) { - self.raw = raw - } - - public init?(_ other: Node) { - guard Self.isKindOf(other.raw) else { - return nil - } - self.init(unchecked: other.raw) - } - - public init( - _ unexpectedBeforeAsyncSpecifier: RawUnexpectedNodesSyntax? = nil, - asyncSpecifier: RawTokenSyntax?, - _ unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: RawUnexpectedNodesSyntax? = nil, - throwsSpecifier: RawTokenSyntax?, - _ unexpectedAfterThrowsSpecifier: RawUnexpectedNodesSyntax? = nil, - arena: __shared SyntaxArena - ) { - let raw = RawSyntax.makeLayout( - kind: .declEffectSpecifiers, uninitializedCount: 5, arena: arena) { layout in - layout.initialize(repeating: nil) - layout[0] = unexpectedBeforeAsyncSpecifier?.raw - layout[1] = asyncSpecifier?.raw - layout[2] = unexpectedBetweenAsyncSpecifierAndThrowsSpecifier?.raw - layout[3] = throwsSpecifier?.raw - layout[4] = unexpectedAfterThrowsSpecifier?.raw - } - self.init(unchecked: raw) - } - - public var unexpectedBeforeAsyncSpecifier: RawUnexpectedNodesSyntax? { - layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) - } - - public var asyncSpecifier: RawTokenSyntax? { - layoutView.children[1].map(RawTokenSyntax.init(raw:)) - } - - public var unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: RawUnexpectedNodesSyntax? { - layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) - } - - public var throwsSpecifier: RawTokenSyntax? { - layoutView.children[3].map(RawTokenSyntax.init(raw:)) - } - - public var unexpectedAfterThrowsSpecifier: RawUnexpectedNodesSyntax? { - layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:)) - } -} - @_spi(RawSyntax) public struct RawDeclModifierDetailSyntax: RawSyntaxNodeProtocol { @_spi(RawSyntax) @@ -9439,6 +9439,76 @@ public struct RawFunctionDeclSyntax: RawDeclSyntaxNodeProtocol { } } +@_spi(RawSyntax) +public struct RawFunctionEffectSpecifiersSyntax: RawSyntaxNodeProtocol { + @_spi(RawSyntax) + public var layoutView: RawSyntaxLayoutView { + return raw.layoutView! + } + + public static func isKindOf(_ raw: RawSyntax) -> Bool { + return raw.kind == .functionEffectSpecifiers + } + + public var raw: RawSyntax + + init(raw: RawSyntax) { + precondition(Self.isKindOf(raw)) + self.raw = raw + } + + private init(unchecked raw: RawSyntax) { + self.raw = raw + } + + public init?(_ other: Node) { + guard Self.isKindOf(other.raw) else { + return nil + } + self.init(unchecked: other.raw) + } + + public init( + _ unexpectedBeforeAsyncSpecifier: RawUnexpectedNodesSyntax? = nil, + asyncSpecifier: RawTokenSyntax?, + _ unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: RawUnexpectedNodesSyntax? = nil, + throwsSpecifier: RawTokenSyntax?, + _ unexpectedAfterThrowsSpecifier: RawUnexpectedNodesSyntax? = nil, + arena: __shared SyntaxArena + ) { + let raw = RawSyntax.makeLayout( + kind: .functionEffectSpecifiers, uninitializedCount: 5, arena: arena) { layout in + layout.initialize(repeating: nil) + layout[0] = unexpectedBeforeAsyncSpecifier?.raw + layout[1] = asyncSpecifier?.raw + layout[2] = unexpectedBetweenAsyncSpecifierAndThrowsSpecifier?.raw + layout[3] = throwsSpecifier?.raw + layout[4] = unexpectedAfterThrowsSpecifier?.raw + } + self.init(unchecked: raw) + } + + public var unexpectedBeforeAsyncSpecifier: RawUnexpectedNodesSyntax? { + layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) + } + + public var asyncSpecifier: RawTokenSyntax? { + layoutView.children[1].map(RawTokenSyntax.init(raw:)) + } + + public var unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: RawUnexpectedNodesSyntax? { + layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) + } + + public var throwsSpecifier: RawTokenSyntax? { + layoutView.children[3].map(RawTokenSyntax.init(raw:)) + } + + public var unexpectedAfterThrowsSpecifier: RawUnexpectedNodesSyntax? { + layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:)) + } +} + @_spi(RawSyntax) public struct RawFunctionParameterListSyntax: RawSyntaxNodeProtocol { @_spi(RawSyntax) @@ -9676,7 +9746,7 @@ public struct RawFunctionSignatureSyntax: RawSyntaxNodeProtocol { _ unexpectedBeforeInput: RawUnexpectedNodesSyntax? = nil, input: RawParameterClauseSyntax, _ unexpectedBetweenInputAndEffectSpecifiers: RawUnexpectedNodesSyntax? = nil, - effectSpecifiers: RawDeclEffectSpecifiersSyntax?, + effectSpecifiers: RawFunctionEffectSpecifiersSyntax?, _ unexpectedBetweenEffectSpecifiersAndOutput: RawUnexpectedNodesSyntax? = nil, output: RawReturnClauseSyntax?, _ unexpectedAfterOutput: RawUnexpectedNodesSyntax? = nil, @@ -9708,8 +9778,8 @@ public struct RawFunctionSignatureSyntax: RawSyntaxNodeProtocol { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var effectSpecifiers: RawDeclEffectSpecifiersSyntax? { - layoutView.children[3].map(RawDeclEffectSpecifiersSyntax.init(raw:)) + public var effectSpecifiers: RawFunctionEffectSpecifiersSyntax? { + layoutView.children[3].map(RawFunctionEffectSpecifiersSyntax.init(raw:)) } public var unexpectedBetweenEffectSpecifiersAndOutput: RawUnexpectedNodesSyntax? { diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index b3746b30513..2bbc219d2ac 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -273,10 +273,17 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 7, verify(layout[7], as: RawAccessorParameterSyntax?.self)) assertNoError(kind, 8, verify(layout[8], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 9, verify(layout[9], as: RawDeclEffectSpecifiersSyntax?.self)) + assertNoError(kind, 9, verify(layout[9], as: RawAccessorEffectSpecifiersSyntax?.self)) assertNoError(kind, 10, verify(layout[10], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 11, verify(layout[11], as: RawCodeBlockSyntax?.self)) assertNoError(kind, 12, verify(layout[12], as: RawUnexpectedNodesSyntax?.self)) + case .accessorEffectSpecifiers: + assert(layout.count == 5) + assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax?.self, tokenChoices: [.keyword("async")])) + assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax?.self, tokenChoices: [.keyword("throws")])) + assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) case .accessorList: for (index, element) in layout.enumerated() { assertNoError(kind, index, verify(element, as: RawAccessorDeclSyntax.self)) @@ -787,13 +794,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.identifier)])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) - case .declEffectSpecifiers: - assert(layout.count == 5) - assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax?.self, tokenChoices: [.keyword("async"), .keyword("reasync")])) - assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax?.self, tokenChoices: [.keyword("throws"), .keyword("rethrows")])) - assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) case .declModifierDetail: assert(layout.count == 7) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) @@ -1271,6 +1271,13 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 14, verify(layout[14], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 15, verify(layout[15], as: RawCodeBlockSyntax?.self)) assertNoError(kind, 16, verify(layout[16], as: RawUnexpectedNodesSyntax?.self)) + case .functionEffectSpecifiers: + assert(layout.count == 5) + assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax?.self, tokenChoices: [.keyword("async"), .keyword("reasync")])) + assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax?.self, tokenChoices: [.keyword("throws"), .keyword("rethrows")])) + assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) case .functionParameterList: for (index, element) in layout.enumerated() { assertNoError(kind, index, verify(element, as: RawFunctionParameterSyntax.self)) @@ -1301,7 +1308,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 1, verify(layout[1], as: RawParameterClauseSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclEffectSpecifiersSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawFunctionEffectSpecifiersSyntax?.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawReturnClauseSyntax?.self)) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift index 365262da656..23740f3e3f4 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift @@ -44,7 +44,7 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenAccessorKindAndParameter: UnexpectedNodesSyntax? = nil, parameter: AccessorParameterSyntax? = nil, _ unexpectedBetweenParameterAndEffectSpecifiers: UnexpectedNodesSyntax? = nil, - effectSpecifiers: DeclEffectSpecifiersSyntax? = nil, + effectSpecifiers: AccessorEffectSpecifiersSyntax? = nil, _ unexpectedBetweenEffectSpecifiersAndBody: UnexpectedNodesSyntax? = nil, body: CodeBlockSyntax? = nil, _ unexpectedAfterBody: UnexpectedNodesSyntax? = nil, @@ -195,9 +195,9 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var effectSpecifiers: DeclEffectSpecifiersSyntax? { + public var effectSpecifiers: AccessorEffectSpecifiersSyntax? { get { - return data.child(at: 9, parent: Syntax(self)).map(DeclEffectSpecifiersSyntax.init) + return data.child(at: 9, parent: Syntax(self)).map(AccessorEffectSpecifiersSyntax.init) } set(value) { self = AccessorDeclSyntax(data.replacingChild(at: 9, with: value?.raw, arena: SyntaxArena())) diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift index 7eba7e0af07..45c3ca16e7a 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift @@ -313,6 +313,133 @@ extension AccessorBlockSyntax: CustomReflectable { } } +// MARK: - AccessorEffectSpecifiersSyntax + + +public struct AccessorEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { + public let _syntaxNode: Syntax + + public init?(_ node: S) { + guard node.raw.kind == .accessorEffectSpecifiers else { + return nil + } + self._syntaxNode = node._syntaxNode + } + + /// Creates a `AccessorEffectSpecifiersSyntax` node from the given `SyntaxData`. This assumes + /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour + /// is undefined. + internal init(_ data: SyntaxData) { + precondition(data.raw.kind == .accessorEffectSpecifiers) + self._syntaxNode = Syntax(data) + } + + public init( + leadingTrivia: Trivia? = nil, + _ unexpectedBeforeAsyncSpecifier: UnexpectedNodesSyntax? = nil, + asyncSpecifier: TokenSyntax? = nil, + _ unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: UnexpectedNodesSyntax? = nil, + throwsSpecifier: TokenSyntax? = nil, + _ unexpectedAfterThrowsSpecifier: UnexpectedNodesSyntax? = nil, + trailingTrivia: Trivia? = nil + + ) { + // Extend the lifetime of all parameters so their arenas don't get destroyed + // before they can be added as children of the new arena. + let data: SyntaxData = withExtendedLifetime((SyntaxArena(), ( + unexpectedBeforeAsyncSpecifier, + asyncSpecifier, + unexpectedBetweenAsyncSpecifierAndThrowsSpecifier, + throwsSpecifier, + unexpectedAfterThrowsSpecifier + ))) {(arena, _) in + let layout: [RawSyntax?] = [ + unexpectedBeforeAsyncSpecifier?.raw, + asyncSpecifier?.raw, + unexpectedBetweenAsyncSpecifierAndThrowsSpecifier?.raw, + throwsSpecifier?.raw, + unexpectedAfterThrowsSpecifier?.raw + ] + let raw = RawSyntax.makeLayout( + kind: SyntaxKind.accessorEffectSpecifiers, + from: layout, + arena: arena, + leadingTrivia: leadingTrivia, + trailingTrivia: trailingTrivia + ) + return SyntaxData.forRoot(raw) + } + self.init(data) + } + + public var unexpectedBeforeAsyncSpecifier: UnexpectedNodesSyntax? { + get { + return data.child(at: 0, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) + } + set(value) { + self = AccessorEffectSpecifiersSyntax(data.replacingChild(at: 0, with: value?.raw, arena: SyntaxArena())) + } + } + + public var asyncSpecifier: TokenSyntax? { + get { + return data.child(at: 1, parent: Syntax(self)).map(TokenSyntax.init) + } + set(value) { + self = AccessorEffectSpecifiersSyntax(data.replacingChild(at: 1, with: value?.raw, arena: SyntaxArena())) + } + } + + public var unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: UnexpectedNodesSyntax? { + get { + return data.child(at: 2, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) + } + set(value) { + self = AccessorEffectSpecifiersSyntax(data.replacingChild(at: 2, with: value?.raw, arena: SyntaxArena())) + } + } + + public var throwsSpecifier: TokenSyntax? { + get { + return data.child(at: 3, parent: Syntax(self)).map(TokenSyntax.init) + } + set(value) { + self = AccessorEffectSpecifiersSyntax(data.replacingChild(at: 3, with: value?.raw, arena: SyntaxArena())) + } + } + + public var unexpectedAfterThrowsSpecifier: UnexpectedNodesSyntax? { + get { + return data.child(at: 4, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) + } + set(value) { + self = AccessorEffectSpecifiersSyntax(data.replacingChild(at: 4, with: value?.raw, arena: SyntaxArena())) + } + } + + public static var structure: SyntaxNodeStructure { + return .layout([ + \Self.unexpectedBeforeAsyncSpecifier, + \Self.asyncSpecifier, + \Self.unexpectedBetweenAsyncSpecifierAndThrowsSpecifier, + \Self.throwsSpecifier, + \Self.unexpectedAfterThrowsSpecifier + ]) + } +} + +extension AccessorEffectSpecifiersSyntax: CustomReflectable { + public var customMirror: Mirror { + return Mirror(self, children: [ + "unexpectedBeforeAsyncSpecifier": unexpectedBeforeAsyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "asyncSpecifier": asyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier": unexpectedBetweenAsyncSpecifierAndThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "throwsSpecifier": throwsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "unexpectedAfterThrowsSpecifier": unexpectedAfterThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any + ]) + } +} + // MARK: - AccessorParameterSyntax @@ -5579,133 +5706,6 @@ extension ConventionWitnessMethodAttributeArgumentsSyntax: CustomReflectable { } } -// MARK: - DeclEffectSpecifiersSyntax - - -public struct DeclEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { - public let _syntaxNode: Syntax - - public init?(_ node: S) { - guard node.raw.kind == .declEffectSpecifiers else { - return nil - } - self._syntaxNode = node._syntaxNode - } - - /// Creates a `DeclEffectSpecifiersSyntax` node from the given `SyntaxData`. This assumes - /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour - /// is undefined. - internal init(_ data: SyntaxData) { - precondition(data.raw.kind == .declEffectSpecifiers) - self._syntaxNode = Syntax(data) - } - - public init( - leadingTrivia: Trivia? = nil, - _ unexpectedBeforeAsyncSpecifier: UnexpectedNodesSyntax? = nil, - asyncSpecifier: TokenSyntax? = nil, - _ unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: UnexpectedNodesSyntax? = nil, - throwsSpecifier: TokenSyntax? = nil, - _ unexpectedAfterThrowsSpecifier: UnexpectedNodesSyntax? = nil, - trailingTrivia: Trivia? = nil - - ) { - // Extend the lifetime of all parameters so their arenas don't get destroyed - // before they can be added as children of the new arena. - let data: SyntaxData = withExtendedLifetime((SyntaxArena(), ( - unexpectedBeforeAsyncSpecifier, - asyncSpecifier, - unexpectedBetweenAsyncSpecifierAndThrowsSpecifier, - throwsSpecifier, - unexpectedAfterThrowsSpecifier - ))) {(arena, _) in - let layout: [RawSyntax?] = [ - unexpectedBeforeAsyncSpecifier?.raw, - asyncSpecifier?.raw, - unexpectedBetweenAsyncSpecifierAndThrowsSpecifier?.raw, - throwsSpecifier?.raw, - unexpectedAfterThrowsSpecifier?.raw - ] - let raw = RawSyntax.makeLayout( - kind: SyntaxKind.declEffectSpecifiers, - from: layout, - arena: arena, - leadingTrivia: leadingTrivia, - trailingTrivia: trailingTrivia - ) - return SyntaxData.forRoot(raw) - } - self.init(data) - } - - public var unexpectedBeforeAsyncSpecifier: UnexpectedNodesSyntax? { - get { - return data.child(at: 0, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) - } - set(value) { - self = DeclEffectSpecifiersSyntax(data.replacingChild(at: 0, with: value?.raw, arena: SyntaxArena())) - } - } - - public var asyncSpecifier: TokenSyntax? { - get { - return data.child(at: 1, parent: Syntax(self)).map(TokenSyntax.init) - } - set(value) { - self = DeclEffectSpecifiersSyntax(data.replacingChild(at: 1, with: value?.raw, arena: SyntaxArena())) - } - } - - public var unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: UnexpectedNodesSyntax? { - get { - return data.child(at: 2, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) - } - set(value) { - self = DeclEffectSpecifiersSyntax(data.replacingChild(at: 2, with: value?.raw, arena: SyntaxArena())) - } - } - - public var throwsSpecifier: TokenSyntax? { - get { - return data.child(at: 3, parent: Syntax(self)).map(TokenSyntax.init) - } - set(value) { - self = DeclEffectSpecifiersSyntax(data.replacingChild(at: 3, with: value?.raw, arena: SyntaxArena())) - } - } - - public var unexpectedAfterThrowsSpecifier: UnexpectedNodesSyntax? { - get { - return data.child(at: 4, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) - } - set(value) { - self = DeclEffectSpecifiersSyntax(data.replacingChild(at: 4, with: value?.raw, arena: SyntaxArena())) - } - } - - public static var structure: SyntaxNodeStructure { - return .layout([ - \Self.unexpectedBeforeAsyncSpecifier, - \Self.asyncSpecifier, - \Self.unexpectedBetweenAsyncSpecifierAndThrowsSpecifier, - \Self.throwsSpecifier, - \Self.unexpectedAfterThrowsSpecifier - ]) - } -} - -extension DeclEffectSpecifiersSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAsyncSpecifier": unexpectedBeforeAsyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "asyncSpecifier": asyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier": unexpectedBetweenAsyncSpecifierAndThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "throwsSpecifier": throwsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterThrowsSpecifier": unexpectedAfterThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeclModifierDetailSyntax @@ -9134,6 +9134,133 @@ extension ExpressionSegmentSyntax: CustomReflectable { } } +// MARK: - FunctionEffectSpecifiersSyntax + + +public struct FunctionEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { + public let _syntaxNode: Syntax + + public init?(_ node: S) { + guard node.raw.kind == .functionEffectSpecifiers else { + return nil + } + self._syntaxNode = node._syntaxNode + } + + /// Creates a `FunctionEffectSpecifiersSyntax` node from the given `SyntaxData`. This assumes + /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour + /// is undefined. + internal init(_ data: SyntaxData) { + precondition(data.raw.kind == .functionEffectSpecifiers) + self._syntaxNode = Syntax(data) + } + + public init( + leadingTrivia: Trivia? = nil, + _ unexpectedBeforeAsyncSpecifier: UnexpectedNodesSyntax? = nil, + asyncSpecifier: TokenSyntax? = nil, + _ unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: UnexpectedNodesSyntax? = nil, + throwsSpecifier: TokenSyntax? = nil, + _ unexpectedAfterThrowsSpecifier: UnexpectedNodesSyntax? = nil, + trailingTrivia: Trivia? = nil + + ) { + // Extend the lifetime of all parameters so their arenas don't get destroyed + // before they can be added as children of the new arena. + let data: SyntaxData = withExtendedLifetime((SyntaxArena(), ( + unexpectedBeforeAsyncSpecifier, + asyncSpecifier, + unexpectedBetweenAsyncSpecifierAndThrowsSpecifier, + throwsSpecifier, + unexpectedAfterThrowsSpecifier + ))) {(arena, _) in + let layout: [RawSyntax?] = [ + unexpectedBeforeAsyncSpecifier?.raw, + asyncSpecifier?.raw, + unexpectedBetweenAsyncSpecifierAndThrowsSpecifier?.raw, + throwsSpecifier?.raw, + unexpectedAfterThrowsSpecifier?.raw + ] + let raw = RawSyntax.makeLayout( + kind: SyntaxKind.functionEffectSpecifiers, + from: layout, + arena: arena, + leadingTrivia: leadingTrivia, + trailingTrivia: trailingTrivia + ) + return SyntaxData.forRoot(raw) + } + self.init(data) + } + + public var unexpectedBeforeAsyncSpecifier: UnexpectedNodesSyntax? { + get { + return data.child(at: 0, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) + } + set(value) { + self = FunctionEffectSpecifiersSyntax(data.replacingChild(at: 0, with: value?.raw, arena: SyntaxArena())) + } + } + + public var asyncSpecifier: TokenSyntax? { + get { + return data.child(at: 1, parent: Syntax(self)).map(TokenSyntax.init) + } + set(value) { + self = FunctionEffectSpecifiersSyntax(data.replacingChild(at: 1, with: value?.raw, arena: SyntaxArena())) + } + } + + public var unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: UnexpectedNodesSyntax? { + get { + return data.child(at: 2, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) + } + set(value) { + self = FunctionEffectSpecifiersSyntax(data.replacingChild(at: 2, with: value?.raw, arena: SyntaxArena())) + } + } + + public var throwsSpecifier: TokenSyntax? { + get { + return data.child(at: 3, parent: Syntax(self)).map(TokenSyntax.init) + } + set(value) { + self = FunctionEffectSpecifiersSyntax(data.replacingChild(at: 3, with: value?.raw, arena: SyntaxArena())) + } + } + + public var unexpectedAfterThrowsSpecifier: UnexpectedNodesSyntax? { + get { + return data.child(at: 4, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) + } + set(value) { + self = FunctionEffectSpecifiersSyntax(data.replacingChild(at: 4, with: value?.raw, arena: SyntaxArena())) + } + } + + public static var structure: SyntaxNodeStructure { + return .layout([ + \Self.unexpectedBeforeAsyncSpecifier, + \Self.asyncSpecifier, + \Self.unexpectedBetweenAsyncSpecifierAndThrowsSpecifier, + \Self.throwsSpecifier, + \Self.unexpectedAfterThrowsSpecifier + ]) + } +} + +extension FunctionEffectSpecifiersSyntax: CustomReflectable { + public var customMirror: Mirror { + return Mirror(self, children: [ + "unexpectedBeforeAsyncSpecifier": unexpectedBeforeAsyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "asyncSpecifier": asyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier": unexpectedBetweenAsyncSpecifierAndThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "throwsSpecifier": throwsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , + "unexpectedAfterThrowsSpecifier": unexpectedAfterThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any + ]) + } +} + // MARK: - FunctionParameterSyntax @@ -9521,7 +9648,7 @@ public struct FunctionSignatureSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBeforeInput: UnexpectedNodesSyntax? = nil, input: ParameterClauseSyntax, _ unexpectedBetweenInputAndEffectSpecifiers: UnexpectedNodesSyntax? = nil, - effectSpecifiers: DeclEffectSpecifiersSyntax? = nil, + effectSpecifiers: FunctionEffectSpecifiersSyntax? = nil, _ unexpectedBetweenEffectSpecifiersAndOutput: UnexpectedNodesSyntax? = nil, output: ReturnClauseSyntax? = nil, _ unexpectedAfterOutput: UnexpectedNodesSyntax? = nil, @@ -9587,9 +9714,9 @@ public struct FunctionSignatureSyntax: SyntaxProtocol, SyntaxHashable { } } - public var effectSpecifiers: DeclEffectSpecifiersSyntax? { + public var effectSpecifiers: FunctionEffectSpecifiersSyntax? { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclEffectSpecifiersSyntax.init) + return data.child(at: 3, parent: Syntax(self)).map(FunctionEffectSpecifiersSyntax.init) } set(value) { self = FunctionSignatureSyntax(data.replacingChild(at: 3, with: value?.raw, arena: SyntaxArena())) diff --git a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift index 82fef37abb6..1f01971df8d 100644 --- a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift +++ b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift @@ -27,7 +27,7 @@ extension AccessorDeclSyntax { unexpectedBetweenAccessorKindAndParameter: UnexpectedNodesSyntax? = nil, parameter: AccessorParameterSyntax? = nil, unexpectedBetweenParameterAndEffectSpecifiers: UnexpectedNodesSyntax? = nil, - effectSpecifiers: DeclEffectSpecifiersSyntax? = nil, + effectSpecifiers: AccessorEffectSpecifiersSyntax? = nil, unexpectedBetweenEffectSpecifiersAndBody: UnexpectedNodesSyntax? = nil, unexpectedAfterBody: UnexpectedNodesSyntax? = nil, @CodeBlockItemListBuilder bodyBuilder: () throws -> CodeBlockItemListSyntax?, diff --git a/Tests/SwiftParserTest/DeclarationTests.swift b/Tests/SwiftParserTest/DeclarationTests.swift index 7243572f3f0..9a0360d9d39 100644 --- a/Tests/SwiftParserTest/DeclarationTests.swift +++ b/Tests/SwiftParserTest/DeclarationTests.swift @@ -733,9 +733,12 @@ final class DeclarationTests: XCTestCase { assertParse( """ var bad2 : Int { - get reasync { 0 } + get 1️⃣reasync { 0 } } - """ + """, + diagnostics: [ + DiagnosticSpec(message: "expected async specifier; did you mean 'async'?") + ] ) } @@ -766,18 +769,17 @@ final class DeclarationTests: XCTestCase { AccessorBlockSyntax( accessors: AccessorListSyntax([ AccessorDeclSyntax( - accessorKind: .keyword(.get), - effectSpecifiers: DeclEffectSpecifiersSyntax( - UnexpectedNodesSyntax([TokenSyntax.identifier("bogus")]), - throwsSpecifier: .keyword(.rethrows) - ) - ), - AccessorDeclSyntax(accessorKind: .keyword(.set)), + accessorKind: .keyword(.get) + ) + ]), + UnexpectedNodesSyntax([ + TokenSyntax.identifier("bogus"), TokenSyntax.keyword(.rethrows), + TokenSyntax.identifier("set"), ]) ) ), diagnostics: [ - DiagnosticSpec(message: "unexpected code 'bogus' before effect specifiers") + DiagnosticSpec(message: "unexpected code 'bogus rethrows set' in variable") ] ) } diff --git a/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift b/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift index a94edf20fbc..f7ead214162 100644 --- a/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift +++ b/Tests/SwiftParserTest/translated/EffectfulPropertiesTests.swift @@ -174,12 +174,13 @@ final class EffectfulPropertiesTests: XCTestCase { assertParse( """ var bad1 : Int { - get rethrows { 0 } - set rethrows { } + get 1️⃣rethrows { 0 } + set 2️⃣rethrows { } } """, diagnostics: [ - // TODO: Old parser expected error on line 2: only function declarations may be marked 'rethrows'; did you mean 'throws'? + DiagnosticSpec(message: "expected throwing specifier; did you mean 'throws'?"), + DiagnosticSpec(locationMarker: "2️⃣", message: "expected throwing specifier; did you mean 'throws'?"), ] ) } @@ -188,12 +189,13 @@ final class EffectfulPropertiesTests: XCTestCase { assertParse( """ var bad2 : Int { - get reasync { 0 } - set reasync { } + get 1️⃣reasync { 0 } + set 2️⃣reasync { } } """, diagnostics: [ - // TODO: Old parser expected error on line 2: expected '{' to start getter definition + DiagnosticSpec(locationMarker: "1️⃣", message: "expected async specifier; did you mean 'async'?"), + DiagnosticSpec(locationMarker: "2️⃣", message: "expected async specifier; did you mean 'async'?"), ] ) } @@ -213,12 +215,12 @@ final class EffectfulPropertiesTests: XCTestCase { assertParse( """ var bad4 : Int = 0 { - willSet(theValue) 3️⃣reasync 4️⃣rethrows 1️⃣async 2️⃣throws {} + willSet(theValue) 1️⃣reasync 2️⃣rethrows async 3️⃣throws {} } """, diagnostics: [ - DiagnosticSpec(locationMarker: "1️⃣", message: "'async' conflicts with 'reasync'", notes: [NoteSpec(locationMarker: "3️⃣", message: "'reasync' declared here")], fixIts: ["remove redundant 'async'"]), - DiagnosticSpec(locationMarker: "2️⃣", message: "'throws' conflicts with 'rethrows'", notes: [NoteSpec(locationMarker: "4️⃣", message: "'rethrows' declared here")], fixIts: ["remove redundant 'throws'"]), + DiagnosticSpec(locationMarker: "1️⃣", message: "expected async specifier; did you mean 'async'?", fixIts: ["replace 'reasync' with 'async'"]), + DiagnosticSpec(locationMarker: "2️⃣", message: "'rethrows' conflicts with 'throws'", notes: [NoteSpec(locationMarker: "3️⃣", message: "'throws' declared here")], fixIts: ["remove redundant 'rethrows'"]), ] ) } @@ -240,11 +242,11 @@ final class EffectfulPropertiesTests: XCTestCase { assertParse( """ var bad5 : Int { - get 1️⃣bogus rethrows {} + get 1️⃣bogus 2️⃣rethrows {} } """, diagnostics: [ - DiagnosticSpec(message: "unexpected code 'bogus' before effect specifiers") + DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected code 'bogus rethrows' in accessor") ] ) } @@ -253,11 +255,12 @@ final class EffectfulPropertiesTests: XCTestCase { assertParse( """ var bad6 : Int { - get rethrows 1️⃣-> Int { 0 } + get 1️⃣rethrows 2️⃣-> Int { 0 } } """, diagnostics: [ - DiagnosticSpec(message: "unexpected code '-> Int' in accessor") + DiagnosticSpec(locationMarker: "1️⃣", message: "expected throwing specifier; did you mean 'throws'?"), + DiagnosticSpec(locationMarker: "2️⃣", message: "unexpected code '-> Int' in accessor"), ] ) } @@ -294,16 +297,18 @@ final class EffectfulPropertiesTests: XCTestCase { """ protocol BadP { var prop2 : Int { get 1️⃣bogus rethrows set } - var prop3 : Int { get rethrows 2️⃣bogus set } - var prop4 : Int { get reasync 3️⃣bogus set } - var prop5 : Int { get throws 4️⃣async } + var prop3 : Int { get 2️⃣rethrows 3️⃣bogus set } + var prop4 : Int { get 4️⃣reasync 5️⃣bogus set } + var prop5 : Int { get throws 6️⃣async } } """, diagnostics: [ - DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected code 'bogus' before effect specifiers"), - DiagnosticSpec(locationMarker: "2️⃣", message: "unexpected code 'bogus set' in variable"), + DiagnosticSpec(locationMarker: "1️⃣", message: "unexpected code 'bogus rethrows set' in variable"), + DiagnosticSpec(locationMarker: "2️⃣", message: "expected throwing specifier; did you mean 'throws'?"), DiagnosticSpec(locationMarker: "3️⃣", message: "unexpected code 'bogus set' in variable"), - DiagnosticSpec(locationMarker: "4️⃣", message: "'async' must precede 'throws'"), + DiagnosticSpec(locationMarker: "4️⃣", message: "expected async specifier; did you mean 'async'?"), + DiagnosticSpec(locationMarker: "5️⃣", message: "unexpected code 'bogus set' in variable"), + DiagnosticSpec(locationMarker: "6️⃣", message: "'async' must precede 'throws'"), ] ) } From b6099e91b021a7b974e868df555dd2c41cb39585 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 12 Apr 2023 14:49:12 -0700 Subject: [PATCH 07/22] Merge pull request #1518 from stevapple/else-spacing Add whitespace before `else` --- .../Sources/SyntaxSupport/KeywordSpec.swift | 2 +- .../generated/BasicFormat.swift | 2 ++ .../SwiftSyntaxBuilderTest/IfStmtTests.swift | 24 +++++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift b/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift index c1cb111b100..7326c1d8f3a 100644 --- a/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift +++ b/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift @@ -122,7 +122,7 @@ public let KEYWORDS: [KeywordSpec] = [ KeywordSpec("do", isLexerClassified: true), KeywordSpec("dynamic"), KeywordSpec("each"), - KeywordSpec("else", isLexerClassified: true, requiresTrailingSpace: true), + KeywordSpec("else", isLexerClassified: true, requiresLeadingSpace: true, requiresTrailingSpace: true), KeywordSpec("enum", isLexerClassified: true, requiresTrailingSpace: true), KeywordSpec("escaping"), KeywordSpec("exclusivity"), diff --git a/Sources/SwiftBasicFormat/generated/BasicFormat.swift b/Sources/SwiftBasicFormat/generated/BasicFormat.swift index ea095d499bc..21958a7f635 100644 --- a/Sources/SwiftBasicFormat/generated/BasicFormat.swift +++ b/Sources/SwiftBasicFormat/generated/BasicFormat.swift @@ -198,6 +198,8 @@ open class BasicFormat: SyntaxRewriter { return true case .keyword(.`catch`): return true + case .keyword(.`else`): + return true case .keyword(.`in`): return true case .keyword(.`where`): diff --git a/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift b/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift index 4b4f20bd27a..802a37b88c3 100644 --- a/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/IfStmtTests.swift @@ -45,6 +45,26 @@ final class IfStmtTests: XCTestCase { } """ ), + #line: ( + ExprSyntax( + """ + if foo == x { + return foo + } + else { + return bar + } + """ + ).cast(IfExprSyntax.self), + """ + if foo == x { + return foo + } + else { + return bar + } + """ + ), #line: ( try IfExprSyntax("if foo == x") { StmtSyntax("return foo") }, """ @@ -62,7 +82,7 @@ final class IfStmtTests: XCTestCase { """ if foo == x { return foo - }else { + } else { return bar } """ @@ -72,7 +92,7 @@ final class IfStmtTests: XCTestCase { """ if foo == x { return foo - }else if foo == z { + } else if foo == z { return baz } """ From f430866f183f2bddaaae253fa943a99ec25a6fc3 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 13 Apr 2023 11:01:13 -0700 Subject: [PATCH 08/22] Merge pull request #1527 from ahoppen/ahoppen/documentation-for-initializer Add documentation for `InitializerDeclSyntax` and all its children --- .../Sources/SyntaxSupport/DeclNodes.swift | 22 +++++++++++++++++-- .../swiftsyntax/SyntaxNodeFile.swift | 2 +- .../BuildableNodesFile.swift | 4 ++-- .../syntaxNodes/SyntaxDeclNodes.swift | 17 +++++++++++++- .../generated/BuildableNodes.swift | 8 +++++++ 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift index 6553aa9b36c..0485af31e50 100644 --- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift @@ -1024,6 +1024,16 @@ public let DECL_NODES: [Node] = [ Node( name: "InitializerDecl", nameForDiagnostics: "initializer", + description: """ + An initializer declaration like the following. + + ```swift + init(someParameter: Int) { + } + ``` + + The body is optional because this node also represents initializer requirements inside protocols. + """, kind: "Decl", traits: [ "Attributed" @@ -1033,43 +1043,51 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: "AttributeList", collectionElementName: "Attribute"), nameForDiagnostics: "attributes", + description: "Attributes that are attached to the initializer.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: "ModifierList", collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", + description: "Modifiers attached to the initializer", isOptional: true ), Child( name: "InitKeyword", - kind: .token(choices: [.keyword(text: "init")]) + kind: .token(choices: [.keyword(text: "init")]), + description: "The init keyword" ), Child( name: "OptionalMark", kind: .token(choices: [.token(tokenKind: "PostfixQuestionMarkToken"), .token(tokenKind: "InfixQuestionMarkToken"), .token(tokenKind: "ExclamationMarkToken")]), + description: "If the initializer is failable, a question mark to indicate that.", isOptional: true ), Child( name: "GenericParameterClause", kind: .node(kind: "GenericParameterClause"), nameForDiagnostics: "generic parameter clause", + description: "Generic parameters of the initializer.", isOptional: true ), Child( name: "Signature", kind: .node(kind: "FunctionSignature"), - nameForDiagnostics: "function signature" + nameForDiagnostics: "function signature", + description: "The arguments of the initializer. While the function signature allows specifying an return clause, doing so is not semantically valid." ), Child( name: "GenericWhereClause", kind: .node(kind: "GenericWhereClause"), nameForDiagnostics: "generic where clause", + description: "If the initializer had generic parameters, a where clause that can restrict those", isOptional: true ), Child( name: "Body", kind: .node(kind: "CodeBlock"), + description: "The initializer’s body. Missing if the initialier is a requirement of a protocol declaration.", isOptional: true ), ] diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift index c0f00930116..7c2685b664d 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift @@ -23,7 +23,7 @@ func syntaxNode(emitKind: String) -> SourceFileSyntax { SourceFileSyntax(leadingTrivia: copyrightHeader) { for node in SYNTAX_NODES where !node.isBase && node.collectionElement.isEmpty && node.baseKind == emitKind { // We are actually handling this node now - let nodeDoc = node.description.map { "/// \($0)" } + let nodeDoc = node.description?.split(separator: "\n", omittingEmptySubsequences: false).map { "/// \($0)" }.joined(separator: "\n") try! StructDeclSyntax( """ // MARK: - \(raw: node.name) diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift index bcfddab0254..81733bc77ed 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift @@ -22,9 +22,9 @@ let buildableNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { let type = node.type if let convenienceInit = try! createConvenienceInitializer(node: node) { - let docComment: SwiftSyntax.Trivia = node.documentation.isEmpty ? [] : .docLineComment("/// \(node.documentation)") + .newline + let docComment = node.description?.split(separator: "\n", omittingEmptySubsequences: false).map { "/// \($0)" }.joined(separator: "\n") ?? "" ExtensionDeclSyntax( - leadingTrivia: docComment, + leadingTrivia: "\(docComment)\n", extendedType: SimpleTypeIdentifierSyntax(name: .identifier(type.syntaxBaseName)) ) { convenienceInit diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift index 23740f3e3f4..990bc03400c 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift @@ -3187,7 +3187,14 @@ extension ImportDeclSyntax: CustomReflectable { // MARK: - InitializerDeclSyntax - +/// An initializer declaration like the following. +/// +/// ```swift +/// init(someParameter: Int) { +/// } +/// ``` +/// +/// The body is optional because this node also represents initializer requirements inside protocols. public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public let _syntaxNode: Syntax @@ -3289,6 +3296,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// Attributes that are attached to the initializer. public var attributes: AttributeListSyntax? { get { return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) @@ -3326,6 +3334,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// Modifiers attached to the initializer public var modifiers: ModifierListSyntax? { get { return data.child(at: 3, parent: Syntax(self)).map(ModifierListSyntax.init) @@ -3363,6 +3372,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// The init keyword public var initKeyword: TokenSyntax { get { return TokenSyntax(data.child(at: 5, parent: Syntax(self))!) @@ -3381,6 +3391,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// If the initializer is failable, a question mark to indicate that. public var optionalMark: TokenSyntax? { get { return data.child(at: 7, parent: Syntax(self)).map(TokenSyntax.init) @@ -3399,6 +3410,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// Generic parameters of the initializer. public var genericParameterClause: GenericParameterClauseSyntax? { get { return data.child(at: 9, parent: Syntax(self)).map(GenericParameterClauseSyntax.init) @@ -3417,6 +3429,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// The arguments of the initializer. While the function signature allows specifying an return clause, doing so is not semantically valid. public var signature: FunctionSignatureSyntax { get { return FunctionSignatureSyntax(data.child(at: 11, parent: Syntax(self))!) @@ -3435,6 +3448,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// If the initializer had generic parameters, a where clause that can restrict those public var genericWhereClause: GenericWhereClauseSyntax? { get { return data.child(at: 13, parent: Syntax(self)).map(GenericWhereClauseSyntax.init) @@ -3453,6 +3467,7 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } + /// The initializer’s body. Missing if the initialier is a requirement of a protocol declaration. public var body: CodeBlockSyntax? { get { return data.child(at: 15, parent: Syntax(self)).map(CodeBlockSyntax.init) diff --git a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift index 1f01971df8d..b2728911278 100644 --- a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift +++ b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift @@ -819,6 +819,14 @@ extension IfExprSyntax { } } +/// An initializer declaration like the following. +/// +/// ```swift +/// init(someParameter: Int) { +/// } +/// ``` +/// +/// The body is optional because this node also represents initializer requirements inside protocols. extension InitializerDeclSyntax { /// A convenience initializer that allows initializing syntax collections using result builders public init( From a663fbb8942023e2536611b340da7293811d1ee1 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 13 Apr 2023 11:01:36 -0700 Subject: [PATCH 09/22] Merge pull request #1517 from stevapple/fix-for-in Address default parameter regressions and add tests for `ForInStmtSyntax` --- .../Sources/SyntaxSupport/KeywordSpec.swift | 2 +- .../Sources/SyntaxSupport/StmtNodes.swift | 7 +- .../Sources/Utils/SyntaxBuildableChild.swift | 41 +++++---- .../Sources/Utils/SyntaxBuildableNode.swift | 2 +- .../Sources/Utils/SyntaxBuildableType.swift | 7 +- .../swiftsyntax/RawSyntaxNodesFile.swift | 2 +- .../swiftsyntax/SyntaxNodeFile.swift | 54 ------------ .../BuildableNodesFile.swift | 2 +- .../generated/SyntaxClassification.swift | 2 - .../generated/BasicFormat.swift | 2 + Sources/SwiftParser/Statements.swift | 1 - .../generated/raw/RawSyntaxValidation.swift | 4 +- .../syntaxNodes/SyntaxDeclNodes.swift | 22 ++--- .../syntaxNodes/SyntaxExprNodes.swift | 14 ++-- .../generated/syntaxNodes/SyntaxNodes.swift | 30 +++---- .../syntaxNodes/SyntaxStmtNodes.swift | 2 +- .../generated/BuildableNodes.swift | 2 +- .../ForInStmtTests.swift | 84 +++++++++++++++++++ 18 files changed, 160 insertions(+), 120 deletions(-) create mode 100644 Tests/SwiftSyntaxBuilderTest/ForInStmtTests.swift diff --git a/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift b/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift index 7326c1d8f3a..28a715a4a9f 100644 --- a/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift +++ b/CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift @@ -96,7 +96,7 @@ public let KEYWORDS: [KeywordSpec] = [ KeywordSpec("autoclosure"), KeywordSpec("availability"), KeywordSpec("available"), - KeywordSpec("await"), + KeywordSpec("await", requiresTrailingSpace: true), KeywordSpec("backDeployed"), KeywordSpec("before"), KeywordSpec("block"), diff --git a/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift b/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift index 9cbc278e8e5..fd745ea4a3a 100644 --- a/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift @@ -290,18 +290,17 @@ public let STMT_NODES: [Node] = [ ), Child( name: "TryKeyword", - kind: .node(kind: "TryToken"), + kind: .token(choices: [.keyword(text: "try")]), isOptional: true ), Child( name: "AwaitKeyword", kind: .token(choices: [.keyword(text: "await")]), - isOptional: true, - classification: "Keyword" + isOptional: true ), Child( name: "CaseKeyword", - kind: .node(kind: "CaseToken"), + kind: .token(choices: [.keyword(text: "case")]), isOptional: true ), Child( diff --git a/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift b/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift index 07b3260183b..c6c98ca75ef 100644 --- a/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift +++ b/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift @@ -45,21 +45,34 @@ public extension Child { flattened(indentedDocumentation: description ?? "") } - var defaultInitialization: ExprSyntax? { - switch kind { - case .token(choices: let choices, requiresLeadingSpace: _, requiresTrailingSpace: _): - if choices.count == 1, case .keyword(text: let text) = choices.first { - var textChoice = text - if textChoice == "init" { - textChoice = "`init`" - } - return ExprSyntax(".keyword(.\(raw: textChoice))") - } else { - return type.defaultInitialization - } - default: - return type.defaultInitialization + /// If the child node has a default value, return an expression of the form + /// ` = default_value` that can be used as the default value to for a + /// function parameter. Otherwise, return `nil`. + var defaultInitialization: InitializerClauseSyntax? { + if isOptional || isUnexpectedNodes { + return InitializerClauseSyntax(value: NilLiteralExprSyntax()) + } + guard let token = token, isToken else { + return type.defaultValue.map { InitializerClauseSyntax(value: $0) } + } + if token.isKeyword { + return InitializerClauseSyntax(value: ExprSyntax(".\(raw: token.swiftKind)()")) + } + if token.text != nil { + return InitializerClauseSyntax(value: ExprSyntax(".\(raw: token.swiftKind)Token()")) + } + guard case .token(let choices, _, _) = kind, choices.count == 1, token.associatedValueClass != nil else { + return nil + } + var textChoice: String + switch choices[0] { + case .keyword(let text), .token(let text): + textChoice = text + } + if textChoice == "init" { + textChoice = "`init`" } + return InitializerClauseSyntax(value: ExprSyntax(".\(raw: token.swiftKind)(.\(raw: textChoice))")) } /// If this node is a token that can't contain arbitrary text, generate a Swift diff --git a/CodeGeneration/Sources/Utils/SyntaxBuildableNode.swift b/CodeGeneration/Sources/Utils/SyntaxBuildableNode.swift index de92776e701..6f80ec6d1ff 100644 --- a/CodeGeneration/Sources/Utils/SyntaxBuildableNode.swift +++ b/CodeGeneration/Sources/Utils/SyntaxBuildableNode.swift @@ -50,7 +50,7 @@ public extension Node { /// Assuming this node has a single child without a default value, that child. var singleNonDefaultedChild: Child { - let nonDefaultedParams = children.filter { $0.type.defaultInitialization == nil } + let nonDefaultedParams = children.filter { $0.defaultInitialization == nil } precondition(nonDefaultedParams.count == 1) return nonDefaultedParams[0] } diff --git a/CodeGeneration/Sources/Utils/SyntaxBuildableType.swift b/CodeGeneration/Sources/Utils/SyntaxBuildableType.swift index 7f6bb10f3b5..83fb56f2149 100644 --- a/CodeGeneration/Sources/Utils/SyntaxBuildableType.swift +++ b/CodeGeneration/Sources/Utils/SyntaxBuildableType.swift @@ -50,10 +50,9 @@ public struct SyntaxBuildableType: Hashable { } /// If the type has a default value (because it is optional or a token - /// with fixed test), return an expression of the form ` = defaultValue` - /// that can be used as the default value for a function parameter. - /// Otherwise, return the empty string. - public var defaultInitialization: ExprSyntax? { + /// with fixed test), return an expression that can be used as the + /// default value for a function parameter. Otherwise, return `nil`. + public var defaultValue: ExprSyntax? { if isOptional { return ExprSyntax(NilLiteralExprSyntax()) } else if let token = token { diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxNodesFile.swift index e98d5280a54..1039fd01630 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxNodesFile.swift @@ -197,7 +197,7 @@ let rawSyntaxNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { secondName: .identifier(child.swiftName), colon: .colonToken(), type: child.rawParameterType, - defaultArgument: child.isUnexpectedNodes ? child.defaultInitialization.map { InitializerClauseSyntax(value: $0) } : nil + defaultArgument: child.isUnexpectedNodes ? child.defaultInitialization : nil ) } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift index 7c2685b664d..3e92f938f98 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift @@ -438,57 +438,3 @@ fileprivate extension Node { } } } - -fileprivate extension Child { - /// If the type has a default value, return an expression of the form - /// ` = default_value` that can be used as the default value to for a - /// function parameter. Otherwise, return an empty string. - var defaultInitialization: InitializerClauseSyntax? { - // Note that this should be Optional.none for defaulted generic, - // but that doesn't work in Swift 5.6. To keep source compatibility with - // previous SwiftSyntax, we instead create a second initializer that uses - // `Missing` and defaults that to `nil` instead (and `Missing` is - // used so that they can't be implicitly converted from a literal). - - if isOptional || isUnexpectedNodes { - return InitializerClauseSyntax(value: NilLiteralExprSyntax()) - } - - guard let token = token, isToken else { - return nil - } - - if token.isKeyword { - return InitializerClauseSyntax(value: ExprSyntax(".\(raw: token.swiftKind)()")) - } - - if token.text != nil { - return InitializerClauseSyntax(value: ExprSyntax(".\(raw: token.swiftKind)Token()")) - } - - guard case .token(let choices, _, _) = kind else { - return nil - } - - guard choices.count == 1 else { - return nil - } - - var textChoice: String - - switch choices[0] { - case .keyword(let text), - .token(let text): - textChoice = text - } - - if token.associatedValueClass != nil { - if textChoice == "init" { - textChoice = "`init`" - } - return InitializerClauseSyntax(value: ExprSyntax(".\(raw: token.swiftKind)(.\(raw: textChoice))")) - } else { - return InitializerClauseSyntax(value: ExprSyntax(#".\#(raw: token.swiftKind)("\#(raw: textChoice)")"#)) - } - } -} diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift index 81733bc77ed..fd155fa7f65 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift @@ -83,7 +83,7 @@ private func createConvenienceInitializer(node: Node) throws -> InitializerDeclS firstName: .identifier(child.swiftName), colon: .colonToken(), type: child.parameterType, - defaultArgument: child.defaultInitialization.map { InitializerClauseSyntax(value: $0) } + defaultArgument: child.defaultInitialization ) ) } diff --git a/Sources/IDEUtils/generated/SyntaxClassification.swift b/Sources/IDEUtils/generated/SyntaxClassification.swift index 0a5076ebdba..12db3b80da2 100644 --- a/Sources/IDEUtils/generated/SyntaxClassification.swift +++ b/Sources/IDEUtils/generated/SyntaxClassification.swift @@ -79,8 +79,6 @@ extension SyntaxClassification { return (.stringInterpolationAnchor, true) case \ExpressionSegmentSyntax.rightParen: return (.stringInterpolationAnchor, true) - case \ForInStmtSyntax.awaitKeyword: - return (.keyword, false) case \IfConfigClauseSyntax.poundKeyword: return (.buildConfigId, false) case \IfConfigClauseSyntax.condition: diff --git a/Sources/SwiftBasicFormat/generated/BasicFormat.swift b/Sources/SwiftBasicFormat/generated/BasicFormat.swift index 21958a7f635..44a5ad660da 100644 --- a/Sources/SwiftBasicFormat/generated/BasicFormat.swift +++ b/Sources/SwiftBasicFormat/generated/BasicFormat.swift @@ -285,6 +285,8 @@ open class BasicFormat: SyntaxRewriter { return true case .keyword(.async): return true + case .keyword(.await): + return true case .keyword(.`break`): return true case .keyword(.`case`): diff --git a/Sources/SwiftParser/Statements.swift b/Sources/SwiftParser/Statements.swift index c1743dc600d..102c6015267 100644 --- a/Sources/SwiftParser/Statements.swift +++ b/Sources/SwiftParser/Statements.swift @@ -614,7 +614,6 @@ extension Parser { public mutating func parseForEachStatement(forHandle: RecoveryConsumptionHandle) -> RawForInStmtSyntax { let (unexpectedBeforeForKeyword, forKeyword) = self.eat(forHandle) let tryKeyword = self.consume(if: .keyword(.try)) - let awaitKeyword = self.consume(if: .keyword(.await)) // Parse the pattern. This is either 'case ' or just a diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index 2bbc219d2ac..b30781dc9a2 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -1200,11 +1200,11 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax.self, tokenChoices: [.keyword("for")])) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax?.self, tokenChoices: [.keyword("try")])) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax?.self, tokenChoices: [.keyword("await")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 7, verify(layout[7], as: RawTokenSyntax?.self)) + assertNoError(kind, 7, verify(layout[7], as: RawTokenSyntax?.self, tokenChoices: [.keyword("case")])) assertNoError(kind, 8, verify(layout[8], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 9, verify(layout[9], as: RawPatternSyntax.self)) assertNoError(kind, 10, verify(layout[10], as: RawUnexpectedNodesSyntax?.self)) diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift index 990bc03400c..c78a4602b48 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift @@ -300,7 +300,7 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndActorKeyword: UnexpectedNodesSyntax? = nil, actorKeyword: TokenSyntax = .keyword(.actor), _ unexpectedBetweenActorKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndGenericParameterClause: UnexpectedNodesSyntax? = nil, genericParameterClause: GenericParameterClauseSyntax? = nil, _ unexpectedBetweenGenericParameterClauseAndInheritanceClause: UnexpectedNodesSyntax? = nil, @@ -633,7 +633,7 @@ public struct AssociatedtypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndAssociatedtypeKeyword: UnexpectedNodesSyntax? = nil, associatedtypeKeyword: TokenSyntax = .keyword(.associatedtype), _ unexpectedBetweenAssociatedtypeKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndInheritanceClause: UnexpectedNodesSyntax? = nil, inheritanceClause: TypeInheritanceClauseSyntax? = nil, _ unexpectedBetweenInheritanceClauseAndInitializer: UnexpectedNodesSyntax? = nil, @@ -938,7 +938,7 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndClassKeyword: UnexpectedNodesSyntax? = nil, classKeyword: TokenSyntax = .keyword(.class), _ unexpectedBetweenClassKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndGenericParameterClause: UnexpectedNodesSyntax? = nil, genericParameterClause: GenericParameterClauseSyntax? = nil, _ unexpectedBetweenGenericParameterClauseAndInheritanceClause: UnexpectedNodesSyntax? = nil, @@ -1486,7 +1486,7 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedAfterIdentifier: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -1822,7 +1822,7 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndEnumKeyword: UnexpectedNodesSyntax? = nil, enumKeyword: TokenSyntax = .keyword(.enum), _ unexpectedBetweenEnumKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndGenericParameters: UnexpectedNodesSyntax? = nil, genericParameters: GenericParameterClauseSyntax? = nil, _ unexpectedBetweenGenericParametersAndInheritanceClause: UnexpectedNodesSyntax? = nil, @@ -3563,7 +3563,7 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndMacroKeyword: UnexpectedNodesSyntax? = nil, macroKeyword: TokenSyntax = .keyword(.macro), _ unexpectedBetweenMacroKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndGenericParameterClause: UnexpectedNodesSyntax? = nil, genericParameterClause: GenericParameterClauseSyntax? = nil, _ unexpectedBetweenGenericParameterClauseAndSignature: UnexpectedNodesSyntax? = nil, @@ -3892,7 +3892,7 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBeforePoundToken: UnexpectedNodesSyntax? = nil, poundToken: TokenSyntax = .poundToken(), _ unexpectedBetweenPoundTokenAndMacro: UnexpectedNodesSyntax? = nil, - macro: TokenSyntax = .identifier("IdentifierToken"), + macro: TokenSyntax, _ unexpectedBetweenMacroAndGenericArguments: UnexpectedNodesSyntax? = nil, genericArguments: GenericArgumentClauseSyntax? = nil, _ unexpectedBetweenGenericArgumentsAndLeftParen: UnexpectedNodesSyntax? = nil, @@ -4830,7 +4830,7 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndPrecedencegroupKeyword: UnexpectedNodesSyntax? = nil, precedencegroupKeyword: TokenSyntax = .keyword(.precedencegroup), _ unexpectedBetweenPrecedencegroupKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndLeftBrace: UnexpectedNodesSyntax? = nil, leftBrace: TokenSyntax = .leftBraceToken(), _ unexpectedBetweenLeftBraceAndGroupAttributes: UnexpectedNodesSyntax? = nil, @@ -5158,7 +5158,7 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndProtocolKeyword: UnexpectedNodesSyntax? = nil, protocolKeyword: TokenSyntax = .keyword(.protocol), _ unexpectedBetweenProtocolKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndPrimaryAssociatedTypeClause: UnexpectedNodesSyntax? = nil, primaryAssociatedTypeClause: PrimaryAssociatedTypeClauseSyntax? = nil, _ unexpectedBetweenPrimaryAssociatedTypeClauseAndInheritanceClause: UnexpectedNodesSyntax? = nil, @@ -5491,7 +5491,7 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndStructKeyword: UnexpectedNodesSyntax? = nil, structKeyword: TokenSyntax = .keyword(.struct), _ unexpectedBetweenStructKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndGenericParameterClause: UnexpectedNodesSyntax? = nil, genericParameterClause: GenericParameterClauseSyntax? = nil, _ unexpectedBetweenGenericParameterClauseAndInheritanceClause: UnexpectedNodesSyntax? = nil, @@ -6199,7 +6199,7 @@ public struct TypealiasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenModifiersAndTypealiasKeyword: UnexpectedNodesSyntax? = nil, typealiasKeyword: TokenSyntax = .keyword(.typealias), _ unexpectedBetweenTypealiasKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndGenericParameterClause: UnexpectedNodesSyntax? = nil, genericParameterClause: GenericParameterClauseSyntax? = nil, _ unexpectedBetweenGenericParameterClauseAndInitializer: UnexpectedNodesSyntax? = nil, diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift index 6a062c3adf3..8707e257ac9 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift @@ -733,7 +733,7 @@ public struct BinaryOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeOperatorToken: UnexpectedNodesSyntax? = nil, - operatorToken: TokenSyntax = .binaryOperator("BinaryOperatorToken"), + operatorToken: TokenSyntax, _ unexpectedAfterOperatorToken: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -1517,7 +1517,7 @@ public struct EditorPlaceholderExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedAfterIdentifier: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -1603,7 +1603,7 @@ public struct FloatLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeFloatingDigits: UnexpectedNodesSyntax? = nil, - floatingDigits: TokenSyntax = .floatingLiteral("FloatingLiteralToken"), + floatingDigits: TokenSyntax, _ unexpectedAfterFloatingDigits: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -2774,7 +2774,7 @@ public struct IntegerLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeDigits: UnexpectedNodesSyntax? = nil, - digits: TokenSyntax = .integerLiteral("IntegerLiteralToken"), + digits: TokenSyntax, _ unexpectedAfterDigits: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -3226,7 +3226,7 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { _ unexpectedBeforePoundToken: UnexpectedNodesSyntax? = nil, poundToken: TokenSyntax = .poundToken(), _ unexpectedBetweenPoundTokenAndMacro: UnexpectedNodesSyntax? = nil, - macro: TokenSyntax = .identifier("IdentifierToken"), + macro: TokenSyntax, _ unexpectedBetweenMacroAndGenericArguments: UnexpectedNodesSyntax? = nil, genericArguments: GenericArgumentClauseSyntax? = nil, _ unexpectedBetweenGenericArgumentsAndLeftParen: UnexpectedNodesSyntax? = nil, @@ -4597,7 +4597,7 @@ public struct PostfixUnaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { _ unexpectedBeforeExpression: UnexpectedNodesSyntax? = nil, expression: E, _ unexpectedBetweenExpressionAndOperatorToken: UnexpectedNodesSyntax? = nil, - operatorToken: TokenSyntax = .postfixOperator("PostfixOperatorToken"), + operatorToken: TokenSyntax, _ unexpectedAfterOperatorToken: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -4853,7 +4853,7 @@ public struct RegexLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenOpeningPoundsAndOpenSlash: UnexpectedNodesSyntax? = nil, openSlash: TokenSyntax = .regexSlashToken(), _ unexpectedBetweenOpenSlashAndRegexPattern: UnexpectedNodesSyntax? = nil, - regexPattern: TokenSyntax = .regexLiteralPattern("RegexLiteralPatternToken"), + regexPattern: TokenSyntax, _ unexpectedBetweenRegexPatternAndCloseSlash: UnexpectedNodesSyntax? = nil, closeSlash: TokenSyntax = .regexSlashToken(), _ unexpectedBetweenCloseSlashAndClosingPounds: UnexpectedNodesSyntax? = nil, diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift index 45c3ca16e7a..8ec3ea2c71a 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift @@ -466,7 +466,7 @@ public struct AccessorParameterSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBeforeLeftParen: UnexpectedNodesSyntax? = nil, leftParen: TokenSyntax = .leftParenToken(), _ unexpectedBetweenLeftParenAndName: UnexpectedNodesSyntax? = nil, - name: TokenSyntax = .identifier("IdentifierToken"), + name: TokenSyntax, _ unexpectedBetweenNameAndRightParen: UnexpectedNodesSyntax? = nil, rightParen: TokenSyntax = .rightParenToken(), _ unexpectedAfterRightParen: UnexpectedNodesSyntax? = nil, @@ -2139,7 +2139,7 @@ public struct AvailabilityVersionRestrictionSyntax: SyntaxProtocol, SyntaxHashab public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforePlatform: UnexpectedNodesSyntax? = nil, - platform: TokenSyntax = .identifier("IdentifierToken"), + platform: TokenSyntax, _ unexpectedBetweenPlatformAndVersion: UnexpectedNodesSyntax? = nil, version: VersionTupleSyntax? = nil, _ unexpectedAfterVersion: UnexpectedNodesSyntax? = nil, @@ -5363,7 +5363,7 @@ public struct ConventionAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeConventionLabel: UnexpectedNodesSyntax? = nil, - conventionLabel: TokenSyntax = .identifier("IdentifierToken"), + conventionLabel: TokenSyntax, _ unexpectedBetweenConventionLabelAndComma: UnexpectedNodesSyntax? = nil, comma: TokenSyntax? = nil, _ unexpectedBetweenCommaAndCTypeLabel: UnexpectedNodesSyntax? = nil, @@ -5579,7 +5579,7 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S _ unexpectedBetweenWitnessMethodLabelAndColon: UnexpectedNodesSyntax? = nil, colon: TokenSyntax = .colonToken(), _ unexpectedBetweenColonAndProtocolName: UnexpectedNodesSyntax? = nil, - protocolName: TokenSyntax = .identifier("IdentifierToken"), + protocolName: TokenSyntax, _ unexpectedAfterProtocolName: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -8119,7 +8119,7 @@ public struct EnumCaseElementSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeIdentifier: UnexpectedNodesSyntax? = nil, - identifier: TokenSyntax = .identifier("IdentifierToken"), + identifier: TokenSyntax, _ unexpectedBetweenIdentifierAndAssociatedValue: UnexpectedNodesSyntax? = nil, associatedValue: EnumCaseParameterClauseSyntax? = nil, _ unexpectedBetweenAssociatedValueAndRawValue: UnexpectedNodesSyntax? = nil, @@ -10308,7 +10308,7 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBetweenAttributesAndEach: UnexpectedNodesSyntax? = nil, each: TokenSyntax? = nil, _ unexpectedBetweenEachAndName: UnexpectedNodesSyntax? = nil, - name: TokenSyntax = .identifier("IdentifierToken"), + name: TokenSyntax, _ unexpectedBetweenNameAndColon: UnexpectedNodesSyntax? = nil, colon: TokenSyntax? = nil, _ unexpectedBetweenColonAndInheritedType: UnexpectedNodesSyntax? = nil, @@ -10380,7 +10380,7 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBetweenAttributesAndEach: UnexpectedNodesSyntax? = nil, each: TokenSyntax? = nil, _ unexpectedBetweenEachAndName: UnexpectedNodesSyntax? = nil, - name: TokenSyntax = .identifier("IdentifierToken"), + name: TokenSyntax, _ unexpectedBetweenNameAndColon: UnexpectedNodesSyntax? = nil, colon: TokenSyntax? = nil, _ unexpectedBetweenColonAndInheritedType: UnexpectedNodesSyntax? = nil, @@ -13559,7 +13559,7 @@ public struct OpaqueReturnTypeOfAttributeArgumentsSyntax: SyntaxProtocol, Syntax _ unexpectedBetweenMangledNameAndComma: UnexpectedNodesSyntax? = nil, comma: TokenSyntax = .commaToken(), _ unexpectedBetweenCommaAndOrdinal: UnexpectedNodesSyntax? = nil, - ordinal: TokenSyntax = .integerLiteral("IntegerLiteralToken"), + ordinal: TokenSyntax, _ unexpectedAfterOrdinal: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -13714,7 +13714,7 @@ public struct OperatorPrecedenceAndTypesSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBeforeColon: UnexpectedNodesSyntax? = nil, colon: TokenSyntax = .colonToken(), _ unexpectedBetweenColonAndPrecedenceGroup: UnexpectedNodesSyntax? = nil, - precedenceGroup: TokenSyntax = .identifier("IdentifierToken"), + precedenceGroup: TokenSyntax, _ unexpectedBetweenPrecedenceGroupAndDesignatedTypes: UnexpectedNodesSyntax? = nil, designatedTypes: DesignatedTypeListSyntax, _ unexpectedAfterDesignatedTypes: UnexpectedNodesSyntax? = nil, @@ -14740,7 +14740,7 @@ public struct PoundSourceLocationArgsSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBetweenLineArgLabelAndLineArgColon: UnexpectedNodesSyntax? = nil, lineArgColon: TokenSyntax = .colonToken(), _ unexpectedBetweenLineArgColonAndLineNumber: UnexpectedNodesSyntax? = nil, - lineNumber: TokenSyntax = .integerLiteral("IntegerLiteralToken"), + lineNumber: TokenSyntax, _ unexpectedAfterLineNumber: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -15307,7 +15307,7 @@ public struct PrecedenceGroupNameElementSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeName: UnexpectedNodesSyntax? = nil, - name: TokenSyntax = .identifier("IdentifierToken"), + name: TokenSyntax, _ unexpectedBetweenNameAndTrailingComma: UnexpectedNodesSyntax? = nil, trailingComma: TokenSyntax? = nil, _ unexpectedAfterTrailingComma: UnexpectedNodesSyntax? = nil, @@ -15784,7 +15784,7 @@ public struct PrimaryAssociatedTypeSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeName: UnexpectedNodesSyntax? = nil, - name: TokenSyntax = .identifier("IdentifierToken"), + name: TokenSyntax, _ unexpectedBetweenNameAndTrailingComma: UnexpectedNodesSyntax? = nil, trailingComma: TokenSyntax? = nil, _ unexpectedAfterTrailingComma: UnexpectedNodesSyntax? = nil, @@ -16420,7 +16420,7 @@ public struct SourceFileSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBeforeStatements: UnexpectedNodesSyntax? = nil, statements: CodeBlockItemListSyntax, _ unexpectedBetweenStatementsAndEOFToken: UnexpectedNodesSyntax? = nil, - eofToken: TokenSyntax, + eofToken: TokenSyntax = .eof(), _ unexpectedAfterEOFToken: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -16564,7 +16564,7 @@ public struct StringSegmentSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeContent: UnexpectedNodesSyntax? = nil, - content: TokenSyntax = .stringSegment("StringSegmentToken"), + content: TokenSyntax, _ unexpectedAfterContent: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -18852,7 +18852,7 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeMajor: UnexpectedNodesSyntax? = nil, - major: TokenSyntax = .integerLiteral("IntegerLiteralToken"), + major: TokenSyntax, _ unexpectedBetweenMajorAndMinorPeriod: UnexpectedNodesSyntax? = nil, minorPeriod: TokenSyntax? = nil, _ unexpectedBetweenMinorPeriodAndMinor: UnexpectedNodesSyntax? = nil, diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift index ab7ca1abcaf..e1aac894b6b 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift @@ -1443,7 +1443,7 @@ public struct LabeledStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeLabelName: UnexpectedNodesSyntax? = nil, - labelName: TokenSyntax = .identifier("IdentifierToken"), + labelName: TokenSyntax, _ unexpectedBetweenLabelNameAndLabelColon: UnexpectedNodesSyntax? = nil, labelColon: TokenSyntax = .colonToken(), _ unexpectedBetweenLabelColonAndStatement: UnexpectedNodesSyntax? = nil, diff --git a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift index b2728911278..739585f2e1d 100644 --- a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift +++ b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift @@ -538,7 +538,7 @@ extension ForInStmtSyntax { unexpectedBetweenForKeywordAndTryKeyword: UnexpectedNodesSyntax? = nil, tryKeyword: TokenSyntax? = nil, unexpectedBetweenTryKeywordAndAwaitKeyword: UnexpectedNodesSyntax? = nil, - awaitKeyword: TokenSyntax? = .keyword(.await), + awaitKeyword: TokenSyntax? = nil, unexpectedBetweenAwaitKeywordAndCaseKeyword: UnexpectedNodesSyntax? = nil, caseKeyword: TokenSyntax? = nil, unexpectedBetweenCaseKeywordAndPattern: UnexpectedNodesSyntax? = nil, diff --git a/Tests/SwiftSyntaxBuilderTest/ForInStmtTests.swift b/Tests/SwiftSyntaxBuilderTest/ForInStmtTests.swift new file mode 100644 index 00000000000..bfce5852a98 --- /dev/null +++ b/Tests/SwiftSyntaxBuilderTest/ForInStmtTests.swift @@ -0,0 +1,84 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import XCTest +import SwiftSyntax +import SwiftSyntaxBuilder + +final class ForInStmtTests: XCTestCase { + func testEmptyForInStmtSyntax() throws { + let buildable = ForInStmtSyntax(pattern: PatternSyntax("foo"), sequenceExpr: ExprSyntax("bar")) {} + assertBuildResult( + buildable, + """ + for foo in bar { + } + """ + ) + } + + func testForInStmtSyntax() throws { + let testCases: [UInt: (ForInStmtSyntax, String)] = [ + #line: ( + StmtSyntax( + """ + for foo in bar { + _ = foo + } + """ + ).cast(ForInStmtSyntax.self), + """ + for foo in bar { + _ = foo + } + """ + ), + #line: ( + try ForInStmtSyntax("for try await foo in bar") { ExprSyntax("print(foo)") }, + """ + for try await foo in bar { + print(foo) + } + """ + ), + ] + + for (line, testCase) in testCases { + let (builder, expected) = testCase + assertBuildResult(builder, expected, line: line) + } + } + + func testEffectiveForInStmtSyntax() throws { + let buildable = ForInStmtSyntax( + tryKeyword: .keyword(.try), + awaitKeyword: .keyword(.await), + pattern: PatternSyntax("foo"), + sequenceExpr: ExprSyntax("bar"), + body: CodeBlockSyntax( + statements: [ + .init(item: .decl("let baz = await foo.baz")), + .init(item: .expr("print(foo.baz)")), + ] + ) + ) + assertBuildResult( + buildable, + """ + for try await foo in bar { + let baz = await foo.baz + print(foo.baz) + } + """ + ) + } +} From a01740623457f3779d778007cf6755315b025031 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 13 Apr 2023 15:40:43 -0700 Subject: [PATCH 10/22] Merge pull request #1466 from ahoppen/ahoppen/rawsyntaxvalidation Validate token choices in CI --- Package.swift | 11 ++++--- .../generated/raw/RawSyntaxValidation.swift | 10 +----- build-script.py | 33 ++++++++++++++++--- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/Package.swift b/Package.swift index f22a197767f..6d26c21167c 100644 --- a/Package.swift +++ b/Package.swift @@ -5,13 +5,13 @@ import Foundation /// If we are in a controlled CI environment, we can use internal compiler flags /// to speed up the build or improve it. -let swiftSyntaxSwiftSettings: [SwiftSetting] +var swiftSyntaxSwiftSettings: [SwiftSetting] = [] if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil { let groupFile = URL(fileURLWithPath: #file) .deletingLastPathComponent() .appendingPathComponent("utils") .appendingPathComponent("group.json") - swiftSyntaxSwiftSettings = [ + swiftSyntaxSwiftSettings += [ .define("SWIFTSYNTAX_ENABLE_ASSERTIONS"), .unsafeFlags([ "-Xfrontend", "-group-info-path", @@ -21,8 +21,11 @@ if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil "-enforce-exclusivity=unchecked", ]), ] -} else { - swiftSyntaxSwiftSettings = [] +} +if ProcessInfo.processInfo.environment["SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"] != nil { + swiftSyntaxSwiftSettings += [ + .define("SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION") + ] } let package = Package( diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index b30781dc9a2..8082771d628 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -17,7 +17,7 @@ /// Note that this only validates the immediate children. /// Results in an assertion failure if the layout is invalid. func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { - #if DEBUG + #if SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION enum TokenChoice: CustomStringConvertible { case keyword(StaticString) case tokenKind(RawTokenKind) @@ -140,7 +140,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. - #if VALIDATE_TOKEN_CHOICES if raw != nil { return verify( raw, @@ -151,9 +150,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { ) } return nil - #else - return verify(raw, as: RawTokenSyntax?.self) - #endif } func verify( _ raw: RawSyntax?, @@ -166,7 +162,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. - #if VALIDATE_TOKEN_CHOICES guard let raw = raw else { return .expectedNonNil(expectedKind: RawTokenSyntax.self, file: file, line: line) } @@ -193,9 +188,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { file: file, line: line ) - #else - return verify(raw, as: RawTokenSyntax.self) - #endif } func assertNoError(_ nodeKind: SyntaxKind, _ index: Int, _ error: ValidationError?) { if let error = error { diff --git a/build-script.py b/build-script.py index f4a742223c1..7e8daa5549d 100755 --- a/build-script.py +++ b/build-script.py @@ -6,7 +6,6 @@ import subprocess import sys import tempfile -from concurrent.futures import ThreadPoolExecutor from typing import Dict, List, Optional @@ -141,6 +140,7 @@ def run_code_generation( env = dict(os.environ) env["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] = "1" + env["SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"] = "1" check_call(swiftpm_call, env=env, verbose=verbose) @@ -174,6 +174,7 @@ class Builder(object): build_dir: Optional[str] multiroot_data_file: Optional[str] release: bool + enable_rawsyntax_validation: bool disable_sandbox: bool def __init__( @@ -182,12 +183,14 @@ def __init__( build_dir: Optional[str], multiroot_data_file: Optional[str], release: bool, + enable_rawsyntax_validation: bool, verbose: bool, disable_sandbox: bool = False, ) -> None: self.build_dir = build_dir self.multiroot_data_file = multiroot_data_file self.release = release + self.enable_rawsyntax_validation = enable_rawsyntax_validation self.disable_sandbox = disable_sandbox self.verbose = verbose self.toolchain = toolchain @@ -221,6 +224,8 @@ def __build(self, package_dir: str, product_name: str) -> None: env = dict(os.environ) env["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] = "1" + if self.enable_rawsyntax_validation: + env["SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"] = "1" # Tell other projects in the unified build to use local dependencies env["SWIFTCI_USE_LOCAL_DEPS"] = "1" env["SWIFT_SYNTAX_PARSER_LIB_SEARCH_PATH"] = \ @@ -274,7 +279,8 @@ def check_generated_files_match(self_generated_dir: str, def run_tests( toolchain: str, build_dir: Optional[str], multiroot_data_file: Optional[str], - release: bool, filecheck_exec: Optional[str], skip_lit_tests: bool, verbose: bool + release: bool, enable_rawsyntax_validation: bool, filecheck_exec: Optional[str], + skip_lit_tests: bool, verbose: bool ) -> None: print("** Running SwiftSyntax Tests **") @@ -292,6 +298,7 @@ def run_tests( build_dir=build_dir, multiroot_data_file=multiroot_data_file, release=release, + enable_rawsyntax_validation=enable_rawsyntax_validation, verbose=verbose, ) @@ -396,6 +403,7 @@ def run_lit_tests(toolchain: str, build_dir: Optional[str], release: bool, def run_xctests(toolchain: str, build_dir: Optional[str], multiroot_data_file: Optional[str], release: bool, + enable_rawsyntax_validation: bool, verbose: bool) -> None: print("** Running XCTests **") swiftpm_call = get_swiftpm_invocation( @@ -414,6 +422,8 @@ def run_xctests(toolchain: str, build_dir: Optional[str], env = dict(os.environ) env["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] = "1" + if enable_rawsyntax_validation: + env["SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"] = "1" # Tell other projects in the unified build to use local dependencies env["SWIFTCI_USE_LOCAL_DEPS"] = "1" env["SWIFT_SYNTAX_PARSER_LIB_SEARCH_PATH"] = \ @@ -461,10 +471,11 @@ def verify_source_code_command(args: argparse.Namespace) -> None: def build_command(args: argparse.Namespace) -> None: try: builder = Builder( - toolchain=realpath(args.toolchain), + toolchain=realpath(args.toolchain), # pyright: ignore build_dir=realpath(args.build_dir), multiroot_data_file=args.multiroot_data_file, release=args.release, + enable_rawsyntax_validation=args.enable_rawsyntax_validation, verbose=args.verbose, disable_sandbox=args.disable_sandbox, ) @@ -484,10 +495,11 @@ def build_command(args: argparse.Namespace) -> None: def test_command(args: argparse.Namespace) -> None: try: builder = Builder( - toolchain=realpath(args.toolchain), + toolchain=realpath(args.toolchain), # pyright: ignore build_dir=realpath(args.build_dir), multiroot_data_file=args.multiroot_data_file, release=args.release, + enable_rawsyntax_validation=args.enable_rawsyntax_validation, verbose=args.verbose, disable_sandbox=args.disable_sandbox, ) @@ -496,10 +508,11 @@ def test_command(args: argparse.Namespace) -> None: builder.buildExample("ExamplePlugin") run_tests( - toolchain=realpath(args.toolchain), + toolchain=realpath(args.toolchain), # pyright: ignore build_dir=realpath(args.build_dir), multiroot_data_file=args.multiroot_data_file, release=args.release, + enable_rawsyntax_validation=args.enable_rawsyntax_validation, filecheck_exec=realpath(args.filecheck_exec), skip_lit_tests=args.skip_lit_tests, verbose=args.verbose, @@ -552,6 +565,16 @@ def add_default_build_arguments(parser: argparse.ArgumentParser) -> None: """, ) + parser.add_argument( + "--enable-rawsyntax-validation", + action="store_true", + help=""" + When constructing RawSyntax nodes validate that their layout matches that + defined in `CodeGeneration` and that TokenSyntax nodes have a `tokenKind` + matching the ones specified in `CodeGeneration`. + """ + ) + parser.add_argument( "--toolchain", required=True, From deb6d663b62bdc388fa72d89debd9d3d64d3ce5f Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 13 Apr 2023 16:30:51 -0700 Subject: [PATCH 11/22] Merge pull request #1503 from ahoppen/ahoppen/better-debug-description Improve debug description of syntax nodes --- .../swiftsyntax/SyntaxBaseNodesFile.swift | 12 - .../swiftsyntax/SyntaxCollectionsFile.swift | 12 - .../swiftsyntax/SyntaxNodeFile.swift | 21 - Sources/SwiftSyntax/Syntax.swift | 69 +- .../generated/SyntaxBaseNodes.swift | 40 - .../generated/SyntaxCollections.swift | 376 ---- .../generated/raw/RawSyntaxValidation.swift | 10 +- .../syntaxNodes/SyntaxDeclNodes.swift | 481 ----- .../syntaxNodes/SyntaxExprNodes.swift | 618 ------- .../generated/syntaxNodes/SyntaxNodes.swift | 1579 ----------------- .../syntaxNodes/SyntaxPatternNodes.swift | 75 - .../syntaxNodes/SyntaxStmtNodes.swift | 211 --- .../syntaxNodes/SyntaxTypeNodes.swift | 217 --- .../Syntax+Assertions.swift | 2 +- .../SyntaxComparison.swift | 4 +- .../swift-parser-cli/swift-parser-cli.swift | 2 +- Tests/SwiftParserTest/Assertions.swift | 2 +- .../CustomReflectableTests.swift | 97 +- 18 files changed, 50 insertions(+), 3778 deletions(-) diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift index f441aa96fdc..23c820d2f5a 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift @@ -233,18 +233,6 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { StmtSyntax("return .choices(\(choices))") } } - - DeclSyntax( - """ - extension \(raw: node.name): CustomReflectable { - /// Reconstructs the real syntax type for this type from the node's kind and - /// provides a mirror that reflects this type. - public var customMirror: Mirror { - return Mirror(reflecting: Syntax(self).asProtocol(SyntaxProtocol.self)) - } - } - """ - ) } try! ExtensionDeclSyntax("extension Syntax") { diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift index 35308524513..601a9fc5bcb 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift @@ -418,16 +418,4 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { ) } } - - for node in SYNTAX_NODES where node.isSyntaxCollection { - DeclSyntax( - """ - extension \(raw: node.name): CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map{ $0 }) - } - } - """ - ) - } } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift index 3e92f938f98..d3927d654b7 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodeFile.swift @@ -259,27 +259,6 @@ func syntaxNode(emitKind: String) -> SourceFileSyntax { StmtSyntax("return .layout(\(layout))") } } - - try! ExtensionDeclSyntax("extension \(raw: node.name): CustomReflectable") { - let children = DictionaryExprSyntax { - for child in node.children { - DictionaryElementSyntax( - leadingTrivia: .newline, - keyExpression: ExprSyntax(#""\#(raw: child.swiftName)""#), - valueExpression: child.isOptional - ? ExprSyntax("\(raw: child.swiftName).map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any") - : ExprSyntax("Syntax(\(raw: child.swiftName)).asProtocol(SyntaxProtocol.self)") - ) - } - } - DeclSyntax( - """ - public var customMirror: Mirror { - return Mirror(self, children: \(children)) - } - """ - ) - } } } } diff --git a/Sources/SwiftSyntax/Syntax.swift b/Sources/SwiftSyntax/Syntax.swift index 7e4ce1deb06..d6ae1e4b9da 100644 --- a/Sources/SwiftSyntax/Syntax.swift +++ b/Sources/SwiftSyntax/Syntax.swift @@ -104,14 +104,6 @@ public struct Syntax: SyntaxProtocol, SyntaxHashable { } } -extension Syntax: CustomReflectable { - /// Reconstructs the real syntax type for this type from the node's kind and - /// provides a mirror that reflects this type. - public var customMirror: Mirror { - return Mirror(reflecting: self.asProtocol(SyntaxProtocol.self)) - } -} - extension Syntax: Identifiable { public typealias ID = SyntaxIdentifier } @@ -157,7 +149,7 @@ public extension SyntaxHashable { /// protocol to provide common functionality for all syntax nodes. /// DO NOT CONFORM TO THIS PROTOCOL YOURSELF! public protocol SyntaxProtocol: CustomStringConvertible, - CustomDebugStringConvertible, TextOutputStreamable + CustomDebugStringConvertible, TextOutputStreamable, CustomReflectable { /// Retrieve the generic syntax node that is represented by this node. @@ -565,14 +557,14 @@ public extension SyntaxProtocol { debugDescription() } - /// Same as `debugDescription` but includes all children. - var recursiveDescription: String { - debugDescription(includeChildren: true) + var customMirror: Mirror { + // Suppress printing of children when doing `po node` in the debugger. + // `debugDescription` already prints them in a nicer way. + return Mirror(self, children: [:]) } /// Returns a summarized dump of this node. /// - Parameters: - /// - includeChildren: Whether to also dump children, false by default. /// - includeTrivia: Add trivia to each dumped node, which the default /// dump skips. /// - converter: The location converter for the root of the tree. Adds @@ -582,31 +574,28 @@ public extension SyntaxProtocol { /// - indentLevel: The starting indent level, 0 by default. Each level is 2 /// spaces. func debugDescription( - includeChildren: Bool = false, includeTrivia: Bool = false, converter: SourceLocationConverter? = nil, mark: SyntaxProtocol? = nil, - indentLevel: Int = 0 + indentString: String = "" ) -> String { var str = "" debugWrite( to: &str, - includeChildren: includeChildren, includeTrivia: includeTrivia, converter: converter, mark: mark, - indentLevel: indentLevel + indentString: indentString ) return str } private func debugWrite( to target: inout Target, - includeChildren: Bool, includeTrivia: Bool, converter: SourceLocationConverter? = nil, mark: SyntaxProtocol? = nil, - indentLevel: Int + indentString: String ) { if let mark = mark, self.id == mark.id { target.write("*** ") @@ -627,11 +616,6 @@ public extension SyntaxProtocol { } let allChildren = children(viewMode: .all) - if includeChildren { - if !allChildren.isEmpty { - target.write(" children=\(allChildren.count)") - } - } if let converter = converter { let range = sourceRange(converter: converter) @@ -646,21 +630,19 @@ public extension SyntaxProtocol { target.write(" ***") } - if includeChildren { - let childIndentLevel = indentLevel + 1 - for (num, child) in allChildren.enumerated() { - target.write("\n") - target.write(String(repeating: " ", count: childIndentLevel * 2)) - target.write("\(num): ") - child.debugWrite( - to: &target, - includeChildren: includeChildren, - includeTrivia: includeTrivia, - converter: converter, - mark: mark, - indentLevel: childIndentLevel - ) - } + for (num, child) in allChildren.enumerated() { + let isLastChild = num == allChildren.count - 1 + target.write("\n") + target.write(indentString) + target.write(isLastChild ? "╰─" : "├─") + let childIndentString = indentString + (isLastChild ? " " : "│ ") + child.debugWrite( + to: &target, + includeTrivia: includeTrivia, + converter: converter, + mark: mark, + indentString: childIndentString + ) } } } @@ -763,14 +745,5 @@ extension ReversedTokenSequence: CustomReflectable { } } -/// Expose `recursiveDescription` on raw nodes for debugging purposes. -extension RawSyntaxNodeProtocol { - /// Print this raw syntax node including all of its children. - /// Intended for debugging purposes only. - var recursiveDescription: String { - return Syntax(raw: raw).recursiveDescription - } -} - @available(*, unavailable, message: "use 'Syntax' instead") public struct SyntaxNode {} diff --git a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift index 0da98428095..2f639be5907 100644 --- a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift +++ b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift @@ -149,14 +149,6 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension DeclSyntax: CustomReflectable { - /// Reconstructs the real syntax type for this type from the node's kind and - /// provides a mirror that reflects this type. - public var customMirror: Mirror { - return Mirror(reflecting: Syntax(self).asProtocol(SyntaxProtocol.self)) - } -} - // MARK: - ExprSyntax /// Protocol to which all `ExprSyntax` nodes conform. Extension point to add @@ -318,14 +310,6 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension ExprSyntax: CustomReflectable { - /// Reconstructs the real syntax type for this type from the node's kind and - /// provides a mirror that reflects this type. - public var customMirror: Mirror { - return Mirror(reflecting: Syntax(self).asProtocol(SyntaxProtocol.self)) - } -} - // MARK: - PatternSyntax /// Protocol to which all `PatternSyntax` nodes conform. Extension point to add @@ -446,14 +430,6 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } -extension PatternSyntax: CustomReflectable { - /// Reconstructs the real syntax type for this type from the node's kind and - /// provides a mirror that reflects this type. - public var customMirror: Mirror { - return Mirror(reflecting: Syntax(self).asProtocol(SyntaxProtocol.self)) - } -} - // MARK: - StmtSyntax /// Protocol to which all `StmtSyntax` nodes conform. Extension point to add @@ -583,14 +559,6 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension StmtSyntax: CustomReflectable { - /// Reconstructs the real syntax type for this type from the node's kind and - /// provides a mirror that reflects this type. - public var customMirror: Mirror { - return Mirror(reflecting: Syntax(self).asProtocol(SyntaxProtocol.self)) - } -} - // MARK: - TypeSyntax /// Protocol to which all `TypeSyntax` nodes conform. Extension point to add @@ -721,14 +689,6 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension TypeSyntax: CustomReflectable { - /// Reconstructs the real syntax type for this type from the node's kind and - /// provides a mirror that reflects this type. - public var customMirror: Mirror { - return Mirror(reflecting: Syntax(self).asProtocol(SyntaxProtocol.self)) - } -} - extension Syntax { public static var structure: SyntaxNodeStructure { return .choices([ diff --git a/Sources/SwiftSyntax/generated/SyntaxCollections.swift b/Sources/SwiftSyntax/generated/SyntaxCollections.swift index 715791e6a21..70db610e451 100644 --- a/Sources/SwiftSyntax/generated/SyntaxCollections.swift +++ b/Sources/SwiftSyntax/generated/SyntaxCollections.swift @@ -10128,379 +10128,3 @@ extension YieldExprListSyntax: BidirectionalCollection { return Element(data) } } - -extension AccessPathSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension AccessorListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ArrayElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension AttributeListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension AvailabilitySpecListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension AvailabilityVersionRestrictionListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension CaseItemListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension CatchClauseListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension CatchItemListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ClosureCaptureItemListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ClosureParamListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ClosureParameterListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension CodeBlockItemListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension CompositionTypeElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ConditionElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension DeclNameArgumentListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension DesignatedTypeListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension DictionaryElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension DifferentiabilityParamListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension DocumentationAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension EffectsArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension EnumCaseElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension EnumCaseParameterListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ExprListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension FunctionParameterListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension GenericArgumentListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension GenericParameterListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension GenericRequirementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension IfConfigClauseListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension InheritedTypeListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension KeyPathComponentListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension MemberDeclListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ModifierListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension MultipleTrailingClosureElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension ObjCSelectorSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension PatternBindingListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension PrecedenceGroupAttributeListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension PrecedenceGroupNameListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension PrimaryAssociatedTypeListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension SpecializeAttributeSpecListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension StringLiteralSegmentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension SwitchCaseListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension TupleExprElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension TuplePatternElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension TupleTypeElementListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension UnexpectedNodesSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} - -extension YieldExprListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, unlabeledChildren: self.map { - $0 - }) - } -} diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index 8082771d628..b30781dc9a2 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -17,7 +17,7 @@ /// Note that this only validates the immediate children. /// Results in an assertion failure if the layout is invalid. func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { - #if SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION + #if DEBUG enum TokenChoice: CustomStringConvertible { case keyword(StaticString) case tokenKind(RawTokenKind) @@ -140,6 +140,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. + #if VALIDATE_TOKEN_CHOICES if raw != nil { return verify( raw, @@ -150,6 +151,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { ) } return nil + #else + return verify(raw, as: RawTokenSyntax?.self) + #endif } func verify( _ raw: RawSyntax?, @@ -162,6 +166,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. + #if VALIDATE_TOKEN_CHOICES guard let raw = raw else { return .expectedNonNil(expectedKind: RawTokenSyntax.self, file: file, line: line) } @@ -188,6 +193,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { file: file, line: line ) + #else + return verify(raw, as: RawTokenSyntax.self) + #endif } func assertNoError(_ nodeKind: SyntaxKind, _ index: Int, _ error: ValidationError?) { if let error = error { diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift index c78a4602b48..5e1946664e0 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift @@ -250,26 +250,6 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension AccessorDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifier": unexpectedBetweenAttributesAndModifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifier": modifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifierAndAccessorKind": unexpectedBetweenModifierAndAccessorKind.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "accessorKind": Syntax(accessorKind).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAccessorKindAndParameter": unexpectedBetweenAccessorKindAndParameter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "parameter": parameter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenParameterAndEffectSpecifiers": unexpectedBetweenParameterAndEffectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "effectSpecifiers": effectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEffectSpecifiersAndBody": unexpectedBetweenEffectSpecifiersAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": body.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ActorDeclSyntax @@ -579,30 +559,6 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension ActorDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndActorKeyword": unexpectedBetweenModifiersAndActorKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "actorKeyword": Syntax(actorKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenActorKeywordAndIdentifier": unexpectedBetweenActorKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndGenericParameterClause": unexpectedBetweenIdentifierAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndInheritanceClause": unexpectedBetweenGenericParameterClauseAndInheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritanceClauseAndGenericWhereClause": unexpectedBetweenInheritanceClauseAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndMembers": unexpectedBetweenGenericWhereClauseAndMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "members": Syntax(members).asProtocol(SyntaxProtocol.self), - "unexpectedAfterMembers": unexpectedAfterMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AssociatedtypeDeclSyntax @@ -886,28 +842,6 @@ public struct AssociatedtypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension AssociatedtypeDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndAssociatedtypeKeyword": unexpectedBetweenModifiersAndAssociatedtypeKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "associatedtypeKeyword": Syntax(associatedtypeKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAssociatedtypeKeywordAndIdentifier": unexpectedBetweenAssociatedtypeKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndInheritanceClause": unexpectedBetweenIdentifierAndInheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritanceClauseAndInitializer": unexpectedBetweenInheritanceClauseAndInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "initializer": initializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInitializerAndGenericWhereClause": unexpectedBetweenInitializerAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterGenericWhereClause": unexpectedAfterGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClassDeclSyntax @@ -1217,30 +1151,6 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension ClassDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndClassKeyword": unexpectedBetweenModifiersAndClassKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "classKeyword": Syntax(classKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenClassKeywordAndIdentifier": unexpectedBetweenClassKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndGenericParameterClause": unexpectedBetweenIdentifierAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndInheritanceClause": unexpectedBetweenGenericParameterClauseAndInheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritanceClauseAndGenericWhereClause": unexpectedBetweenInheritanceClauseAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndMembers": unexpectedBetweenGenericWhereClauseAndMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "members": Syntax(members).asProtocol(SyntaxProtocol.self), - "unexpectedAfterMembers": unexpectedAfterMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeinitializerDeclSyntax @@ -1446,22 +1356,6 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension DeinitializerDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndDeinitKeyword": unexpectedBetweenModifiersAndDeinitKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "deinitKeyword": Syntax(deinitKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDeinitKeywordAndBody": unexpectedBetweenDeinitKeywordAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": body.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - EditorPlaceholderDeclSyntax @@ -1539,15 +1433,6 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension EditorPlaceholderDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIdentifier": unexpectedBeforeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedAfterIdentifier": unexpectedAfterIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - EnumCaseDeclSyntax /// A `case` declaration of a Swift `enum`. It can have 1 or more `EnumCaseElement`s inside, each declaring a different case of the enum. @@ -1776,22 +1661,6 @@ public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension EnumCaseDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndCaseKeyword": unexpectedBetweenModifiersAndCaseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "caseKeyword": Syntax(caseKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCaseKeywordAndElements": unexpectedBetweenCaseKeywordAndElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elements": Syntax(elements).asProtocol(SyntaxProtocol.self), - "unexpectedAfterElements": unexpectedAfterElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - EnumDeclSyntax /// A Swift `enum` declaration. @@ -2109,30 +1978,6 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension EnumDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndEnumKeyword": unexpectedBetweenModifiersAndEnumKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "enumKeyword": Syntax(enumKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenEnumKeywordAndIdentifier": unexpectedBetweenEnumKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndGenericParameters": unexpectedBetweenIdentifierAndGenericParameters.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameters": genericParameters.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParametersAndInheritanceClause": unexpectedBetweenGenericParametersAndInheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritanceClauseAndGenericWhereClause": unexpectedBetweenInheritanceClauseAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndMembers": unexpectedBetweenGenericWhereClauseAndMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "members": Syntax(members).asProtocol(SyntaxProtocol.self), - "unexpectedAfterMembers": unexpectedAfterMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ExtensionDeclSyntax @@ -2416,28 +2261,6 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension ExtensionDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndExtensionKeyword": unexpectedBetweenModifiersAndExtensionKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "extensionKeyword": Syntax(extensionKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExtensionKeywordAndExtendedType": unexpectedBetweenExtensionKeywordAndExtendedType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "extendedType": Syntax(extendedType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExtendedTypeAndInheritanceClause": unexpectedBetweenExtendedTypeAndInheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritanceClauseAndGenericWhereClause": unexpectedBetweenInheritanceClauseAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndMembers": unexpectedBetweenGenericWhereClauseAndMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "members": Syntax(members).asProtocol(SyntaxProtocol.self), - "unexpectedAfterMembers": unexpectedAfterMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - FunctionDeclSyntax @@ -2747,30 +2570,6 @@ public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension FunctionDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndFuncKeyword": unexpectedBetweenModifiersAndFuncKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "funcKeyword": Syntax(funcKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFuncKeywordAndIdentifier": unexpectedBetweenFuncKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndGenericParameterClause": unexpectedBetweenIdentifierAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndSignature": unexpectedBetweenGenericParameterClauseAndSignature.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "signature": Syntax(signature).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSignatureAndGenericWhereClause": unexpectedBetweenSignatureAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndBody": unexpectedBetweenGenericWhereClauseAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": body.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - IfConfigDeclSyntax @@ -2905,18 +2704,6 @@ public struct IfConfigDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension IfConfigDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeClauses": unexpectedBeforeClauses.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "clauses": Syntax(clauses).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenClausesAndPoundEndif": unexpectedBetweenClausesAndPoundEndif.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "poundEndif": Syntax(poundEndif).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPoundEndif": unexpectedAfterPoundEndif.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ImportDeclSyntax @@ -3167,24 +2954,6 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension ImportDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndImportTok": unexpectedBetweenModifiersAndImportTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "importTok": Syntax(importTok).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenImportTokAndImportKind": unexpectedBetweenImportTokAndImportKind.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "importKind": importKind.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenImportKindAndPath": unexpectedBetweenImportKindAndPath.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "path": Syntax(path).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPath": unexpectedAfterPath.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - InitializerDeclSyntax /// An initializer declaration like the following. @@ -3509,30 +3278,6 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension InitializerDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndInitKeyword": unexpectedBetweenModifiersAndInitKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "initKeyword": Syntax(initKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenInitKeywordAndOptionalMark": unexpectedBetweenInitKeywordAndOptionalMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "optionalMark": optionalMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenOptionalMarkAndGenericParameterClause": unexpectedBetweenOptionalMarkAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndSignature": unexpectedBetweenGenericParameterClauseAndSignature.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "signature": Syntax(signature).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSignatureAndGenericWhereClause": unexpectedBetweenSignatureAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndBody": unexpectedBetweenGenericWhereClauseAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": body.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MacroDeclSyntax @@ -3842,30 +3587,6 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension MacroDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndMacroKeyword": unexpectedBetweenModifiersAndMacroKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "macroKeyword": Syntax(macroKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMacroKeywordAndIdentifier": unexpectedBetweenMacroKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndGenericParameterClause": unexpectedBetweenIdentifierAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndSignature": unexpectedBetweenGenericParameterClauseAndSignature.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "signature": Syntax(signature).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSignatureAndDefinition": unexpectedBetweenSignatureAndDefinition.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "definition": definition.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDefinitionAndGenericWhereClause": unexpectedBetweenDefinitionAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterGenericWhereClause": unexpectedAfterGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MacroExpansionDeclSyntax @@ -4176,30 +3897,6 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension MacroExpansionDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePoundToken": unexpectedBeforePoundToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "poundToken": Syntax(poundToken).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPoundTokenAndMacro": unexpectedBetweenPoundTokenAndMacro.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "macro": Syntax(macro).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMacroAndGenericArguments": unexpectedBetweenMacroAndGenericArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericArguments": genericArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericArgumentsAndLeftParen": unexpectedBetweenGenericArgumentsAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": leftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLeftParenAndArgumentList": unexpectedBetweenLeftParenAndArgumentList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "argumentList": Syntax(argumentList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentListAndRightParen": unexpectedBetweenArgumentListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": rightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenRightParenAndTrailingClosure": unexpectedBetweenRightParenAndTrailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingClosure": trailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures": unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "additionalTrailingClosures": additionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterAdditionalTrailingClosures": unexpectedAfterAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MissingDeclSyntax @@ -4353,18 +4050,6 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension MissingDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterModifiers": unexpectedAfterModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - OperatorDeclSyntax /// A Swift `operator` declaration. @@ -4599,24 +4284,6 @@ public struct OperatorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension OperatorDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndOperatorKeyword": unexpectedBetweenModifiersAndOperatorKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "operatorKeyword": Syntax(operatorKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenOperatorKeywordAndIdentifier": unexpectedBetweenOperatorKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndOperatorPrecedenceAndTypes": unexpectedBetweenIdentifierAndOperatorPrecedenceAndTypes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "operatorPrecedenceAndTypes": operatorPrecedenceAndTypes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterOperatorPrecedenceAndTypes": unexpectedAfterOperatorPrecedenceAndTypes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PoundSourceLocationSyntax @@ -4784,22 +4451,6 @@ public struct PoundSourceLocationSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension PoundSourceLocationSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePoundSourceLocation": unexpectedBeforePoundSourceLocation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "poundSourceLocation": Syntax(poundSourceLocation).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPoundSourceLocationAndLeftParen": unexpectedBetweenPoundSourceLocationAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndArgs": unexpectedBetweenLeftParenAndArgs.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "args": args.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenArgsAndRightParen": unexpectedBetweenArgsAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrecedenceGroupDeclSyntax /// A Swift `precedencegroup` declaration. @@ -5106,28 +4757,6 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension PrecedenceGroupDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndPrecedencegroupKeyword": unexpectedBetweenModifiersAndPrecedencegroupKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "precedencegroupKeyword": Syntax(precedencegroupKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPrecedencegroupKeywordAndIdentifier": unexpectedBetweenPrecedencegroupKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndLeftBrace": unexpectedBetweenIdentifierAndLeftBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBrace": Syntax(leftBrace).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBraceAndGroupAttributes": unexpectedBetweenLeftBraceAndGroupAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "groupAttributes": Syntax(groupAttributes).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenGroupAttributesAndRightBrace": unexpectedBetweenGroupAttributesAndRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBrace": Syntax(rightBrace).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightBrace": unexpectedAfterRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ProtocolDeclSyntax @@ -5437,30 +5066,6 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension ProtocolDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndProtocolKeyword": unexpectedBetweenModifiersAndProtocolKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "protocolKeyword": Syntax(protocolKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenProtocolKeywordAndIdentifier": unexpectedBetweenProtocolKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndPrimaryAssociatedTypeClause": unexpectedBetweenIdentifierAndPrimaryAssociatedTypeClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "primaryAssociatedTypeClause": primaryAssociatedTypeClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenPrimaryAssociatedTypeClauseAndInheritanceClause": unexpectedBetweenPrimaryAssociatedTypeClauseAndInheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritanceClauseAndGenericWhereClause": unexpectedBetweenInheritanceClauseAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndMembers": unexpectedBetweenGenericWhereClauseAndMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "members": Syntax(members).asProtocol(SyntaxProtocol.self), - "unexpectedAfterMembers": unexpectedAfterMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - StructDeclSyntax @@ -5770,30 +5375,6 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension StructDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndStructKeyword": unexpectedBetweenModifiersAndStructKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "structKeyword": Syntax(structKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenStructKeywordAndIdentifier": unexpectedBetweenStructKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndGenericParameterClause": unexpectedBetweenIdentifierAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndInheritanceClause": unexpectedBetweenGenericParameterClauseAndInheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritanceClauseAndGenericWhereClause": unexpectedBetweenInheritanceClauseAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndMembers": unexpectedBetweenGenericWhereClauseAndMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "members": Syntax(members).asProtocol(SyntaxProtocol.self), - "unexpectedAfterMembers": unexpectedAfterMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SubscriptDeclSyntax @@ -6145,30 +5726,6 @@ public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension SubscriptDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndSubscriptKeyword": unexpectedBetweenModifiersAndSubscriptKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "subscriptKeyword": Syntax(subscriptKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSubscriptKeywordAndGenericParameterClause": unexpectedBetweenSubscriptKeywordAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndIndices": unexpectedBetweenGenericParameterClauseAndIndices.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "indices": Syntax(indices).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIndicesAndResult": unexpectedBetweenIndicesAndResult.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "result": Syntax(result).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenResultAndGenericWhereClause": unexpectedBetweenResultAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndAccessor": unexpectedBetweenGenericWhereClauseAndAccessor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "accessor": accessor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterAccessor": unexpectedAfterAccessor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TypealiasDeclSyntax @@ -6452,28 +6009,6 @@ public struct TypealiasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } -extension TypealiasDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndTypealiasKeyword": unexpectedBetweenModifiersAndTypealiasKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typealiasKeyword": Syntax(typealiasKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypealiasKeywordAndIdentifier": unexpectedBetweenTypealiasKeywordAndIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndGenericParameterClause": unexpectedBetweenIdentifierAndGenericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericParameterClauseAndInitializer": unexpectedBetweenGenericParameterClauseAndInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "initializer": Syntax(initializer).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenInitializerAndGenericWhereClause": unexpectedBetweenInitializerAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterGenericWhereClause": unexpectedAfterGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - VariableDeclSyntax @@ -6697,19 +6232,3 @@ public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ]) } } - -extension VariableDeclSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndBindingKeyword": unexpectedBetweenModifiersAndBindingKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "bindingKeyword": Syntax(bindingKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBindingKeywordAndBindings": unexpectedBetweenBindingKeywordAndBindings.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "bindings": Syntax(bindings).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBindings": unexpectedAfterBindings.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift index 8707e257ac9..664bb1272b9 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift @@ -172,20 +172,6 @@ public struct ArrayExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension ArrayExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftSquare": unexpectedBeforeLeftSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftSquare": Syntax(leftSquare).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftSquareAndElements": unexpectedBetweenLeftSquareAndElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elements": Syntax(elements).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenElementsAndRightSquare": unexpectedBetweenElementsAndRightSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightSquare": Syntax(rightSquare).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightSquare": unexpectedAfterRightSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ArrowExprSyntax @@ -301,18 +287,6 @@ public struct ArrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension ArrowExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeEffectSpecifiers": unexpectedBeforeEffectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "effectSpecifiers": effectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEffectSpecifiersAndArrowToken": unexpectedBetweenEffectSpecifiersAndArrowToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "arrowToken": Syntax(arrowToken).asProtocol(SyntaxProtocol.self), - "unexpectedAfterArrowToken": unexpectedAfterArrowToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AsExprSyntax @@ -480,22 +454,6 @@ public struct AsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension AsExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndAsTok": unexpectedBetweenExpressionAndAsTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "asTok": Syntax(asTok).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAsTokAndQuestionOrExclamationMark": unexpectedBetweenAsTokAndQuestionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionOrExclamationMark": questionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenQuestionOrExclamationMarkAndTypeName": unexpectedBetweenQuestionOrExclamationMarkAndTypeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeName": Syntax(typeName).asProtocol(SyntaxProtocol.self), - "unexpectedAfterTypeName": unexpectedAfterTypeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AssignmentExprSyntax @@ -573,15 +531,6 @@ public struct AssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension AssignmentExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAssignToken": unexpectedBeforeAssignToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "assignToken": Syntax(assignToken).asProtocol(SyntaxProtocol.self), - "unexpectedAfterAssignToken": unexpectedAfterAssignToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - AwaitExprSyntax @@ -697,18 +646,6 @@ public struct AwaitExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension AwaitExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAwaitKeyword": unexpectedBeforeAwaitKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "awaitKeyword": Syntax(awaitKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAwaitKeywordAndExpression": unexpectedBetweenAwaitKeywordAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - BinaryOperatorExprSyntax @@ -786,15 +723,6 @@ public struct BinaryOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension BinaryOperatorExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeOperatorToken": unexpectedBeforeOperatorToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "operatorToken": Syntax(operatorToken).asProtocol(SyntaxProtocol.self), - "unexpectedAfterOperatorToken": unexpectedAfterOperatorToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - BooleanLiteralExprSyntax @@ -872,15 +800,6 @@ public struct BooleanLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension BooleanLiteralExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBooleanLiteral": unexpectedBeforeBooleanLiteral.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "booleanLiteral": Syntax(booleanLiteral).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBooleanLiteral": unexpectedAfterBooleanLiteral.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - BorrowExprSyntax @@ -996,18 +915,6 @@ public struct BorrowExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension BorrowExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBorrowKeyword": unexpectedBeforeBorrowKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "borrowKeyword": Syntax(borrowKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBorrowKeywordAndExpression": unexpectedBetweenBorrowKeywordAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureExprSyntax @@ -1194,22 +1101,6 @@ public struct ClosureExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension ClosureExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftBrace": unexpectedBeforeLeftBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBrace": Syntax(leftBrace).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBraceAndSignature": unexpectedBetweenLeftBraceAndSignature.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "signature": signature.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSignatureAndStatements": unexpectedBetweenSignatureAndStatements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "statements": Syntax(statements).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenStatementsAndRightBrace": unexpectedBetweenStatementsAndRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBrace": Syntax(rightBrace).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightBrace": unexpectedAfterRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DictionaryExprSyntax @@ -1393,20 +1284,6 @@ public struct DictionaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension DictionaryExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftSquare": unexpectedBeforeLeftSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftSquare": Syntax(leftSquare).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftSquareAndContent": unexpectedBetweenLeftSquareAndContent.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "content": Syntax(content).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenContentAndRightSquare": unexpectedBetweenContentAndRightSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightSquare": Syntax(rightSquare).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightSquare": unexpectedAfterRightSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DiscardAssignmentExprSyntax @@ -1484,15 +1361,6 @@ public struct DiscardAssignmentExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension DiscardAssignmentExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWildcard": unexpectedBeforeWildcard.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "wildcard": Syntax(wildcard).asProtocol(SyntaxProtocol.self), - "unexpectedAfterWildcard": unexpectedAfterWildcard.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - EditorPlaceholderExprSyntax @@ -1570,15 +1438,6 @@ public struct EditorPlaceholderExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension EditorPlaceholderExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIdentifier": unexpectedBeforeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedAfterIdentifier": unexpectedAfterIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - FloatLiteralExprSyntax @@ -1656,15 +1515,6 @@ public struct FloatLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension FloatLiteralExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeFloatingDigits": unexpectedBeforeFloatingDigits.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "floatingDigits": Syntax(floatingDigits).asProtocol(SyntaxProtocol.self), - "unexpectedAfterFloatingDigits": unexpectedAfterFloatingDigits.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - ForcedValueExprSyntax @@ -1780,18 +1630,6 @@ public struct ForcedValueExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension ForcedValueExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndExclamationMark": unexpectedBetweenExpressionAndExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "exclamationMark": Syntax(exclamationMark).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExclamationMark": unexpectedAfterExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - FunctionCallExprSyntax @@ -2049,26 +1887,6 @@ public struct FunctionCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension FunctionCallExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeCalledExpression": unexpectedBeforeCalledExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "calledExpression": Syntax(calledExpression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCalledExpressionAndLeftParen": unexpectedBetweenCalledExpressionAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": leftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLeftParenAndArgumentList": unexpectedBetweenLeftParenAndArgumentList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "argumentList": Syntax(argumentList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentListAndRightParen": unexpectedBetweenArgumentListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": rightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenRightParenAndTrailingClosure": unexpectedBetweenRightParenAndTrailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingClosure": trailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures": unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "additionalTrailingClosures": additionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterAdditionalTrailingClosures": unexpectedAfterAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - IdentifierExprSyntax @@ -2184,18 +2002,6 @@ public struct IdentifierExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension IdentifierExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIdentifier": unexpectedBeforeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndDeclNameArguments": unexpectedBetweenIdentifierAndDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declNameArguments": declNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterDeclNameArguments": unexpectedAfterDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - IfExprSyntax @@ -2450,24 +2256,6 @@ public struct IfExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension IfExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIfKeyword": unexpectedBeforeIfKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ifKeyword": Syntax(ifKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIfKeywordAndConditions": unexpectedBetweenIfKeywordAndConditions.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "conditions": Syntax(conditions).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenConditionsAndBody": unexpectedBetweenConditionsAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBodyAndElseKeyword": unexpectedBetweenBodyAndElseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elseKeyword": elseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenElseKeywordAndElseBody": unexpectedBetweenElseKeywordAndElseBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elseBody": elseBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterElseBody": unexpectedAfterElseBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - InOutExprSyntax @@ -2583,18 +2371,6 @@ public struct InOutExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension InOutExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAmpersand": unexpectedBeforeAmpersand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ampersand": Syntax(ampersand).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAmpersandAndExpression": unexpectedBetweenAmpersandAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - InfixOperatorExprSyntax @@ -2736,20 +2512,6 @@ public struct InfixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension InfixOperatorExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftOperand": unexpectedBeforeLeftOperand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftOperand": Syntax(leftOperand).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftOperandAndOperatorOperand": unexpectedBetweenLeftOperandAndOperatorOperand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "operatorOperand": Syntax(operatorOperand).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenOperatorOperandAndRightOperand": unexpectedBetweenOperatorOperandAndRightOperand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightOperand": Syntax(rightOperand).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightOperand": unexpectedAfterRightOperand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - IntegerLiteralExprSyntax @@ -2827,15 +2589,6 @@ public struct IntegerLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension IntegerLiteralExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeDigits": unexpectedBeforeDigits.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "digits": Syntax(digits).asProtocol(SyntaxProtocol.self), - "unexpectedAfterDigits": unexpectedAfterDigits.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - IsExprSyntax @@ -2977,20 +2730,6 @@ public struct IsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension IsExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndIsTok": unexpectedBetweenExpressionAndIsTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "isTok": Syntax(isTok).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIsTokAndTypeName": unexpectedBetweenIsTokAndTypeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeName": Syntax(typeName).asProtocol(SyntaxProtocol.self), - "unexpectedAfterTypeName": unexpectedAfterTypeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - KeyPathExprSyntax @@ -3186,20 +2925,6 @@ public struct KeyPathExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension KeyPathExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBackslash": unexpectedBeforeBackslash.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "backslash": Syntax(backslash).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBackslashAndRoot": unexpectedBetweenBackslashAndRoot.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "root": root.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenRootAndComponents": unexpectedBetweenRootAndComponents.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "components": Syntax(components).asProtocol(SyntaxProtocol.self), - "unexpectedAfterComponents": unexpectedAfterComponents.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MacroExpansionExprSyntax @@ -3510,30 +3235,6 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension MacroExpansionExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePoundToken": unexpectedBeforePoundToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "poundToken": Syntax(poundToken).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPoundTokenAndMacro": unexpectedBetweenPoundTokenAndMacro.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "macro": Syntax(macro).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMacroAndGenericArguments": unexpectedBetweenMacroAndGenericArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericArguments": genericArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericArgumentsAndLeftParen": unexpectedBetweenGenericArgumentsAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": leftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLeftParenAndArgumentList": unexpectedBetweenLeftParenAndArgumentList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "argumentList": Syntax(argumentList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentListAndRightParen": unexpectedBetweenArgumentListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": rightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenRightParenAndTrailingClosure": unexpectedBetweenRightParenAndTrailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingClosure": trailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures": unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "additionalTrailingClosures": additionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterAdditionalTrailingClosures": unexpectedAfterAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MemberAccessExprSyntax @@ -3740,22 +3441,6 @@ public struct MemberAccessExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension MemberAccessExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBase": unexpectedBeforeBase.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "base": base.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenBaseAndDot": unexpectedBetweenBaseAndDot.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "dot": Syntax(dot).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDotAndName": unexpectedBetweenDotAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndDeclNameArguments": unexpectedBetweenNameAndDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declNameArguments": declNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterDeclNameArguments": unexpectedAfterDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MissingExprSyntax @@ -3812,13 +3497,6 @@ public struct MissingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension MissingExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpected": unexpected.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - MoveExprSyntax @@ -3934,18 +3612,6 @@ public struct MoveExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension MoveExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeMoveKeyword": unexpectedBeforeMoveKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "moveKeyword": Syntax(moveKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMoveKeywordAndExpression": unexpectedBetweenMoveKeywordAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - NilLiteralExprSyntax @@ -4023,15 +3689,6 @@ public struct NilLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension NilLiteralExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeNilKeyword": unexpectedBeforeNilKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "nilKeyword": Syntax(nilKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedAfterNilKeyword": unexpectedAfterNilKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - OptionalChainingExprSyntax @@ -4147,18 +3804,6 @@ public struct OptionalChainingExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension OptionalChainingExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndQuestionMark": unexpectedBetweenExpressionAndQuestionMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionMark": Syntax(questionMark).asProtocol(SyntaxProtocol.self), - "unexpectedAfterQuestionMark": unexpectedAfterQuestionMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PackElementExprSyntax @@ -4274,18 +3919,6 @@ public struct PackElementExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension PackElementExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeEachKeyword": unexpectedBeforeEachKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "eachKeyword": Syntax(eachKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenEachKeywordAndPackRefExpr": unexpectedBetweenEachKeywordAndPackRefExpr.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "packRefExpr": Syntax(packRefExpr).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPackRefExpr": unexpectedAfterPackRefExpr.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PackExpansionExprSyntax @@ -4401,18 +4034,6 @@ public struct PackExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension PackExpansionExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeRepeatKeyword": unexpectedBeforeRepeatKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "repeatKeyword": Syntax(repeatKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenRepeatKeywordAndPatternExpr": unexpectedBetweenRepeatKeywordAndPatternExpr.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "patternExpr": Syntax(patternExpr).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPatternExpr": unexpectedAfterPatternExpr.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PostfixIfConfigExprSyntax @@ -4559,18 +4180,6 @@ public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension PostfixIfConfigExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBase": unexpectedBeforeBase.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "base": base.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenBaseAndConfig": unexpectedBetweenBaseAndConfig.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "config": Syntax(config).asProtocol(SyntaxProtocol.self), - "unexpectedAfterConfig": unexpectedAfterConfig.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PostfixUnaryExprSyntax @@ -4686,18 +4295,6 @@ public struct PostfixUnaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension PostfixUnaryExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndOperatorToken": unexpectedBetweenExpressionAndOperatorToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "operatorToken": Syntax(operatorToken).asProtocol(SyntaxProtocol.self), - "unexpectedAfterOperatorToken": unexpectedAfterOperatorToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrefixOperatorExprSyntax @@ -4813,18 +4410,6 @@ public struct PrefixOperatorExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension PrefixOperatorExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeOperatorToken": unexpectedBeforeOperatorToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "operatorToken": operatorToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenOperatorTokenAndPostfixExpression": unexpectedBetweenOperatorTokenAndPostfixExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "postfixExpression": Syntax(postfixExpression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPostfixExpression": unexpectedAfterPostfixExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - RegexLiteralExprSyntax @@ -5018,24 +4603,6 @@ public struct RegexLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension RegexLiteralExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeOpeningPounds": unexpectedBeforeOpeningPounds.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "openingPounds": openingPounds.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenOpeningPoundsAndOpenSlash": unexpectedBetweenOpeningPoundsAndOpenSlash.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "openSlash": Syntax(openSlash).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenOpenSlashAndRegexPattern": unexpectedBetweenOpenSlashAndRegexPattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "regexPattern": Syntax(regexPattern).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenRegexPatternAndCloseSlash": unexpectedBetweenRegexPatternAndCloseSlash.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "closeSlash": Syntax(closeSlash).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCloseSlashAndClosingPounds": unexpectedBetweenCloseSlashAndClosingPounds.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "closingPounds": closingPounds.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterClosingPounds": unexpectedAfterClosingPounds.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SequenceExprSyntax @@ -5132,15 +4699,6 @@ public struct SequenceExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension SequenceExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeElements": unexpectedBeforeElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elements": Syntax(elements).asProtocol(SyntaxProtocol.self), - "unexpectedAfterElements": unexpectedAfterElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - SpecializeExprSyntax @@ -5256,18 +4814,6 @@ public struct SpecializeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension SpecializeExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndGenericArgumentClause": unexpectedBetweenExpressionAndGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericArgumentClause": Syntax(genericArgumentClause).asProtocol(SyntaxProtocol.self), - "unexpectedAfterGenericArgumentClause": unexpectedAfterGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - StringLiteralExprSyntax @@ -5480,24 +5026,6 @@ public struct StringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension StringLiteralExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeOpenDelimiter": unexpectedBeforeOpenDelimiter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "openDelimiter": openDelimiter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenOpenDelimiterAndOpenQuote": unexpectedBetweenOpenDelimiterAndOpenQuote.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "openQuote": Syntax(openQuote).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenOpenQuoteAndSegments": unexpectedBetweenOpenQuoteAndSegments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "segments": Syntax(segments).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSegmentsAndCloseQuote": unexpectedBetweenSegmentsAndCloseQuote.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "closeQuote": Syntax(closeQuote).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCloseQuoteAndCloseDelimiter": unexpectedBetweenCloseQuoteAndCloseDelimiter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "closeDelimiter": closeDelimiter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterCloseDelimiter": unexpectedAfterCloseDelimiter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SubscriptExprSyntax @@ -5755,26 +5283,6 @@ public struct SubscriptExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension SubscriptExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeCalledExpression": unexpectedBeforeCalledExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "calledExpression": Syntax(calledExpression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCalledExpressionAndLeftBracket": unexpectedBetweenCalledExpressionAndLeftBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBracket": Syntax(leftBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBracketAndArgumentList": unexpectedBetweenLeftBracketAndArgumentList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "argumentList": Syntax(argumentList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentListAndRightBracket": unexpectedBetweenArgumentListAndRightBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBracket": Syntax(rightBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenRightBracketAndTrailingClosure": unexpectedBetweenRightBracketAndTrailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingClosure": trailingClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures": unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "additionalTrailingClosures": additionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterAdditionalTrailingClosures": unexpectedAfterAdditionalTrailingClosures.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SuperRefExprSyntax @@ -5852,15 +5360,6 @@ public struct SuperRefExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension SuperRefExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeSuperKeyword": unexpectedBeforeSuperKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "superKeyword": Syntax(superKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedAfterSuperKeyword": unexpectedAfterSuperKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - SwitchExprSyntax @@ -6073,24 +5572,6 @@ public struct SwitchExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension SwitchExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeSwitchKeyword": unexpectedBeforeSwitchKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "switchKeyword": Syntax(switchKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSwitchKeywordAndExpression": unexpectedBetweenSwitchKeywordAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndLeftBrace": unexpectedBetweenExpressionAndLeftBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBrace": Syntax(leftBrace).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBraceAndCases": unexpectedBetweenLeftBraceAndCases.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "cases": Syntax(cases).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCasesAndRightBrace": unexpectedBetweenCasesAndRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBrace": Syntax(rightBrace).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightBrace": unexpectedAfterRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TernaryExprSyntax @@ -6284,24 +5765,6 @@ public struct TernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension TernaryExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeConditionExpression": unexpectedBeforeConditionExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "conditionExpression": Syntax(conditionExpression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenConditionExpressionAndQuestionMark": unexpectedBetweenConditionExpressionAndQuestionMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionMark": Syntax(questionMark).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenQuestionMarkAndFirstChoice": unexpectedBetweenQuestionMarkAndFirstChoice.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "firstChoice": Syntax(firstChoice).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFirstChoiceAndColonMark": unexpectedBetweenFirstChoiceAndColonMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colonMark": Syntax(colonMark).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonMarkAndSecondChoice": unexpectedBetweenColonMarkAndSecondChoice.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "secondChoice": Syntax(secondChoice).asProtocol(SyntaxProtocol.self), - "unexpectedAfterSecondChoice": unexpectedAfterSecondChoice.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TryExprSyntax @@ -6443,20 +5906,6 @@ public struct TryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension TryExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeTryKeyword": unexpectedBeforeTryKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "tryKeyword": Syntax(tryKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTryKeywordAndQuestionOrExclamationMark": unexpectedBetweenTryKeywordAndQuestionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionOrExclamationMark": questionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenQuestionOrExclamationMarkAndExpression": unexpectedBetweenQuestionOrExclamationMarkAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TupleExprSyntax @@ -6617,20 +6066,6 @@ public struct TupleExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension TupleExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndElementList": unexpectedBetweenLeftParenAndElementList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elementList": Syntax(elementList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenElementListAndRightParen": unexpectedBetweenElementListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TypeExprSyntax @@ -6708,15 +6143,6 @@ public struct TypeExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension TypeExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeType": unexpectedBeforeType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedAfterType": unexpectedAfterType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - UnresolvedAsExprSyntax @@ -6832,18 +6258,6 @@ public struct UnresolvedAsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension UnresolvedAsExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAsTok": unexpectedBeforeAsTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "asTok": Syntax(asTok).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAsTokAndQuestionOrExclamationMark": unexpectedBetweenAsTokAndQuestionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionOrExclamationMark": questionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterQuestionOrExclamationMark": unexpectedAfterQuestionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - UnresolvedIsExprSyntax @@ -6921,15 +6335,6 @@ public struct UnresolvedIsExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension UnresolvedIsExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIsTok": unexpectedBeforeIsTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "isTok": Syntax(isTok).asProtocol(SyntaxProtocol.self), - "unexpectedAfterIsTok": unexpectedAfterIsTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - UnresolvedPatternExprSyntax @@ -7007,15 +6412,6 @@ public struct UnresolvedPatternExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } -extension UnresolvedPatternExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePattern": unexpectedBeforePattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": Syntax(pattern).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPattern": unexpectedAfterPattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - UnresolvedTernaryExprSyntax @@ -7156,17 +6552,3 @@ public struct UnresolvedTernaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable { ]) } } - -extension UnresolvedTernaryExprSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeQuestionMark": unexpectedBeforeQuestionMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionMark": Syntax(questionMark).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenQuestionMarkAndFirstChoice": unexpectedBetweenQuestionMarkAndFirstChoice.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "firstChoice": Syntax(firstChoice).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFirstChoiceAndColonMark": unexpectedBetweenFirstChoiceAndColonMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colonMark": Syntax(colonMark).asProtocol(SyntaxProtocol.self), - "unexpectedAfterColonMark": unexpectedAfterColonMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift index 8ec3ea2c71a..86d97e15318 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift @@ -127,18 +127,6 @@ public struct AccessPathComponentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension AccessPathComponentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndTrailingDot": unexpectedBetweenNameAndTrailingDot.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingDot": trailingDot.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingDot": unexpectedAfterTrailingDot.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AccessorBlockSyntax @@ -299,20 +287,6 @@ public struct AccessorBlockSyntax: SyntaxProtocol, SyntaxHashable { } } -extension AccessorBlockSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftBrace": unexpectedBeforeLeftBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBrace": Syntax(leftBrace).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBraceAndAccessors": unexpectedBetweenLeftBraceAndAccessors.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "accessors": Syntax(accessors).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAccessorsAndRightBrace": unexpectedBetweenAccessorsAndRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBrace": Syntax(rightBrace).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightBrace": unexpectedAfterRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AccessorEffectSpecifiersSyntax @@ -428,18 +402,6 @@ public struct AccessorEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { } } -extension AccessorEffectSpecifiersSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAsyncSpecifier": unexpectedBeforeAsyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "asyncSpecifier": asyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier": unexpectedBetweenAsyncSpecifierAndThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "throwsSpecifier": throwsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterThrowsSpecifier": unexpectedAfterThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AccessorParameterSyntax @@ -581,20 +543,6 @@ public struct AccessorParameterSyntax: SyntaxProtocol, SyntaxHashable { } } -extension AccessorParameterSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndName": unexpectedBetweenLeftParenAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndRightParen": unexpectedBetweenNameAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ArrayElementSyntax @@ -710,18 +658,6 @@ public struct ArrayElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ArrayElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndTrailingComma": unexpectedBetweenExpressionAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AttributeSyntax /// An `@` attribute. @@ -1181,24 +1117,6 @@ public struct AttributeSyntax: SyntaxProtocol, SyntaxHashable { } } -extension AttributeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAtSignToken": unexpectedBeforeAtSignToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "atSignToken": Syntax(atSignToken).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAtSignTokenAndAttributeName": unexpectedBetweenAtSignTokenAndAttributeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributeName": Syntax(attributeName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAttributeNameAndLeftParen": unexpectedBetweenAttributeNameAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": leftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLeftParenAndArgument": unexpectedBetweenLeftParenAndArgument.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "argument": argument.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenArgumentAndRightParen": unexpectedBetweenArgumentAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": rightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AvailabilityArgumentSyntax /// A single argument to an `@available` argument like `*`, `iOS 10.1`, or `message: "This has been deprecated"`. @@ -1369,18 +1287,6 @@ public struct AvailabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension AvailabilityArgumentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeEntry": unexpectedBeforeEntry.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "entry": Syntax(entry).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenEntryAndTrailingComma": unexpectedBetweenEntryAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AvailabilityConditionSyntax @@ -1567,22 +1473,6 @@ public struct AvailabilityConditionSyntax: SyntaxProtocol, SyntaxHashable { } } -extension AvailabilityConditionSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAvailabilityKeyword": unexpectedBeforeAvailabilityKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "availabilityKeyword": Syntax(availabilityKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAvailabilityKeywordAndLeftParen": unexpectedBetweenAvailabilityKeywordAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndAvailabilitySpec": unexpectedBetweenLeftParenAndAvailabilitySpec.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "availabilitySpec": Syntax(availabilitySpec).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAvailabilitySpecAndRightParen": unexpectedBetweenAvailabilitySpecAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AvailabilityEntrySyntax /// The availability argument for the _specialize attribute @@ -1771,22 +1661,6 @@ public struct AvailabilityEntrySyntax: SyntaxProtocol, SyntaxHashable { } } -extension AvailabilityEntrySyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabel": unexpectedBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": Syntax(label).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelAndColon": unexpectedBetweenLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndAvailabilityList": unexpectedBetweenColonAndAvailabilityList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "availabilityList": Syntax(availabilityList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAvailabilityListAndSemicolon": unexpectedBetweenAvailabilityListAndSemicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "semicolon": Syntax(semicolon).asProtocol(SyntaxProtocol.self), - "unexpectedAfterSemicolon": unexpectedAfterSemicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AvailabilityLabeledArgumentSyntax /// A argument to an `@available` attribute that consists of a label and a value, e.g. `message: "This has been deprecated"`. @@ -1973,20 +1847,6 @@ public struct AvailabilityLabeledArgumentSyntax: SyntaxProtocol, SyntaxHashable } } -extension AvailabilityLabeledArgumentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabel": unexpectedBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": Syntax(label).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelAndColon": unexpectedBetweenLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndValue": unexpectedBetweenColonAndValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "value": Syntax(value).asProtocol(SyntaxProtocol.self), - "unexpectedAfterValue": unexpectedAfterValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AvailabilityVersionRestrictionListEntrySyntax /// A single platform/version pair in an attribute, e.g. `iOS 10.1`. @@ -2103,18 +1963,6 @@ public struct AvailabilityVersionRestrictionListEntrySyntax: SyntaxProtocol, Syn } } -extension AvailabilityVersionRestrictionListEntrySyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAvailabilityVersionRestriction": unexpectedBeforeAvailabilityVersionRestriction.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "availabilityVersionRestriction": Syntax(availabilityVersionRestriction).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAvailabilityVersionRestrictionAndTrailingComma": unexpectedBetweenAvailabilityVersionRestrictionAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AvailabilityVersionRestrictionSyntax /// An argument to `@available` that restricts the availability on a certain platform to a version, e.g. `iOS 10` or `swift 3.4`. @@ -2231,18 +2079,6 @@ public struct AvailabilityVersionRestrictionSyntax: SyntaxProtocol, SyntaxHashab } } -extension AvailabilityVersionRestrictionSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePlatform": unexpectedBeforePlatform.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "platform": Syntax(platform).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPlatformAndVersion": unexpectedBetweenPlatformAndVersion.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "version": version.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterVersion": unexpectedAfterVersion.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - BackDeployedAttributeSpecListSyntax /// A collection of arguments for the `@backDeployed` attribute @@ -2406,20 +2242,6 @@ public struct BackDeployedAttributeSpecListSyntax: SyntaxProtocol, SyntaxHashabl } } -extension BackDeployedAttributeSpecListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBeforeLabel": unexpectedBeforeBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "beforeLabel": Syntax(beforeLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBeforeLabelAndColon": unexpectedBetweenBeforeLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndVersionList": unexpectedBetweenColonAndVersionList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "versionList": Syntax(versionList).asProtocol(SyntaxProtocol.self), - "unexpectedAfterVersionList": unexpectedAfterVersionList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - CaseItemSyntax @@ -2561,20 +2383,6 @@ public struct CaseItemSyntax: SyntaxProtocol, SyntaxHashable { } } -extension CaseItemSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePattern": unexpectedBeforePattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": Syntax(pattern).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPatternAndWhereClause": unexpectedBetweenPatternAndWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whereClause": whereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenWhereClauseAndTrailingComma": unexpectedBetweenWhereClauseAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - CatchClauseSyntax @@ -2735,20 +2543,6 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension CatchClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeCatchKeyword": unexpectedBeforeCatchKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "catchKeyword": Syntax(catchKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCatchKeywordAndCatchItems": unexpectedBetweenCatchKeywordAndCatchItems.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "catchItems": catchItems.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCatchItemsAndBody": unexpectedBetweenCatchItemsAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - CatchItemSyntax @@ -2925,20 +2719,6 @@ public struct CatchItemSyntax: SyntaxProtocol, SyntaxHashable { } } -extension CatchItemSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePattern": unexpectedBeforePattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": pattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenPatternAndWhereClause": unexpectedBetweenPatternAndWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whereClause": whereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenWhereClauseAndTrailingComma": unexpectedBetweenWhereClauseAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureCaptureItemSpecifierSyntax @@ -3106,22 +2886,6 @@ public struct ClosureCaptureItemSpecifierSyntax: SyntaxProtocol, SyntaxHashable } } -extension ClosureCaptureItemSpecifierSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeSpecifier": unexpectedBeforeSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "specifier": Syntax(specifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSpecifierAndLeftParen": unexpectedBetweenSpecifierAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": leftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLeftParenAndDetail": unexpectedBetweenLeftParenAndDetail.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "detail": detail.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDetailAndRightParen": unexpectedBetweenDetailAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": rightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureCaptureItemSyntax @@ -3315,24 +3079,6 @@ public struct ClosureCaptureItemSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ClosureCaptureItemSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeSpecifier": unexpectedBeforeSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "specifier": specifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSpecifierAndName": unexpectedBetweenSpecifierAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": name.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenNameAndAssignToken": unexpectedBetweenNameAndAssignToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "assignToken": assignToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAssignTokenAndExpression": unexpectedBetweenAssignTokenAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndTrailingComma": unexpectedBetweenExpressionAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureCaptureSignatureSyntax @@ -3493,20 +3239,6 @@ public struct ClosureCaptureSignatureSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ClosureCaptureSignatureSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftSquare": unexpectedBeforeLeftSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftSquare": Syntax(leftSquare).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftSquareAndItems": unexpectedBetweenLeftSquareAndItems.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "items": items.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenItemsAndRightSquare": unexpectedBetweenItemsAndRightSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightSquare": Syntax(rightSquare).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightSquare": unexpectedAfterRightSquare.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureParamSyntax @@ -3622,18 +3354,6 @@ public struct ClosureParamSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ClosureParamSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndTrailingComma": unexpectedBetweenNameAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureParameterClauseSyntax @@ -3797,20 +3517,6 @@ public struct ClosureParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ClosureParameterClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndParameterList": unexpectedBetweenLeftParenAndParameterList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "parameterList": Syntax(parameterList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenParameterListAndRightParen": unexpectedBetweenParameterListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureParameterSyntax @@ -4181,30 +3887,6 @@ public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ClosureParameterSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndFirstName": unexpectedBetweenModifiersAndFirstName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "firstName": Syntax(firstName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFirstNameAndSecondName": unexpectedBetweenFirstNameAndSecondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "secondName": secondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSecondNameAndColon": unexpectedBetweenSecondNameAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": colon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenColonAndType": unexpectedBetweenColonAndType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": type.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTypeAndEllipsis": unexpectedBetweenTypeAndEllipsis.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ellipsis": ellipsis.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEllipsisAndTrailingComma": unexpectedBetweenEllipsisAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClosureSignatureSyntax @@ -4485,26 +4167,6 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ClosureSignatureSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndCapture": unexpectedBetweenAttributesAndCapture.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "capture": capture.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCaptureAndInput": unexpectedBetweenCaptureAndInput.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "input": input.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInputAndEffectSpecifiers": unexpectedBetweenInputAndEffectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "effectSpecifiers": effectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEffectSpecifiersAndOutput": unexpectedBetweenEffectSpecifiersAndOutput.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "output": output.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenOutputAndInTok": unexpectedBetweenOutputAndInTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inTok": Syntax(inTok).asProtocol(SyntaxProtocol.self), - "unexpectedAfterInTok": unexpectedAfterInTok.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - CodeBlockItemSyntax /// A CodeBlockItem is any Syntax node that appears on its own line inside a CodeBlock. @@ -4675,18 +4337,6 @@ public struct CodeBlockItemSyntax: SyntaxProtocol, SyntaxHashable { } } -extension CodeBlockItemSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeItem": unexpectedBeforeItem.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "item": Syntax(item).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenItemAndSemicolon": unexpectedBetweenItemAndSemicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "semicolon": semicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterSemicolon": unexpectedAfterSemicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - CodeBlockSyntax @@ -4847,20 +4497,6 @@ public struct CodeBlockSyntax: SyntaxProtocol, SyntaxHashable { } } -extension CodeBlockSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftBrace": unexpectedBeforeLeftBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBrace": Syntax(leftBrace).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBraceAndStatements": unexpectedBetweenLeftBraceAndStatements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "statements": Syntax(statements).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenStatementsAndRightBrace": unexpectedBetweenStatementsAndRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBrace": Syntax(rightBrace).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightBrace": unexpectedAfterRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - CompositionTypeElementSyntax @@ -4976,18 +4612,6 @@ public struct CompositionTypeElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension CompositionTypeElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeType": unexpectedBeforeType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypeAndAmpersand": unexpectedBetweenTypeAndAmpersand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ampersand": ampersand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterAmpersand": unexpectedAfterAmpersand.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ConditionElementSyntax @@ -5172,18 +4796,6 @@ public struct ConditionElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ConditionElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeCondition": unexpectedBeforeCondition.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "condition": Syntax(condition).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenConditionAndTrailingComma": unexpectedBetweenConditionAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ConformanceRequirementSyntax @@ -5325,20 +4937,6 @@ public struct ConformanceRequirementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ConformanceRequirementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftTypeIdentifier": unexpectedBeforeLeftTypeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftTypeIdentifier": Syntax(leftTypeIdentifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftTypeIdentifierAndColon": unexpectedBetweenLeftTypeIdentifierAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndRightTypeIdentifier": unexpectedBetweenColonAndRightTypeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightTypeIdentifier": Syntax(rightTypeIdentifier).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightTypeIdentifier": unexpectedAfterRightTypeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ConventionAttributeArgumentsSyntax /// The arguments for the '@convention(...)'. @@ -5533,24 +5131,6 @@ public struct ConventionAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable } } -extension ConventionAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeConventionLabel": unexpectedBeforeConventionLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "conventionLabel": Syntax(conventionLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenConventionLabelAndComma": unexpectedBetweenConventionLabelAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": comma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCommaAndCTypeLabel": unexpectedBetweenCommaAndCTypeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "cTypeLabel": cTypeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCTypeLabelAndColon": unexpectedBetweenCTypeLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": colon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenColonAndCTypeString": unexpectedBetweenColonAndCTypeString.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "cTypeString": cTypeString.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterCTypeString": unexpectedAfterCTypeString.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ConventionWitnessMethodAttributeArgumentsSyntax /// The arguments for the '@convention(witness_method: ...)'. @@ -5692,20 +5272,6 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S } } -extension ConventionWitnessMethodAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWitnessMethodLabel": unexpectedBeforeWitnessMethodLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "witnessMethodLabel": Syntax(witnessMethodLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWitnessMethodLabelAndColon": unexpectedBetweenWitnessMethodLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndProtocolName": unexpectedBetweenColonAndProtocolName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "protocolName": Syntax(protocolName).asProtocol(SyntaxProtocol.self), - "unexpectedAfterProtocolName": unexpectedAfterProtocolName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeclModifierDetailSyntax @@ -5847,20 +5413,6 @@ public struct DeclModifierDetailSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DeclModifierDetailSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndDetail": unexpectedBetweenLeftParenAndDetail.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "detail": Syntax(detail).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDetailAndRightParen": unexpectedBetweenDetailAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeclModifierSyntax @@ -5976,18 +5528,6 @@ public struct DeclModifierSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DeclModifierSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndDetail": unexpectedBetweenNameAndDetail.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "detail": detail.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterDetail": unexpectedAfterDetail.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeclNameArgumentSyntax @@ -6103,18 +5643,6 @@ public struct DeclNameArgumentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DeclNameArgumentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndColon": unexpectedBetweenNameAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedAfterColon": unexpectedAfterColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeclNameArgumentsSyntax @@ -6275,20 +5803,6 @@ public struct DeclNameArgumentsSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DeclNameArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndArguments": unexpectedBetweenLeftParenAndArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "arguments": Syntax(arguments).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentsAndRightParen": unexpectedBetweenArgumentsAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeclNameSyntax @@ -6406,18 +5920,6 @@ public struct DeclNameSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DeclNameSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeDeclBaseName": unexpectedBeforeDeclBaseName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declBaseName": Syntax(declBaseName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDeclBaseNameAndDeclNameArguments": unexpectedBetweenDeclBaseNameAndDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declNameArguments": declNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterDeclNameArguments": unexpectedAfterDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DerivativeRegistrationAttributeArgumentsSyntax /// The arguments for the '@derivative(of:)' and '@transpose(of:)' attributes: the 'of:' label, the original declaration name, and an optional differentiability parameter list. @@ -6668,28 +6170,6 @@ public struct DerivativeRegistrationAttributeArgumentsSyntax: SyntaxProtocol, Sy } } -extension DerivativeRegistrationAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeOfLabel": unexpectedBeforeOfLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ofLabel": Syntax(ofLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenOfLabelAndColon": unexpectedBetweenOfLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndOriginalDeclName": unexpectedBetweenColonAndOriginalDeclName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "originalDeclName": Syntax(originalDeclName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenOriginalDeclNameAndPeriod": unexpectedBetweenOriginalDeclNameAndPeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "period": period.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenPeriodAndAccessorKind": unexpectedBetweenPeriodAndAccessorKind.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "accessorKind": accessorKind.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAccessorKindAndComma": unexpectedBetweenAccessorKindAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": comma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCommaAndDiffParams": unexpectedBetweenCommaAndDiffParams.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "diffParams": diffParams.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterDiffParams": unexpectedAfterDiffParams.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DesignatedTypeElementSyntax @@ -6805,18 +6285,6 @@ public struct DesignatedTypeElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DesignatedTypeElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeadingComma": unexpectedBeforeLeadingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leadingComma": Syntax(leadingComma).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeadingCommaAndName": unexpectedBetweenLeadingCommaAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedAfterName": unexpectedAfterName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DictionaryElementSyntax @@ -6984,22 +6452,6 @@ public struct DictionaryElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DictionaryElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeKeyExpression": unexpectedBeforeKeyExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "keyExpression": Syntax(keyExpression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenKeyExpressionAndColon": unexpectedBetweenKeyExpressionAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndValueExpression": unexpectedBetweenColonAndValueExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "valueExpression": Syntax(valueExpression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenValueExpressionAndTrailingComma": unexpectedBetweenValueExpressionAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DifferentiabilityParamSyntax /// A differentiability parameter: either the "self" identifier, a function parameter name, or a function parameter index. @@ -7115,18 +6567,6 @@ public struct DifferentiabilityParamSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DifferentiabilityParamSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeParameter": unexpectedBeforeParameter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "parameter": Syntax(parameter).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenParameterAndTrailingComma": unexpectedBetweenParameterAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DifferentiabilityParamsClauseSyntax /// A clause containing differentiability parameters. @@ -7312,20 +6752,6 @@ public struct DifferentiabilityParamsClauseSyntax: SyntaxProtocol, SyntaxHashabl } } -extension DifferentiabilityParamsClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWrtLabel": unexpectedBeforeWrtLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "wrtLabel": Syntax(wrtLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWrtLabelAndColon": unexpectedBetweenWrtLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndParameters": unexpectedBetweenColonAndParameters.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "parameters": Syntax(parameters).asProtocol(SyntaxProtocol.self), - "unexpectedAfterParameters": unexpectedAfterParameters.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DifferentiabilityParamsSyntax /// The differentiability parameters. @@ -7487,20 +6913,6 @@ public struct DifferentiabilityParamsSyntax: SyntaxProtocol, SyntaxHashable { } } -extension DifferentiabilityParamsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndDiffParams": unexpectedBetweenLeftParenAndDiffParams.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "diffParams": Syntax(diffParams).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDiffParamsAndRightParen": unexpectedBetweenDiffParamsAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DifferentiableAttributeArgumentsSyntax /// The arguments for the `@differentiable` attribute: an optional differentiability kind, an optional differentiability parameter clause, and an optional 'where' clause. @@ -7696,24 +7108,6 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash } } -extension DifferentiableAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeDiffKind": unexpectedBeforeDiffKind.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "diffKind": diffKind.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDiffKindAndDiffKindComma": unexpectedBetweenDiffKindAndDiffKindComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "diffKindComma": diffKindComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDiffKindCommaAndDiffParams": unexpectedBetweenDiffKindCommaAndDiffParams.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "diffParams": diffParams.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDiffParamsAndDiffParamsComma": unexpectedBetweenDiffParamsAndDiffParamsComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "diffParamsComma": diffParamsComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDiffParamsCommaAndWhereClause": unexpectedBetweenDiffParamsCommaAndWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whereClause": whereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterWhereClause": unexpectedAfterWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DocumentationAttributeArgumentSyntax @@ -7924,22 +7318,6 @@ public struct DocumentationAttributeArgumentSyntax: SyntaxProtocol, SyntaxHashab } } -extension DocumentationAttributeArgumentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabel": unexpectedBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": Syntax(label).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelAndColon": unexpectedBetweenLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndValue": unexpectedBetweenColonAndValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "value": Syntax(value).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenValueAndTrailingComma": unexpectedBetweenValueAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DynamicReplacementArgumentsSyntax /// The arguments for the '@_dynamicReplacement' attribute @@ -8081,20 +7459,6 @@ public struct DynamicReplacementArgumentsSyntax: SyntaxProtocol, SyntaxHashable } } -extension DynamicReplacementArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeForLabel": unexpectedBeforeForLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "forLabel": Syntax(forLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenForLabelAndColon": unexpectedBetweenForLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndDeclname": unexpectedBetweenColonAndDeclname.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declname": Syntax(declname).asProtocol(SyntaxProtocol.self), - "unexpectedAfterDeclname": unexpectedAfterDeclname.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - EnumCaseElementSyntax /// An element of an enum case, containing the name of the case and, optionally, either associated values or an assignment to a raw value. @@ -8266,22 +7630,6 @@ public struct EnumCaseElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension EnumCaseElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIdentifier": unexpectedBeforeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndAssociatedValue": unexpectedBetweenIdentifierAndAssociatedValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "associatedValue": associatedValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAssociatedValueAndRawValue": unexpectedBetweenAssociatedValueAndRawValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rawValue": rawValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenRawValueAndTrailingComma": unexpectedBetweenRawValueAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - EnumCaseParameterClauseSyntax @@ -8445,20 +7793,6 @@ public struct EnumCaseParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension EnumCaseParameterClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndParameterList": unexpectedBetweenLeftParenAndParameterList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "parameterList": Syntax(parameterList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenParameterListAndRightParen": unexpectedBetweenParameterListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - EnumCaseParameterSyntax @@ -8727,28 +8061,6 @@ public struct EnumCaseParameterSyntax: SyntaxProtocol, SyntaxHashable { } } -extension EnumCaseParameterSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeModifiers": unexpectedBeforeModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndFirstName": unexpectedBetweenModifiersAndFirstName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "firstName": firstName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenFirstNameAndSecondName": unexpectedBetweenFirstNameAndSecondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "secondName": secondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSecondNameAndColon": unexpectedBetweenSecondNameAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": colon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenColonAndType": unexpectedBetweenColonAndType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypeAndDefaultArgument": unexpectedBetweenTypeAndDefaultArgument.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "defaultArgument": defaultArgument.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDefaultArgumentAndTrailingComma": unexpectedBetweenDefaultArgumentAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ExposeAttributeArgumentsSyntax /// The arguments for the '@_expose' attribute @@ -8890,20 +8202,6 @@ public struct ExposeAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ExposeAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLanguage": unexpectedBeforeLanguage.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "language": Syntax(language).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLanguageAndComma": unexpectedBetweenLanguageAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": comma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCommaAndCxxName": unexpectedBetweenCommaAndCxxName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "cxxName": cxxName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterCxxName": unexpectedAfterCxxName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ExpressionSegmentSyntax @@ -9116,24 +8414,6 @@ public struct ExpressionSegmentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ExpressionSegmentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBackslash": unexpectedBeforeBackslash.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "backslash": Syntax(backslash).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBackslashAndDelimiter": unexpectedBetweenBackslashAndDelimiter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "delimiter": delimiter.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDelimiterAndLeftParen": unexpectedBetweenDelimiterAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndExpressions": unexpectedBetweenLeftParenAndExpressions.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expressions": Syntax(expressions).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionsAndRightParen": unexpectedBetweenExpressionsAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - FunctionEffectSpecifiersSyntax @@ -9249,18 +8529,6 @@ public struct FunctionEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { } } -extension FunctionEffectSpecifiersSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAsyncSpecifier": unexpectedBeforeAsyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "asyncSpecifier": asyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier": unexpectedBetweenAsyncSpecifierAndThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "throwsSpecifier": throwsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterThrowsSpecifier": unexpectedAfterThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - FunctionParameterSyntax @@ -9596,32 +8864,6 @@ public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { } } -extension FunctionParameterSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndModifiers": unexpectedBetweenAttributesAndModifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenModifiersAndFirstName": unexpectedBetweenModifiersAndFirstName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "firstName": Syntax(firstName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFirstNameAndSecondName": unexpectedBetweenFirstNameAndSecondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "secondName": secondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSecondNameAndColon": unexpectedBetweenSecondNameAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndType": unexpectedBetweenColonAndType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypeAndEllipsis": unexpectedBetweenTypeAndEllipsis.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ellipsis": ellipsis.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEllipsisAndDefaultArgument": unexpectedBetweenEllipsisAndDefaultArgument.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "defaultArgument": defaultArgument.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDefaultArgumentAndTrailingComma": unexpectedBetweenDefaultArgumentAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - FunctionSignatureSyntax @@ -9763,20 +9005,6 @@ public struct FunctionSignatureSyntax: SyntaxProtocol, SyntaxHashable { } } -extension FunctionSignatureSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeInput": unexpectedBeforeInput.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "input": Syntax(input).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenInputAndEffectSpecifiers": unexpectedBetweenInputAndEffectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "effectSpecifiers": effectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEffectSpecifiersAndOutput": unexpectedBetweenEffectSpecifiersAndOutput.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "output": output.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterOutput": unexpectedAfterOutput.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - GenericArgumentClauseSyntax @@ -9937,20 +9165,6 @@ public struct GenericArgumentClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension GenericArgumentClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftAngleBracket": unexpectedBeforeLeftAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftAngleBracket": Syntax(leftAngleBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftAngleBracketAndArguments": unexpectedBetweenLeftAngleBracketAndArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "arguments": Syntax(arguments).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentsAndRightAngleBracket": unexpectedBetweenArgumentsAndRightAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightAngleBracket": Syntax(rightAngleBracket).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightAngleBracket": unexpectedAfterRightAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - GenericArgumentSyntax @@ -10066,18 +9280,6 @@ public struct GenericArgumentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension GenericArgumentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeArgumentType": unexpectedBeforeArgumentType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "argumentType": Syntax(argumentType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentTypeAndTrailingComma": unexpectedBetweenArgumentTypeAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - GenericParameterClauseSyntax @@ -10264,22 +9466,6 @@ public struct GenericParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension GenericParameterClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftAngleBracket": unexpectedBeforeLeftAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftAngleBracket": Syntax(leftAngleBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftAngleBracketAndGenericParameterList": unexpectedBetweenLeftAngleBracketAndGenericParameterList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameterList": Syntax(genericParameterList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenGenericParameterListAndGenericWhereClause": unexpectedBetweenGenericParameterListAndGenericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericWhereClause": genericWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenGenericWhereClauseAndRightAngleBracket": unexpectedBetweenGenericWhereClauseAndRightAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightAngleBracket": Syntax(rightAngleBracket).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightAngleBracket": unexpectedAfterRightAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - GenericParameterSyntax @@ -10565,26 +9751,6 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { } } -extension GenericParameterSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAttributes": unexpectedBeforeAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndEach": unexpectedBetweenAttributesAndEach.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "each": each.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEachAndName": unexpectedBetweenEachAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndColon": unexpectedBetweenNameAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": colon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenColonAndInheritedType": unexpectedBetweenColonAndInheritedType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritedType": inheritedType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInheritedTypeAndTrailingComma": unexpectedBetweenInheritedTypeAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - GenericRequirementSyntax @@ -10753,18 +9919,6 @@ public struct GenericRequirementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension GenericRequirementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBody": unexpectedBeforeBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBodyAndTrailingComma": unexpectedBetweenBodyAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - GenericWhereClauseSyntax @@ -10899,18 +10053,6 @@ public struct GenericWhereClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension GenericWhereClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWhereKeyword": unexpectedBeforeWhereKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whereKeyword": Syntax(whereKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWhereKeywordAndRequirementList": unexpectedBetweenWhereKeywordAndRequirementList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "requirementList": Syntax(requirementList).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRequirementList": unexpectedAfterRequirementList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - IfConfigClauseSyntax @@ -11168,20 +10310,6 @@ public struct IfConfigClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension IfConfigClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePoundKeyword": unexpectedBeforePoundKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "poundKeyword": Syntax(poundKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPoundKeywordAndCondition": unexpectedBetweenPoundKeywordAndCondition.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "condition": condition.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenConditionAndElements": unexpectedBetweenConditionAndElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elements": elements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterElements": unexpectedAfterElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ImplementsAttributeArgumentsSyntax /// The arguments for the `@_implements` attribute of the form `Type, methodName(arg1Label:arg2Label:)` @@ -11353,22 +10481,6 @@ public struct ImplementsAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable } } -extension ImplementsAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeType": unexpectedBeforeType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypeAndComma": unexpectedBetweenTypeAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": Syntax(comma).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCommaAndDeclBaseName": unexpectedBetweenCommaAndDeclBaseName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declBaseName": Syntax(declBaseName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDeclBaseNameAndDeclNameArguments": unexpectedBetweenDeclBaseNameAndDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declNameArguments": declNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterDeclNameArguments": unexpectedAfterDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - InheritedTypeSyntax @@ -11484,18 +10596,6 @@ public struct InheritedTypeSyntax: SyntaxProtocol, SyntaxHashable { } } -extension InheritedTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeTypeName": unexpectedBeforeTypeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeName": Syntax(typeName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypeNameAndTrailingComma": unexpectedBetweenTypeNameAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - InitializerClauseSyntax @@ -11611,18 +10711,6 @@ public struct InitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension InitializerClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeEqual": unexpectedBeforeEqual.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "equal": Syntax(equal).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenEqualAndValue": unexpectedBetweenEqualAndValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "value": Syntax(value).asProtocol(SyntaxProtocol.self), - "unexpectedAfterValue": unexpectedAfterValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - KeyPathComponentSyntax @@ -11791,18 +10879,6 @@ public struct KeyPathComponentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension KeyPathComponentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePeriod": unexpectedBeforePeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "period": period.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenPeriodAndComponent": unexpectedBetweenPeriodAndComponent.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "component": Syntax(component).asProtocol(SyntaxProtocol.self), - "unexpectedAfterComponent": unexpectedAfterComponent.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - KeyPathOptionalComponentSyntax @@ -11880,15 +10956,6 @@ public struct KeyPathOptionalComponentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension KeyPathOptionalComponentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeQuestionOrExclamationMark": unexpectedBeforeQuestionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionOrExclamationMark": Syntax(questionOrExclamationMark).asProtocol(SyntaxProtocol.self), - "unexpectedAfterQuestionOrExclamationMark": unexpectedAfterQuestionOrExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - KeyPathPropertyComponentSyntax @@ -12030,20 +11097,6 @@ public struct KeyPathPropertyComponentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension KeyPathPropertyComponentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIdentifier": unexpectedBeforeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIdentifierAndDeclNameArguments": unexpectedBetweenIdentifierAndDeclNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declNameArguments": declNameArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDeclNameArgumentsAndGenericArgumentClause": unexpectedBetweenDeclNameArgumentsAndGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericArgumentClause": genericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterGenericArgumentClause": unexpectedAfterGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - KeyPathSubscriptComponentSyntax @@ -12204,20 +11257,6 @@ public struct KeyPathSubscriptComponentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension KeyPathSubscriptComponentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftBracket": unexpectedBeforeLeftBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBracket": Syntax(leftBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBracketAndArgumentList": unexpectedBetweenLeftBracketAndArgumentList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "argumentList": Syntax(argumentList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentListAndRightBracket": unexpectedBetweenArgumentListAndRightBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBracket": Syntax(rightBracket).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightBracket": unexpectedAfterRightBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - LabeledSpecializeEntrySyntax /// A labeled argument for the `@_specialize` attribute like `exported: true` @@ -12389,22 +11428,6 @@ public struct LabeledSpecializeEntrySyntax: SyntaxProtocol, SyntaxHashable { } } -extension LabeledSpecializeEntrySyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabel": unexpectedBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": Syntax(label).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelAndColon": unexpectedBetweenLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndValue": unexpectedBetweenColonAndValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "value": Syntax(value).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenValueAndTrailingComma": unexpectedBetweenValueAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - LayoutRequirementSyntax @@ -12676,30 +11699,6 @@ public struct LayoutRequirementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension LayoutRequirementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeTypeIdentifier": unexpectedBeforeTypeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeIdentifier": Syntax(typeIdentifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypeIdentifierAndColon": unexpectedBetweenTypeIdentifierAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndLayoutConstraint": unexpectedBetweenColonAndLayoutConstraint.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "layoutConstraint": Syntax(layoutConstraint).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLayoutConstraintAndLeftParen": unexpectedBetweenLayoutConstraintAndLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": leftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLeftParenAndSize": unexpectedBetweenLeftParenAndSize.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "size": size.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSizeAndComma": unexpectedBetweenSizeAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": comma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCommaAndAlignment": unexpectedBetweenCommaAndAlignment.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "alignment": alignment.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAlignmentAndRightParen": unexpectedBetweenAlignmentAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": rightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MatchingPatternConditionSyntax @@ -12867,22 +11866,6 @@ public struct MatchingPatternConditionSyntax: SyntaxProtocol, SyntaxHashable { } } -extension MatchingPatternConditionSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeCaseKeyword": unexpectedBeforeCaseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "caseKeyword": Syntax(caseKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCaseKeywordAndPattern": unexpectedBetweenCaseKeywordAndPattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": Syntax(pattern).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPatternAndTypeAnnotation": unexpectedBetweenPatternAndTypeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeAnnotation": typeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTypeAnnotationAndInitializer": unexpectedBetweenTypeAnnotationAndInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "initializer": Syntax(initializer).asProtocol(SyntaxProtocol.self), - "unexpectedAfterInitializer": unexpectedAfterInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MemberDeclBlockSyntax @@ -13043,20 +12026,6 @@ public struct MemberDeclBlockSyntax: SyntaxProtocol, SyntaxHashable { } } -extension MemberDeclBlockSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftBrace": unexpectedBeforeLeftBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftBrace": Syntax(leftBrace).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftBraceAndMembers": unexpectedBetweenLeftBraceAndMembers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "members": Syntax(members).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMembersAndRightBrace": unexpectedBetweenMembersAndRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightBrace": Syntax(rightBrace).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightBrace": unexpectedAfterRightBrace.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MemberDeclListItemSyntax /// A member declaration of a type consisting of a declaration and an optional semicolon; @@ -13174,18 +12143,6 @@ public struct MemberDeclListItemSyntax: SyntaxProtocol, SyntaxHashable { } } -extension MemberDeclListItemSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeDecl": unexpectedBeforeDecl.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "decl": Syntax(decl).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDeclAndSemicolon": unexpectedBetweenDeclAndSemicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "semicolon": semicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterSemicolon": unexpectedAfterSemicolon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MissingSyntax @@ -13242,13 +12199,6 @@ public struct MissingSyntax: SyntaxProtocol, SyntaxHashable { } } -extension MissingSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpected": unexpected.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - MultipleTrailingClosureElementSyntax @@ -13390,20 +12340,6 @@ public struct MultipleTrailingClosureElementSyntax: SyntaxProtocol, SyntaxHashab } } -extension MultipleTrailingClosureElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabel": unexpectedBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": Syntax(label).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelAndColon": unexpectedBetweenLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndClosure": unexpectedBetweenColonAndClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "closure": Syntax(closure).asProtocol(SyntaxProtocol.self), - "unexpectedAfterClosure": unexpectedAfterClosure.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ObjCSelectorPieceSyntax /// A piece of an Objective-C selector. Either consisting of just an identifier for a nullary selector, an identifier and a colon for a labeled argument or just a colon for an unlabeled argument @@ -13519,18 +12455,6 @@ public struct ObjCSelectorPieceSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ObjCSelectorPieceSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": name.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenNameAndColon": unexpectedBetweenNameAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": colon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterColon": unexpectedAfterColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - OpaqueReturnTypeOfAttributeArgumentsSyntax /// The arguments for the '@_opaqueReturnTypeOf()'. @@ -13674,20 +12598,6 @@ public struct OpaqueReturnTypeOfAttributeArgumentsSyntax: SyntaxProtocol, Syntax } } -extension OpaqueReturnTypeOfAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeMangledName": unexpectedBeforeMangledName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "mangledName": Syntax(mangledName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMangledNameAndComma": unexpectedBetweenMangledNameAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": Syntax(comma).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCommaAndOrdinal": unexpectedBetweenCommaAndOrdinal.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ordinal": Syntax(ordinal).asProtocol(SyntaxProtocol.self), - "unexpectedAfterOrdinal": unexpectedAfterOrdinal.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - OperatorPrecedenceAndTypesSyntax /// A clause to specify precedence group in infix operator declarations, and designated types in any operator declaration. @@ -13850,20 +12760,6 @@ public struct OperatorPrecedenceAndTypesSyntax: SyntaxProtocol, SyntaxHashable { } } -extension OperatorPrecedenceAndTypesSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeColon": unexpectedBeforeColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndPrecedenceGroup": unexpectedBetweenColonAndPrecedenceGroup.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "precedenceGroup": Syntax(precedenceGroup).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPrecedenceGroupAndDesignatedTypes": unexpectedBetweenPrecedenceGroupAndDesignatedTypes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "designatedTypes": Syntax(designatedTypes).asProtocol(SyntaxProtocol.self), - "unexpectedAfterDesignatedTypes": unexpectedAfterDesignatedTypes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - OptionalBindingConditionSyntax @@ -14031,22 +12927,6 @@ public struct OptionalBindingConditionSyntax: SyntaxProtocol, SyntaxHashable { } } -extension OptionalBindingConditionSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBindingKeyword": unexpectedBeforeBindingKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "bindingKeyword": Syntax(bindingKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBindingKeywordAndPattern": unexpectedBetweenBindingKeywordAndPattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": Syntax(pattern).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPatternAndTypeAnnotation": unexpectedBetweenPatternAndTypeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeAnnotation": typeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTypeAnnotationAndInitializer": unexpectedBetweenTypeAnnotationAndInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "initializer": initializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterInitializer": unexpectedAfterInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - OriginallyDefinedInArgumentsSyntax /// The arguments for the '@_originallyDefinedIn' attribute @@ -14259,24 +13139,6 @@ public struct OriginallyDefinedInArgumentsSyntax: SyntaxProtocol, SyntaxHashable } } -extension OriginallyDefinedInArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeModuleLabel": unexpectedBeforeModuleLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "moduleLabel": Syntax(moduleLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenModuleLabelAndColon": unexpectedBetweenModuleLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndModuleName": unexpectedBetweenColonAndModuleName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "moduleName": Syntax(moduleName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenModuleNameAndComma": unexpectedBetweenModuleNameAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": Syntax(comma).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCommaAndPlatforms": unexpectedBetweenCommaAndPlatforms.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "platforms": Syntax(platforms).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPlatforms": unexpectedAfterPlatforms.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ParameterClauseSyntax @@ -14437,20 +13299,6 @@ public struct ParameterClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ParameterClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndParameterList": unexpectedBetweenLeftParenAndParameterList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "parameterList": Syntax(parameterList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenParameterListAndRightParen": unexpectedBetweenParameterListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PatternBindingSyntax @@ -14686,24 +13534,6 @@ public struct PatternBindingSyntax: SyntaxProtocol, SyntaxHashable { } } -extension PatternBindingSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforePattern": unexpectedBeforePattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": Syntax(pattern).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPatternAndTypeAnnotation": unexpectedBetweenPatternAndTypeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeAnnotation": typeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTypeAnnotationAndInitializer": unexpectedBetweenTypeAnnotationAndInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "initializer": initializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInitializerAndAccessor": unexpectedBetweenInitializerAndAccessor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "accessor": accessor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAccessorAndTrailingComma": unexpectedBetweenAccessorAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PoundSourceLocationArgsSyntax @@ -14949,28 +13779,6 @@ public struct PoundSourceLocationArgsSyntax: SyntaxProtocol, SyntaxHashable { } } -extension PoundSourceLocationArgsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeFileArgLabel": unexpectedBeforeFileArgLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "fileArgLabel": Syntax(fileArgLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFileArgLabelAndFileArgColon": unexpectedBetweenFileArgLabelAndFileArgColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "fileArgColon": Syntax(fileArgColon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFileArgColonAndFileName": unexpectedBetweenFileArgColonAndFileName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "fileName": Syntax(fileName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenFileNameAndComma": unexpectedBetweenFileNameAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": Syntax(comma).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCommaAndLineArgLabel": unexpectedBetweenCommaAndLineArgLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "lineArgLabel": Syntax(lineArgLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLineArgLabelAndLineArgColon": unexpectedBetweenLineArgLabelAndLineArgColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "lineArgColon": Syntax(lineArgColon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLineArgColonAndLineNumber": unexpectedBetweenLineArgColonAndLineNumber.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "lineNumber": Syntax(lineNumber).asProtocol(SyntaxProtocol.self), - "unexpectedAfterLineNumber": unexpectedAfterLineNumber.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrecedenceGroupAssignmentSyntax /// Specifies the precedence of an operator when used in an operation that includes optional chaining. @@ -15113,20 +13921,6 @@ public struct PrecedenceGroupAssignmentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension PrecedenceGroupAssignmentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAssignmentKeyword": unexpectedBeforeAssignmentKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "assignmentKeyword": Syntax(assignmentKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAssignmentKeywordAndColon": unexpectedBetweenAssignmentKeywordAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndFlag": unexpectedBetweenColonAndFlag.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "flag": Syntax(flag).asProtocol(SyntaxProtocol.self), - "unexpectedAfterFlag": unexpectedAfterFlag.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrecedenceGroupAssociativitySyntax /// Specifies how a sequence of operators with the same precedence level are grouped together in the absence of grouping parentheses. @@ -15269,20 +14063,6 @@ public struct PrecedenceGroupAssociativitySyntax: SyntaxProtocol, SyntaxHashable } } -extension PrecedenceGroupAssociativitySyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAssociativityKeyword": unexpectedBeforeAssociativityKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "associativityKeyword": Syntax(associativityKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenAssociativityKeywordAndColon": unexpectedBetweenAssociativityKeywordAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndValue": unexpectedBetweenColonAndValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "value": Syntax(value).asProtocol(SyntaxProtocol.self), - "unexpectedAfterValue": unexpectedAfterValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrecedenceGroupNameElementSyntax @@ -15398,18 +14178,6 @@ public struct PrecedenceGroupNameElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension PrecedenceGroupNameElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndTrailingComma": unexpectedBetweenNameAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrecedenceGroupRelationSyntax /// Specify the new precedence group's relation to existing precedence groups. @@ -15572,20 +14340,6 @@ public struct PrecedenceGroupRelationSyntax: SyntaxProtocol, SyntaxHashable { } } -extension PrecedenceGroupRelationSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeHigherThanOrLowerThan": unexpectedBeforeHigherThanOrLowerThan.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "higherThanOrLowerThan": Syntax(higherThanOrLowerThan).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenHigherThanOrLowerThanAndColon": unexpectedBetweenHigherThanOrLowerThanAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndOtherNames": unexpectedBetweenColonAndOtherNames.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "otherNames": Syntax(otherNames).asProtocol(SyntaxProtocol.self), - "unexpectedAfterOtherNames": unexpectedAfterOtherNames.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrimaryAssociatedTypeClauseSyntax @@ -15746,20 +14500,6 @@ public struct PrimaryAssociatedTypeClauseSyntax: SyntaxProtocol, SyntaxHashable } } -extension PrimaryAssociatedTypeClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftAngleBracket": unexpectedBeforeLeftAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftAngleBracket": Syntax(leftAngleBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftAngleBracketAndPrimaryAssociatedTypeList": unexpectedBetweenLeftAngleBracketAndPrimaryAssociatedTypeList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "primaryAssociatedTypeList": Syntax(primaryAssociatedTypeList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPrimaryAssociatedTypeListAndRightAngleBracket": unexpectedBetweenPrimaryAssociatedTypeListAndRightAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightAngleBracket": Syntax(rightAngleBracket).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightAngleBracket": unexpectedAfterRightAngleBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PrimaryAssociatedTypeSyntax @@ -15875,18 +14615,6 @@ public struct PrimaryAssociatedTypeSyntax: SyntaxProtocol, SyntaxHashable { } } -extension PrimaryAssociatedTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndTrailingComma": unexpectedBetweenNameAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - QualifiedDeclNameSyntax /// An optionally qualified function declaration name (e.g. `+(_:_:)`, `A.B.C.foo(_:_:)`). @@ -16096,22 +14824,6 @@ public struct QualifiedDeclNameSyntax: SyntaxProtocol, SyntaxHashable { } } -extension QualifiedDeclNameSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBaseType": unexpectedBeforeBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "baseType": baseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenBaseTypeAndDot": unexpectedBetweenBaseTypeAndDot.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "dot": dot.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenDotAndName": unexpectedBetweenDotAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndArguments": unexpectedBetweenNameAndArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "arguments": arguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterArguments": unexpectedAfterArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ReturnClauseSyntax @@ -16227,18 +14939,6 @@ public struct ReturnClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension ReturnClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeArrow": unexpectedBeforeArrow.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "arrow": Syntax(arrow).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArrowAndReturnType": unexpectedBetweenArrowAndReturnType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "returnType": Syntax(returnType).asProtocol(SyntaxProtocol.self), - "unexpectedAfterReturnType": unexpectedAfterReturnType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SameTypeRequirementSyntax @@ -16380,20 +15080,6 @@ public struct SameTypeRequirementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension SameTypeRequirementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftTypeIdentifier": unexpectedBeforeLeftTypeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftTypeIdentifier": Syntax(leftTypeIdentifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftTypeIdentifierAndEqualityToken": unexpectedBetweenLeftTypeIdentifierAndEqualityToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "equalityToken": Syntax(equalityToken).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenEqualityTokenAndRightTypeIdentifier": unexpectedBetweenEqualityTokenAndRightTypeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightTypeIdentifier": Syntax(rightTypeIdentifier).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightTypeIdentifier": unexpectedAfterRightTypeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SourceFileSyntax @@ -16528,18 +15214,6 @@ public struct SourceFileSyntax: SyntaxProtocol, SyntaxHashable { } } -extension SourceFileSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeStatements": unexpectedBeforeStatements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "statements": Syntax(statements).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenStatementsAndEOFToken": unexpectedBetweenStatementsAndEOFToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "eofToken": Syntax(eofToken).asProtocol(SyntaxProtocol.self), - "unexpectedAfterEOFToken": unexpectedAfterEOFToken.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - StringSegmentSyntax @@ -16617,15 +15291,6 @@ public struct StringSegmentSyntax: SyntaxProtocol, SyntaxHashable { } } -extension StringSegmentSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeContent": unexpectedBeforeContent.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "content": Syntax(content).asProtocol(SyntaxProtocol.self), - "unexpectedAfterContent": unexpectedAfterContent.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - SwitchCaseLabelSyntax @@ -16786,20 +15451,6 @@ public struct SwitchCaseLabelSyntax: SyntaxProtocol, SyntaxHashable { } } -extension SwitchCaseLabelSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeCaseKeyword": unexpectedBeforeCaseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "caseKeyword": Syntax(caseKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCaseKeywordAndCaseItems": unexpectedBetweenCaseKeywordAndCaseItems.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "caseItems": Syntax(caseItems).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenCaseItemsAndColon": unexpectedBetweenCaseItemsAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedAfterColon": unexpectedAfterColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SwitchCaseSyntax @@ -17002,20 +15653,6 @@ public struct SwitchCaseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension SwitchCaseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeUnknownAttr": unexpectedBeforeUnknownAttr.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unknownAttr": unknownAttr.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenUnknownAttrAndLabel": unexpectedBetweenUnknownAttrAndLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": Syntax(label).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelAndStatements": unexpectedBetweenLabelAndStatements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "statements": Syntax(statements).asProtocol(SyntaxProtocol.self), - "unexpectedAfterStatements": unexpectedAfterStatements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SwitchDefaultLabelSyntax @@ -17131,18 +15768,6 @@ public struct SwitchDefaultLabelSyntax: SyntaxProtocol, SyntaxHashable { } } -extension SwitchDefaultLabelSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeDefaultKeyword": unexpectedBeforeDefaultKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "defaultKeyword": Syntax(defaultKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDefaultKeywordAndColon": unexpectedBetweenDefaultKeywordAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedAfterColon": unexpectedAfterColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TargetFunctionEntrySyntax /// A labeled argument for the `@_specialize` attribute with a function decl value like `target: myFunc(_:)` @@ -17314,22 +15939,6 @@ public struct TargetFunctionEntrySyntax: SyntaxProtocol, SyntaxHashable { } } -extension TargetFunctionEntrySyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabel": unexpectedBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": Syntax(label).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelAndColon": unexpectedBetweenLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndDeclname": unexpectedBetweenColonAndDeclname.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "declname": Syntax(declname).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDeclnameAndTrailingComma": unexpectedBetweenDeclnameAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TupleExprElementSyntax @@ -17497,22 +16106,6 @@ public struct TupleExprElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension TupleExprElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabel": unexpectedBeforeLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": label.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLabelAndColon": unexpectedBetweenLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": colon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenColonAndExpression": unexpectedBetweenColonAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndTrailingComma": unexpectedBetweenExpressionAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TuplePatternElementSyntax @@ -17680,22 +16273,6 @@ public struct TuplePatternElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension TuplePatternElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabelName": unexpectedBeforeLabelName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "labelName": labelName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLabelNameAndLabelColon": unexpectedBetweenLabelNameAndLabelColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "labelColon": labelColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenLabelColonAndPattern": unexpectedBetweenLabelColonAndPattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": Syntax(pattern).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPatternAndTrailingComma": unexpectedBetweenPatternAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TupleTypeElementSyntax @@ -17967,30 +16544,6 @@ public struct TupleTypeElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension TupleTypeElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeInOut": unexpectedBeforeInOut.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inOut": inOut.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInOutAndName": unexpectedBetweenInOutAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": name.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenNameAndSecondName": unexpectedBetweenNameAndSecondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "secondName": secondName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSecondNameAndColon": unexpectedBetweenSecondNameAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": colon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenColonAndType": unexpectedBetweenColonAndType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenTypeAndEllipsis": unexpectedBetweenTypeAndEllipsis.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "ellipsis": ellipsis.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEllipsisAndInitializer": unexpectedBetweenEllipsisAndInitializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "initializer": initializer.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenInitializerAndTrailingComma": unexpectedBetweenInitializerAndTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "trailingComma": trailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTrailingComma": unexpectedAfterTrailingComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TypeAnnotationSyntax @@ -18106,18 +16659,6 @@ public struct TypeAnnotationSyntax: SyntaxProtocol, SyntaxHashable { } } -extension TypeAnnotationSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeColon": unexpectedBeforeColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndType": unexpectedBetweenColonAndType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedAfterType": unexpectedAfterType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TypeEffectSpecifiersSyntax @@ -18233,18 +16774,6 @@ public struct TypeEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashable { } } -extension TypeEffectSpecifiersSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeAsyncSpecifier": unexpectedBeforeAsyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "asyncSpecifier": asyncSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier": unexpectedBetweenAsyncSpecifierAndThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "throwsSpecifier": throwsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterThrowsSpecifier": unexpectedAfterThrowsSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TypeInheritanceClauseSyntax @@ -18379,18 +16908,6 @@ public struct TypeInheritanceClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension TypeInheritanceClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeColon": unexpectedBeforeColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndInheritedTypeCollection": unexpectedBetweenColonAndInheritedTypeCollection.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inheritedTypeCollection": Syntax(inheritedTypeCollection).asProtocol(SyntaxProtocol.self), - "unexpectedAfterInheritedTypeCollection": unexpectedAfterInheritedTypeCollection.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TypeInitializerClauseSyntax @@ -18506,18 +17023,6 @@ public struct TypeInitializerClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension TypeInitializerClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeEqual": unexpectedBeforeEqual.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "equal": Syntax(equal).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenEqualAndValue": unexpectedBetweenEqualAndValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "value": Syntax(value).asProtocol(SyntaxProtocol.self), - "unexpectedAfterValue": unexpectedAfterValue.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - UnavailableFromAsyncArgumentsSyntax /// The arguments for the '@_unavailableFromAsync' attribute @@ -18659,20 +17164,6 @@ public struct UnavailableFromAsyncArgumentsSyntax: SyntaxProtocol, SyntaxHashabl } } -extension UnavailableFromAsyncArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeMessageLabel": unexpectedBeforeMessageLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "messageLabel": Syntax(messageLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMessageLabelAndColon": unexpectedBetweenMessageLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndMessage": unexpectedBetweenColonAndMessage.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "message": Syntax(message).asProtocol(SyntaxProtocol.self), - "unexpectedAfterMessage": unexpectedAfterMessage.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - UnderscorePrivateAttributeArgumentsSyntax /// The arguments for the '@_private' attribute @@ -18814,20 +17305,6 @@ public struct UnderscorePrivateAttributeArgumentsSyntax: SyntaxProtocol, SyntaxH } } -extension UnderscorePrivateAttributeArgumentsSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeSourceFileLabel": unexpectedBeforeSourceFileLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "sourceFileLabel": Syntax(sourceFileLabel).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSourceFileLabelAndColon": unexpectedBetweenSourceFileLabelAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndFilename": unexpectedBetweenColonAndFilename.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "filename": Syntax(filename).asProtocol(SyntaxProtocol.self), - "unexpectedAfterFilename": unexpectedAfterFilename.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - VersionTupleSyntax /// A version number of the form major.minor.patch in which the minor and patch part may be omitted. @@ -19026,24 +17503,6 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { } } -extension VersionTupleSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeMajor": unexpectedBeforeMajor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "major": Syntax(major).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenMajorAndMinorPeriod": unexpectedBetweenMajorAndMinorPeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "minorPeriod": minorPeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenMinorPeriodAndMinor": unexpectedBetweenMinorPeriodAndMinor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "minor": minor.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenMinorAndPatchPeriod": unexpectedBetweenMinorAndPatchPeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "patchPeriod": patchPeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenPatchPeriodAndPatch": unexpectedBetweenPatchPeriodAndPatch.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "patch": patch.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterPatch": unexpectedAfterPatch.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - WhereClauseSyntax @@ -19159,18 +17618,6 @@ public struct WhereClauseSyntax: SyntaxProtocol, SyntaxHashable { } } -extension WhereClauseSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWhereKeyword": unexpectedBeforeWhereKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whereKeyword": Syntax(whereKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWhereKeywordAndGuardResult": unexpectedBetweenWhereKeywordAndGuardResult.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "guardResult": Syntax(guardResult).asProtocol(SyntaxProtocol.self), - "unexpectedAfterGuardResult": unexpectedAfterGuardResult.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - YieldExprListElementSyntax @@ -19286,18 +17733,6 @@ public struct YieldExprListElementSyntax: SyntaxProtocol, SyntaxHashable { } } -extension YieldExprListElementSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenExpressionAndComma": unexpectedBetweenExpressionAndComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "comma": comma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterComma": unexpectedAfterComma.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - YieldListSyntax @@ -19457,17 +17892,3 @@ public struct YieldListSyntax: SyntaxProtocol, SyntaxHashable { ]) } } - -extension YieldListSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndElementList": unexpectedBetweenLeftParenAndElementList.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elementList": Syntax(elementList).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenElementListAndRightParen": unexpectedBetweenElementListAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift index 78bdcd1475c..f4190687786 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxPatternNodes.swift @@ -89,15 +89,6 @@ public struct ExpressionPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } -extension ExpressionPatternSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - IdentifierPatternSyntax @@ -175,15 +166,6 @@ public struct IdentifierPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } -extension IdentifierPatternSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIdentifier": unexpectedBeforeIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self), - "unexpectedAfterIdentifier": unexpectedAfterIdentifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - IsTypePatternSyntax @@ -299,18 +281,6 @@ public struct IsTypePatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } -extension IsTypePatternSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeIsKeyword": unexpectedBeforeIsKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "isKeyword": Syntax(isKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenIsKeywordAndType": unexpectedBetweenIsKeywordAndType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "type": Syntax(type).asProtocol(SyntaxProtocol.self), - "unexpectedAfterType": unexpectedAfterType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MissingPatternSyntax @@ -367,13 +337,6 @@ public struct MissingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } -extension MissingPatternSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpected": unexpected.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - TuplePatternSyntax @@ -534,20 +497,6 @@ public struct TuplePatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } -extension TuplePatternSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndElements": unexpectedBetweenLeftParenAndElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elements": Syntax(elements).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenElementsAndRightParen": unexpectedBetweenElementsAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ValueBindingPatternSyntax @@ -663,18 +612,6 @@ public struct ValueBindingPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { } } -extension ValueBindingPatternSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBindingKeyword": unexpectedBeforeBindingKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "bindingKeyword": Syntax(bindingKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBindingKeywordAndValuePattern": unexpectedBetweenBindingKeywordAndValuePattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "valuePattern": Syntax(valuePattern).asProtocol(SyntaxProtocol.self), - "unexpectedAfterValuePattern": unexpectedAfterValuePattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - WildcardPatternSyntax @@ -789,15 +726,3 @@ public struct WildcardPatternSyntax: PatternSyntaxProtocol, SyntaxHashable { ]) } } - -extension WildcardPatternSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWildcard": unexpectedBeforeWildcard.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "wildcard": Syntax(wildcard).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWildcardAndTypeAnnotation": unexpectedBetweenWildcardAndTypeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeAnnotation": typeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterTypeAnnotation": unexpectedAfterTypeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift index e1aac894b6b..7df373ff1b4 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift @@ -127,18 +127,6 @@ public struct BreakStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension BreakStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBreakKeyword": unexpectedBeforeBreakKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "breakKeyword": Syntax(breakKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBreakKeywordAndLabel": unexpectedBetweenBreakKeywordAndLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": label.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterLabel": unexpectedAfterLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ContinueStmtSyntax @@ -254,18 +242,6 @@ public struct ContinueStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension ContinueStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeContinueKeyword": unexpectedBeforeContinueKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "continueKeyword": Syntax(continueKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenContinueKeywordAndLabel": unexpectedBetweenContinueKeywordAndLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "label": label.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterLabel": unexpectedAfterLabel.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DeferStmtSyntax @@ -381,18 +357,6 @@ public struct DeferStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension DeferStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeDeferKeyword": unexpectedBeforeDeferKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "deferKeyword": Syntax(deferKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDeferKeywordAndBody": unexpectedBetweenDeferKeywordAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DoStmtSyntax @@ -553,20 +517,6 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension DoStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeDoKeyword": unexpectedBeforeDoKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "doKeyword": Syntax(doKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenDoKeywordAndBody": unexpectedBetweenDoKeywordAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBodyAndCatchClauses": unexpectedBetweenBodyAndCatchClauses.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "catchClauses": catchClauses.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterCatchClauses": unexpectedAfterCatchClauses.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ExpressionStmtSyntax @@ -644,15 +594,6 @@ public struct ExpressionStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension ExpressionStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeExpression": unexpectedBeforeExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - FallthroughStmtSyntax @@ -730,15 +671,6 @@ public struct FallthroughStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension FallthroughStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeFallthroughKeyword": unexpectedBeforeFallthroughKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "fallthroughKeyword": Syntax(fallthroughKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedAfterFallthroughKeyword": unexpectedAfterFallthroughKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - ForInStmtSyntax @@ -1062,34 +994,6 @@ public struct ForInStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension ForInStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeForKeyword": unexpectedBeforeForKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "forKeyword": Syntax(forKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenForKeywordAndTryKeyword": unexpectedBetweenForKeywordAndTryKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "tryKeyword": tryKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTryKeywordAndAwaitKeyword": unexpectedBetweenTryKeywordAndAwaitKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "awaitKeyword": awaitKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAwaitKeywordAndCaseKeyword": unexpectedBetweenAwaitKeywordAndCaseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "caseKeyword": caseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenCaseKeywordAndPattern": unexpectedBetweenCaseKeywordAndPattern.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "pattern": Syntax(pattern).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPatternAndTypeAnnotation": unexpectedBetweenPatternAndTypeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeAnnotation": typeAnnotation.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenTypeAnnotationAndInKeyword": unexpectedBetweenTypeAnnotationAndInKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "inKeyword": Syntax(inKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenInKeywordAndSequenceExpr": unexpectedBetweenInKeywordAndSequenceExpr.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "sequenceExpr": Syntax(sequenceExpr).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSequenceExprAndWhereClause": unexpectedBetweenSequenceExprAndWhereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whereClause": whereClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenWhereClauseAndBody": unexpectedBetweenWhereClauseAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ForgetStmtSyntax @@ -1205,18 +1109,6 @@ public struct ForgetStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension ForgetStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeForgetKeyword": unexpectedBeforeForgetKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "forgetKeyword": Syntax(forgetKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenForgetKeywordAndExpression": unexpectedBetweenForgetKeywordAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - GuardStmtSyntax @@ -1403,22 +1295,6 @@ public struct GuardStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension GuardStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeGuardKeyword": unexpectedBeforeGuardKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "guardKeyword": Syntax(guardKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenGuardKeywordAndConditions": unexpectedBetweenGuardKeywordAndConditions.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "conditions": Syntax(conditions).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenConditionsAndElseKeyword": unexpectedBetweenConditionsAndElseKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elseKeyword": Syntax(elseKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenElseKeywordAndBody": unexpectedBetweenElseKeywordAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - LabeledStmtSyntax @@ -1560,20 +1436,6 @@ public struct LabeledStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension LabeledStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLabelName": unexpectedBeforeLabelName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "labelName": Syntax(labelName).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelNameAndLabelColon": unexpectedBetweenLabelNameAndLabelColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "labelColon": Syntax(labelColon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLabelColonAndStatement": unexpectedBetweenLabelColonAndStatement.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "statement": Syntax(statement).asProtocol(SyntaxProtocol.self), - "unexpectedAfterStatement": unexpectedAfterStatement.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MissingStmtSyntax @@ -1630,13 +1492,6 @@ public struct MissingStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension MissingStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpected": unexpected.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - RepeatWhileStmtSyntax @@ -1804,22 +1659,6 @@ public struct RepeatWhileStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension RepeatWhileStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeRepeatKeyword": unexpectedBeforeRepeatKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "repeatKeyword": Syntax(repeatKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenRepeatKeywordAndBody": unexpectedBetweenRepeatKeywordAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBodyAndWhileKeyword": unexpectedBetweenBodyAndWhileKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whileKeyword": Syntax(whileKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWhileKeywordAndCondition": unexpectedBetweenWhileKeywordAndCondition.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "condition": Syntax(condition).asProtocol(SyntaxProtocol.self), - "unexpectedAfterCondition": unexpectedAfterCondition.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ReturnStmtSyntax @@ -1966,18 +1805,6 @@ public struct ReturnStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension ReturnStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeReturnKeyword": unexpectedBeforeReturnKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "returnKeyword": Syntax(returnKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenReturnKeywordAndExpression": unexpectedBetweenReturnKeywordAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": expression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ThrowStmtSyntax @@ -2093,18 +1920,6 @@ public struct ThrowStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension ThrowStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeThrowKeyword": unexpectedBeforeThrowKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "throwKeyword": Syntax(throwKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenThrowKeywordAndExpression": unexpectedBetweenThrowKeywordAndExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "expression": Syntax(expression).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExpression": unexpectedAfterExpression.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - WhileStmtSyntax @@ -2265,20 +2080,6 @@ public struct WhileStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } -extension WhileStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWhileKeyword": unexpectedBeforeWhileKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "whileKeyword": Syntax(whileKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWhileKeywordAndConditions": unexpectedBetweenWhileKeywordAndConditions.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "conditions": Syntax(conditions).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenConditionsAndBody": unexpectedBetweenConditionsAndBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "body": Syntax(body).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBody": unexpectedAfterBody.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - YieldStmtSyntax @@ -2435,15 +2236,3 @@ public struct YieldStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { ]) } } - -extension YieldStmtSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeYieldKeyword": unexpectedBeforeYieldKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "yieldKeyword": Syntax(yieldKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenYieldKeywordAndYields": unexpectedBetweenYieldKeywordAndYields.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "yields": Syntax(yields).asProtocol(SyntaxProtocol.self), - "unexpectedAfterYields": unexpectedAfterYields.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift index 49860809262..33337afb667 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift @@ -153,20 +153,6 @@ public struct ArrayTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension ArrayTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftSquareBracket": unexpectedBeforeLeftSquareBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftSquareBracket": Syntax(leftSquareBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftSquareBracketAndElementType": unexpectedBetweenLeftSquareBracketAndElementType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elementType": Syntax(elementType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenElementTypeAndRightSquareBracket": unexpectedBetweenElementTypeAndRightSquareBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightSquareBracket": Syntax(rightSquareBracket).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightSquareBracket": unexpectedAfterRightSquareBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - AttributedTypeSyntax @@ -327,20 +313,6 @@ public struct AttributedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension AttributedTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeSpecifier": unexpectedBeforeSpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "specifier": specifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenSpecifierAndAttributes": unexpectedBetweenSpecifierAndAttributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenAttributesAndBaseType": unexpectedBetweenAttributesAndBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "baseType": Syntax(baseType).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBaseType": unexpectedAfterBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ClassRestrictionTypeSyntax @@ -418,15 +390,6 @@ public struct ClassRestrictionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension ClassRestrictionTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeClassKeyword": unexpectedBeforeClassKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "classKeyword": Syntax(classKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedAfterClassKeyword": unexpectedAfterClassKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - CompositionTypeSyntax @@ -523,15 +486,6 @@ public struct CompositionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension CompositionTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeElements": unexpectedBeforeElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elements": Syntax(elements).asProtocol(SyntaxProtocol.self), - "unexpectedAfterElements": unexpectedAfterElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - ConstrainedSugarTypeSyntax @@ -647,18 +601,6 @@ public struct ConstrainedSugarTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension ConstrainedSugarTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeSomeOrAnySpecifier": unexpectedBeforeSomeOrAnySpecifier.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "someOrAnySpecifier": Syntax(someOrAnySpecifier).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenSomeOrAnySpecifierAndBaseType": unexpectedBetweenSomeOrAnySpecifierAndBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "baseType": Syntax(baseType).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBaseType": unexpectedAfterBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - DictionaryTypeSyntax @@ -852,24 +794,6 @@ public struct DictionaryTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension DictionaryTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftSquareBracket": unexpectedBeforeLeftSquareBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftSquareBracket": Syntax(leftSquareBracket).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftSquareBracketAndKeyType": unexpectedBetweenLeftSquareBracketAndKeyType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "keyType": Syntax(keyType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenKeyTypeAndColon": unexpectedBetweenKeyTypeAndColon.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "colon": Syntax(colon).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenColonAndValueType": unexpectedBetweenColonAndValueType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "valueType": Syntax(valueType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenValueTypeAndRightSquareBracket": unexpectedBetweenValueTypeAndRightSquareBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightSquareBracket": Syntax(rightSquareBracket).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightSquareBracket": unexpectedAfterRightSquareBracket.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - FunctionTypeSyntax @@ -1082,24 +1006,6 @@ public struct FunctionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension FunctionTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndArguments": unexpectedBetweenLeftParenAndArguments.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "arguments": Syntax(arguments).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenArgumentsAndRightParen": unexpectedBetweenArgumentsAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenRightParenAndEffectSpecifiers": unexpectedBetweenRightParenAndEffectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "effectSpecifiers": effectSpecifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedBetweenEffectSpecifiersAndOutput": unexpectedBetweenEffectSpecifiersAndOutput.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "output": Syntax(output).asProtocol(SyntaxProtocol.self), - "unexpectedAfterOutput": unexpectedAfterOutput.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - ImplicitlyUnwrappedOptionalTypeSyntax @@ -1215,18 +1121,6 @@ public struct ImplicitlyUnwrappedOptionalTypeSyntax: TypeSyntaxProtocol, SyntaxH } } -extension ImplicitlyUnwrappedOptionalTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWrappedType": unexpectedBeforeWrappedType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "wrappedType": Syntax(wrappedType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWrappedTypeAndExclamationMark": unexpectedBetweenWrappedTypeAndExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "exclamationMark": Syntax(exclamationMark).asProtocol(SyntaxProtocol.self), - "unexpectedAfterExclamationMark": unexpectedAfterExclamationMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MemberTypeIdentifierSyntax @@ -1394,22 +1288,6 @@ public struct MemberTypeIdentifierSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension MemberTypeIdentifierSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBaseType": unexpectedBeforeBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "baseType": Syntax(baseType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBaseTypeAndPeriod": unexpectedBetweenBaseTypeAndPeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "period": Syntax(period).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPeriodAndName": unexpectedBetweenPeriodAndName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndGenericArgumentClause": unexpectedBetweenNameAndGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericArgumentClause": genericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterGenericArgumentClause": unexpectedAfterGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MetatypeTypeSyntax @@ -1551,20 +1429,6 @@ public struct MetatypeTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension MetatypeTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeBaseType": unexpectedBeforeBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "baseType": Syntax(baseType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenBaseTypeAndPeriod": unexpectedBetweenBaseTypeAndPeriod.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "period": Syntax(period).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenPeriodAndTypeOrProtocol": unexpectedBetweenPeriodAndTypeOrProtocol.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "typeOrProtocol": Syntax(typeOrProtocol).asProtocol(SyntaxProtocol.self), - "unexpectedAfterTypeOrProtocol": unexpectedAfterTypeOrProtocol.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - MissingTypeSyntax @@ -1621,13 +1485,6 @@ public struct MissingTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension MissingTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpected": unexpected.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any ]) - } -} - // MARK: - NamedOpaqueReturnTypeSyntax @@ -1743,18 +1600,6 @@ public struct NamedOpaqueReturnTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension NamedOpaqueReturnTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeGenericParameters": unexpectedBeforeGenericParameters.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericParameters": Syntax(genericParameters).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenGenericParametersAndBaseType": unexpectedBetweenGenericParametersAndBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "baseType": Syntax(baseType).asProtocol(SyntaxProtocol.self), - "unexpectedAfterBaseType": unexpectedAfterBaseType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - OptionalTypeSyntax @@ -1870,18 +1715,6 @@ public struct OptionalTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension OptionalTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeWrappedType": unexpectedBeforeWrappedType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "wrappedType": Syntax(wrappedType).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenWrappedTypeAndQuestionMark": unexpectedBetweenWrappedTypeAndQuestionMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "questionMark": Syntax(questionMark).asProtocol(SyntaxProtocol.self), - "unexpectedAfterQuestionMark": unexpectedAfterQuestionMark.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PackExpansionTypeSyntax @@ -1997,18 +1830,6 @@ public struct PackExpansionTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension PackExpansionTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeRepeatKeyword": unexpectedBeforeRepeatKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "repeatKeyword": Syntax(repeatKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenRepeatKeywordAndPatternType": unexpectedBetweenRepeatKeywordAndPatternType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "patternType": Syntax(patternType).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPatternType": unexpectedAfterPatternType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - PackReferenceTypeSyntax @@ -2124,18 +1945,6 @@ public struct PackReferenceTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension PackReferenceTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeEachKeyword": unexpectedBeforeEachKeyword.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "eachKeyword": Syntax(eachKeyword).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenEachKeywordAndPackType": unexpectedBetweenEachKeywordAndPackType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "packType": Syntax(packType).asProtocol(SyntaxProtocol.self), - "unexpectedAfterPackType": unexpectedAfterPackType.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - SimpleTypeIdentifierSyntax @@ -2251,18 +2060,6 @@ public struct SimpleTypeIdentifierSyntax: TypeSyntaxProtocol, SyntaxHashable { } } -extension SimpleTypeIdentifierSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeName": unexpectedBeforeName.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "name": Syntax(name).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenNameAndGenericArgumentClause": unexpectedBetweenNameAndGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "genericArgumentClause": genericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "unexpectedAfterGenericArgumentClause": unexpectedAfterGenericArgumentClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} - // MARK: - TupleTypeSyntax @@ -2422,17 +2219,3 @@ public struct TupleTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { ]) } } - -extension TupleTypeSyntax: CustomReflectable { - public var customMirror: Mirror { - return Mirror(self, children: [ - "unexpectedBeforeLeftParen": unexpectedBeforeLeftParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "leftParen": Syntax(leftParen).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenLeftParenAndElements": unexpectedBetweenLeftParenAndElements.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "elements": Syntax(elements).asProtocol(SyntaxProtocol.self), - "unexpectedBetweenElementsAndRightParen": unexpectedBetweenElementsAndRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any , - "rightParen": Syntax(rightParen).asProtocol(SyntaxProtocol.self), - "unexpectedAfterRightParen": unexpectedAfterRightParen.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any - ]) - } -} diff --git a/Sources/_SwiftSyntaxTestSupport/Syntax+Assertions.swift b/Sources/_SwiftSyntaxTestSupport/Syntax+Assertions.swift index 637a5b7af21..d5e9c59608e 100644 --- a/Sources/_SwiftSyntaxTestSupport/Syntax+Assertions.swift +++ b/Sources/_SwiftSyntaxTestSupport/Syntax+Assertions.swift @@ -133,7 +133,7 @@ public enum SubtreeError: Error, CustomStringConvertible { case let .invalidMarker(name): return "Could not find marker with name '\(name)'" case let .invalidSubtree(tree, afterUTF8Offset, type): - return "Could not find subtree after UTF8 offset \(afterUTF8Offset) with type \(type) in:\n\(tree.debugDescription(includeChildren: true))" + return "Could not find subtree after UTF8 offset \(afterUTF8Offset) with type \(type) in:\n\(tree.debugDescription)" } } } diff --git a/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift b/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift index 33b21f06860..4ff54b3c39c 100644 --- a/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift +++ b/Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift @@ -79,10 +79,10 @@ extension TreeDifference: CustomDebugStringConvertible { \(message) Full Expected Tree: - \(baseline.root.debugDescription(includeChildren: true, includeTrivia: includeTrivia, converter: expectedConverter, mark: baseline)) + \(baseline.root.debugDescription(includeTrivia: includeTrivia, converter: expectedConverter, mark: baseline)) Full Actual Tree: - \(node.root.debugDescription(includeChildren: true, includeTrivia: includeTrivia, converter: actualConverter, mark: node)) + \(node.root.debugDescription(includeTrivia: includeTrivia, converter: actualConverter, mark: node)) """ } } diff --git a/Sources/swift-parser-cli/swift-parser-cli.swift b/Sources/swift-parser-cli/swift-parser-cli.swift index 1e87ff2f3d0..81e23cb7326 100644 --- a/Sources/swift-parser-cli/swift-parser-cli.swift +++ b/Sources/swift-parser-cli/swift-parser-cli.swift @@ -271,7 +271,7 @@ class PrintTree: ParsableCommand { resultTree = Syntax(tree) } - print(resultTree.debugDescription(includeChildren: true, includeTrivia: includeTrivia)) + print(resultTree.debugDescription(includeTrivia: includeTrivia)) } } } diff --git a/Tests/SwiftParserTest/Assertions.swift b/Tests/SwiftParserTest/Assertions.swift index 6635832feb0..8ea8c54558a 100644 --- a/Tests/SwiftParserTest/Assertions.swift +++ b/Tests/SwiftParserTest/Assertions.swift @@ -565,7 +565,7 @@ func assertParse( Source failed to round-trip. Actual syntax tree: - \(tree.recursiveDescription) + \(tree.debugDescription) """, file: file, line: line diff --git a/Tests/SwiftSyntaxTest/CustomReflectableTests.swift b/Tests/SwiftSyntaxTest/CustomReflectableTests.swift index 7f09bcd2e41..660ea06d923 100644 --- a/Tests/SwiftSyntaxTest/CustomReflectableTests.swift +++ b/Tests/SwiftSyntaxTest/CustomReflectableTests.swift @@ -12,6 +12,7 @@ import XCTest import SwiftSyntax +import _SwiftSyntaxTestSupport private extension String { // This implementation is really slow; to use it outside a test it should be optimized. @@ -118,47 +119,13 @@ public class CustomReflectableTests: XCTestCase { return .init( syntax: tuples, expectedDumped: """ - ▿ TupleExprElementListSyntax - ▿ TupleExprElementSyntax - - unexpectedBeforeLabel: nil - - label: nil - - unexpectedBetweenLabelAndColon: nil - - colon: nil - - unexpectedBetweenColonAndExpression: nil - ▿ expression: IntegerLiteralExprSyntax - - unexpectedBeforeDigits: nil - ▿ digits: integerLiteral("1") - - text: "1" - ▿ leadingTrivia: [] - - pieces: 0 elements - ▿ trailingTrivia: [] - - pieces: 0 elements - ▿ tokenKind: SwiftSyntax.TokenKind.integerLiteral - - integerLiteral: "1" - - unexpectedAfterDigits: nil - - unexpectedBetweenExpressionAndTrailingComma: nil - - trailingComma: nil - - unexpectedAfterTrailingComma: nil - ▿ TupleExprElementSyntax - - unexpectedBeforeLabel: nil - - label: nil - - unexpectedBetweenLabelAndColon: nil - - colon: nil - - unexpectedBetweenColonAndExpression: nil - ▿ expression: IntegerLiteralExprSyntax - - unexpectedBeforeDigits: nil - ▿ digits: integerLiteral("2") - - text: "2" - ▿ leadingTrivia: [] - - pieces: 0 elements - ▿ trailingTrivia: [] - - pieces: 0 elements - ▿ tokenKind: SwiftSyntax.TokenKind.integerLiteral - - integerLiteral: "2" - - unexpectedAfterDigits: nil - - unexpectedBetweenExpressionAndTrailingComma: nil - - trailingComma: nil - - unexpectedAfterTrailingComma: nil + - TupleExprElementListSyntax + ├─TupleExprElementSyntax + │ ╰─IntegerLiteralExprSyntax + │ ╰─integerLiteral("1") + ╰─TupleExprElementSyntax + ╰─IntegerLiteralExprSyntax + ╰─integerLiteral("2") """ ) @@ -177,47 +144,13 @@ public class CustomReflectableTests: XCTestCase { syntax: tuples.reversed(), expectedDumped: """ ▿ Swift.ReversedCollection - ▿ _base: TupleExprElementListSyntax - ▿ TupleExprElementSyntax - - unexpectedBeforeLabel: nil - - label: nil - - unexpectedBetweenLabelAndColon: nil - - colon: nil - - unexpectedBetweenColonAndExpression: nil - ▿ expression: IntegerLiteralExprSyntax - - unexpectedBeforeDigits: nil - ▿ digits: integerLiteral("1") - - text: "1" - ▿ leadingTrivia: [] - - pieces: 0 elements - ▿ trailingTrivia: [] - - pieces: 0 elements - ▿ tokenKind: SwiftSyntax.TokenKind.integerLiteral - - integerLiteral: "1" - - unexpectedAfterDigits: nil - - unexpectedBetweenExpressionAndTrailingComma: nil - - trailingComma: nil - - unexpectedAfterTrailingComma: nil - ▿ TupleExprElementSyntax - - unexpectedBeforeLabel: nil - - label: nil - - unexpectedBetweenLabelAndColon: nil - - colon: nil - - unexpectedBetweenColonAndExpression: nil - ▿ expression: IntegerLiteralExprSyntax - - unexpectedBeforeDigits: nil - ▿ digits: integerLiteral("2") - - text: "2" - ▿ leadingTrivia: [] - - pieces: 0 elements - ▿ trailingTrivia: [] - - pieces: 0 elements - ▿ tokenKind: SwiftSyntax.TokenKind.integerLiteral - - integerLiteral: "2" - - unexpectedAfterDigits: nil - - unexpectedBetweenExpressionAndTrailingComma: nil - - trailingComma: nil - - unexpectedAfterTrailingComma: nil + - _base: TupleExprElementListSyntax + ├─TupleExprElementSyntax + │ ╰─IntegerLiteralExprSyntax + │ ╰─integerLiteral("1") + ╰─TupleExprElementSyntax + ╰─IntegerLiteralExprSyntax + ╰─integerLiteral("2") """ ) From c5ffdb794d569474abb3a611047c54f23e344b0a Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Fri, 14 Apr 2023 08:54:00 -0700 Subject: [PATCH 12/22] Merge pull request #1537 from ahoppen/ahoppen/rawsyntaxtoken-validation Update RawSyntaxValidationFile.swift --- .../swiftsyntax/RawSyntaxValidationFile.swift | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxValidationFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxValidationFile.swift index 93640a7faff..f1ef575e906 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxValidationFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxValidationFile.swift @@ -29,7 +29,7 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead clauses: try IfConfigClauseListSyntax { IfConfigClauseSyntax( poundKeyword: .poundIfKeyword(), - condition: ExprSyntax("DEBUG"), + condition: ExprSyntax("SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"), elements: .statements( try CodeBlockItemListSyntax { DeclSyntax( @@ -114,14 +114,10 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. - #if VALIDATE_TOKEN_CHOICES if raw != nil { return verify(raw, as: RawTokenSyntax.self, tokenChoices: tokenChoices, file: file, line: line) } return nil - #else - return verify(raw, as: RawTokenSyntax?.self) - #endif } """ ) @@ -133,7 +129,6 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. - #if VALIDATE_TOKEN_CHOICES guard let raw = raw else { return .expectedNonNil(expectedKind: RawTokenSyntax.self, file: file, line: line) } @@ -154,9 +149,6 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead } } return ValidationError.tokenMismatch(expectedTokenChoices: tokenChoices, actualKind: tokenView.rawKind, actualText: tokenView.rawText, file: file, line: line) - #else - return verify(raw, as: RawTokenSyntax.self) - #endif } """ From 2fc2f625d2c3df4f02d24844416cb649fd8dfc22 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Fri, 14 Apr 2023 13:40:23 -0700 Subject: [PATCH 13/22] Merge pull request #1523 from ahoppen/ahoppen/readme Minor updates to README --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42cad1bd756..40f6aa2d6fc 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ SwiftSyntax is a set of Swift libraries for parsing, inspecting, generating, and transforming Swift source code. -> Note: SwiftSyntax is still in development, and its API is not guaranteed to -> be stable. It is subject to change without warning. +## Documentation + +You can read SwiftSyntax’s documentation on [swiftpackageindex.com](https://swiftpackageindex.com/apple/swift-syntax/documentation). ## Adding SwiftSyntax as a Dependency @@ -63,6 +64,7 @@ Replace `<#Specify Release tag#>` by the version of SwiftSyntax that you want to | Xcode Release | Swift Release Tag | SwiftSyntax Release Tag | |:-------------------:|:-------------------:|:-------------------------:| +| Xcode 14.3 | swift-5.8-RELEASE | 508.0.0 | | Xcode 14.0 | swift-5.7-RELEASE | 0.50700.1 | | Xcode 13.3 | swift-5.6-RELEASE | 0.50600.1 | | Xcode 13.0 | swift-5.5-RELEASE | 0.50500.0 | From a45c06e4ed38e4f7e8a214e9b81310e728c13582 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Fri, 14 Apr 2023 14:33:39 -0700 Subject: [PATCH 14/22] Merge pull request #1526 from ahoppen/ahoppen/no-debug-guards Don't guard assertions behind `#if DEBUG` --- .../swiftsyntax/SyntaxBaseNodesFile.swift | 46 ++++++++----------- Sources/SwiftSyntax/SyntaxArena.swift | 8 ++-- Sources/SwiftSyntax/SyntaxChildren.swift | 6 +-- .../generated/SyntaxBaseNodes.swift | 20 ++------ 4 files changed, 28 insertions(+), 52 deletions(-) diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift index 23c820d2f5a..0a03bd079c0 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift @@ -137,39 +137,29 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { internal init(_ data: SyntaxData) """ ) { - IfConfigDeclSyntax( - clauses: IfConfigClauseListSyntax { - IfConfigClauseSyntax( - poundKeyword: .poundIfKeyword(), - condition: ExprSyntax("DEBUG"), - elements: .statements( - CodeBlockItemListSyntax { - try! SwitchExprSyntax("switch data.raw.kind") { - SwitchCaseSyntax( - label: .case( - SwitchCaseLabelSyntax { - for childNode in SYNTAX_NODES where childNode.baseKind == node.syntaxKind { - CaseItemSyntax( - pattern: ExpressionPatternSyntax( - expression: ExprSyntax(".\(raw: childNode.swiftSyntaxKind)") - ) - ) - } - } + CodeBlockItemListSyntax { + try! SwitchExprSyntax("switch data.raw.kind") { + SwitchCaseSyntax( + label: .case( + SwitchCaseLabelSyntax { + for childNode in SYNTAX_NODES where childNode.baseKind == node.syntaxKind { + CaseItemSyntax( + pattern: ExpressionPatternSyntax( + expression: ExprSyntax(".\(raw: childNode.swiftSyntaxKind)") ) - ) { - BreakStmtSyntax() - } - - SwitchCaseSyntax("default:") { - ExprSyntax("fatalError(\"Unable to create \(raw: node.name) from \\(data.raw.kind)\")") - } + ) } } ) - ) + ) { + BreakStmtSyntax() + } + + SwitchCaseSyntax("default:") { + ExprSyntax("preconditionFailure(\"Unable to create \(raw: node.name) from \\(data.raw.kind)\")") + } } - ) + } ExprSyntax("self._syntaxNode = Syntax(data)") } diff --git a/Sources/SwiftSyntax/SyntaxArena.swift b/Sources/SwiftSyntax/SyntaxArena.swift index d4130987c5d..2de35078427 100644 --- a/Sources/SwiftSyntax/SyntaxArena.swift +++ b/Sources/SwiftSyntax/SyntaxArena.swift @@ -19,7 +19,7 @@ public class SyntaxArena { /// are retained in `addChild()` and are released in `deinit`. private var childRefs: Set - #if DEBUG + #if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS /// Whether or not this arena has been added to other arenas as a child. /// Used to make sure we don’t introduce retain cycles between arenas. private var hasParent: Bool @@ -32,7 +32,7 @@ public class SyntaxArena { fileprivate init(slabSize: Int) { self.allocator = BumpPtrAllocator(slabSize: slabSize) self.childRefs = [] - #if DEBUG + #if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS self.hasParent = false #endif } @@ -107,7 +107,7 @@ public class SyntaxArena { func addChild(_ otherRef: SyntaxArenaRef) { if SyntaxArenaRef(self) == otherRef { return } - #if DEBUG + #if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS precondition( !self.hasParent, "an arena can't have a new child once it's owned by other arenas" @@ -116,7 +116,7 @@ public class SyntaxArena { if childRefs.insert(otherRef).inserted { otherRef.retain() - #if DEBUG + #if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS // FIXME: This may trigger a data race warning in Thread Sanitizer. // Can we use atomic bool here? otherRef.value.hasParent = true diff --git a/Sources/SwiftSyntax/SyntaxChildren.swift b/Sources/SwiftSyntax/SyntaxChildren.swift index bc3d086b84f..6aa85bf9f3b 100644 --- a/Sources/SwiftSyntax/SyntaxChildren.swift +++ b/Sources/SwiftSyntax/SyntaxChildren.swift @@ -370,13 +370,9 @@ struct NonNilRawSyntaxChildren: BidirectionalCollection { { return reversedIndex } - #if DEBUG // Reversing any further would result in undefined behaviour of // index(before:) - if reversedIndex == children.startIndex { - fatalError("presentIndex(before:) must not be called if there is no " + "present index before the given one") - } - #endif + precondition(reversedIndex != children.startIndex, "presentIndex(before:) must not be called if there is no " + "present index before the given one") reversedIndex = children.index(before: reversedIndex) } } diff --git a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift index 2f639be5907..d7e69654697 100644 --- a/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift +++ b/Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift @@ -82,14 +82,12 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable { /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour /// is undefined. internal init(_ data: SyntaxData) { - #if DEBUG switch data.raw.kind { case .accessorDecl, .actorDecl, .associatedtypeDecl, .classDecl, .deinitializerDecl, .editorPlaceholderDecl, .enumCaseDecl, .enumDecl, .extensionDecl, .functionDecl, .ifConfigDecl, .importDecl, .initializerDecl, .macroDecl, .macroExpansionDecl, .missingDecl, .operatorDecl, .poundSourceLocation, .precedenceGroupDecl, .protocolDecl, .structDecl, .subscriptDecl, .typealiasDecl, .variableDecl: break default: - fatalError("Unable to create DeclSyntax from \(data.raw.kind)") + preconditionFailure("Unable to create DeclSyntax from \(data.raw.kind)") } - #endif self._syntaxNode = Syntax(data) } @@ -219,14 +217,12 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable { /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour /// is undefined. internal init(_ data: SyntaxData) { - #if DEBUG switch data.raw.kind { case .arrayExpr, .arrowExpr, .asExpr, .assignmentExpr, .awaitExpr, .binaryOperatorExpr, .booleanLiteralExpr, .borrowExpr, .closureExpr, .dictionaryExpr, .discardAssignmentExpr, .editorPlaceholderExpr, .floatLiteralExpr, .forcedValueExpr, .functionCallExpr, .identifierExpr, .ifExpr, .inOutExpr, .infixOperatorExpr, .integerLiteralExpr, .isExpr, .keyPathExpr, .macroExpansionExpr, .memberAccessExpr, .missingExpr, .moveExpr, .nilLiteralExpr, .optionalChainingExpr, .packElementExpr, .packExpansionExpr, .postfixIfConfigExpr, .postfixUnaryExpr, .prefixOperatorExpr, .regexLiteralExpr, .sequenceExpr, .specializeExpr, .stringLiteralExpr, .subscriptExpr, .superRefExpr, .switchExpr, .ternaryExpr, .tryExpr, .tupleExpr, .typeExpr, .unresolvedAsExpr, .unresolvedIsExpr, .unresolvedPatternExpr, .unresolvedTernaryExpr: break default: - fatalError("Unable to create ExprSyntax from \(data.raw.kind)") + preconditionFailure("Unable to create ExprSyntax from \(data.raw.kind)") } - #endif self._syntaxNode = Syntax(data) } @@ -380,14 +376,12 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable { /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour /// is undefined. internal init(_ data: SyntaxData) { - #if DEBUG switch data.raw.kind { case .expressionPattern, .identifierPattern, .isTypePattern, .missingPattern, .tuplePattern, .valueBindingPattern, .wildcardPattern: break default: - fatalError("Unable to create PatternSyntax from \(data.raw.kind)") + preconditionFailure("Unable to create PatternSyntax from \(data.raw.kind)") } - #endif self._syntaxNode = Syntax(data) } @@ -500,14 +494,12 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable { /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour /// is undefined. internal init(_ data: SyntaxData) { - #if DEBUG switch data.raw.kind { case .breakStmt, .continueStmt, .deferStmt, .doStmt, .expressionStmt, .fallthroughStmt, .forInStmt, .forgetStmt, .guardStmt, .labeledStmt, .missingStmt, .repeatWhileStmt, .returnStmt, .throwStmt, .whileStmt, .yieldStmt: break default: - fatalError("Unable to create StmtSyntax from \(data.raw.kind)") + preconditionFailure("Unable to create StmtSyntax from \(data.raw.kind)") } - #endif self._syntaxNode = Syntax(data) } @@ -629,14 +621,12 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable { /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour /// is undefined. internal init(_ data: SyntaxData) { - #if DEBUG switch data.raw.kind { case .arrayType, .attributedType, .classRestrictionType, .compositionType, .constrainedSugarType, .dictionaryType, .functionType, .implicitlyUnwrappedOptionalType, .memberTypeIdentifier, .metatypeType, .missingType, .namedOpaqueReturnType, .optionalType, .packExpansionType, .packReferenceType, .simpleTypeIdentifier, .tupleType: break default: - fatalError("Unable to create TypeSyntax from \(data.raw.kind)") + preconditionFailure("Unable to create TypeSyntax from \(data.raw.kind)") } - #endif self._syntaxNode = Syntax(data) } From b011378bbc8e14191d7fd78037d93c93f0e791d0 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Sat, 15 Apr 2023 08:00:36 -0700 Subject: [PATCH 15/22] Merge pull request #1524 from ahoppen/ahoppen/memberblock Rename children that refer to a `MemberDeclBlock` from `members` to `memberBlock` --- .../Sources/SyntaxSupport/DeclNodes.swift | 12 +- .../Sources/SyntaxSupport/Traits.swift | 2 +- Sources/SwiftParser/Declarations.swift | 4 +- Sources/SwiftParser/Nominals.swift | 88 +++++++-- .../PresenceUtils.swift | 2 +- .../SwiftSyntax/generated/SyntaxTraits.swift | 2 +- .../generated/raw/RawSyntaxNodes.swift | 108 +++++------ .../syntaxNodes/SyntaxDeclNodes.swift | 180 +++++++++--------- .../SyntaxNodeWithBody.swift | 4 +- .../generated/BuildableNodes.swift | 72 +++---- Sources/SwiftSyntaxMacros/MacroSystem.swift | 8 +- Tests/SwiftParserTest/DeclarationTests.swift | 4 +- .../translated/HashbangLibraryTests.swift | 2 +- .../ExtensionDeclTests.swift | 2 +- .../SourceFileTests.swift | 2 +- .../SwiftSyntaxBuilderTest/StructTests.swift | 4 +- .../ParseFileTests.swift | 2 +- Tests/SwiftSyntaxTest/RawSyntaxTests.swift | 8 +- .../SwiftSyntaxTest/SyntaxCreationTests.swift | 16 +- Tests/SwiftSyntaxTest/SyntaxTests.swift | 6 +- 20 files changed, 294 insertions(+), 234 deletions(-) diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift index 0485af31e50..e0c169e390a 100644 --- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift @@ -196,7 +196,7 @@ public let DECL_NODES: [Node] = [ isOptional: true ), Child( - name: "Members", + name: "MemberBlock", kind: .node(kind: "MemberDeclBlock") ), ] @@ -312,7 +312,7 @@ public let DECL_NODES: [Node] = [ isOptional: true ), Child( - name: "Members", + name: "MemberBlock", kind: .node(kind: "MemberDeclBlock") ), ] @@ -654,7 +654,7 @@ public let DECL_NODES: [Node] = [ isOptional: true ), Child( - name: "Members", + name: "MemberBlock", kind: .node(kind: "MemberDeclBlock"), description: "The cases and other members of this enum." ), @@ -709,7 +709,7 @@ public let DECL_NODES: [Node] = [ isOptional: true ), Child( - name: "Members", + name: "MemberBlock", kind: .node(kind: "MemberDeclBlock") ), ] @@ -1714,7 +1714,7 @@ public let DECL_NODES: [Node] = [ isOptional: true ), Child( - name: "Members", + name: "MemberBlock", kind: .node(kind: "MemberDeclBlock") ), ] @@ -1816,7 +1816,7 @@ public let DECL_NODES: [Node] = [ isOptional: true ), Child( - name: "Members", + name: "MemberBlock", kind: .node(kind: "MemberDeclBlock") ), ] diff --git a/CodeGeneration/Sources/SyntaxSupport/Traits.swift b/CodeGeneration/Sources/SyntaxSupport/Traits.swift index ba772c5af47..62a097b7442 100644 --- a/CodeGeneration/Sources/SyntaxSupport/Traits.swift +++ b/CodeGeneration/Sources/SyntaxSupport/Traits.swift @@ -41,7 +41,7 @@ public let TRAITS: [Trait] = [ children: [ Child(name: "Attributes", kind: .node(kind: "AttributeList"), isOptional: true), Child(name: "Modifiers", kind: .node(kind: "ModifierList"), isOptional: true), - Child(name: "Members", kind: .node(kind: "MemberDeclBlock")), + Child(name: "MemberBlock", kind: .node(kind: "MemberDeclBlock")), ] ), Trait( diff --git a/Sources/SwiftParser/Declarations.swift b/Sources/SwiftParser/Declarations.swift index 466f83f0a92..d2fe86f973e 100644 --- a/Sources/SwiftParser/Declarations.swift +++ b/Sources/SwiftParser/Declarations.swift @@ -419,7 +419,7 @@ extension Parser { } else { whereClause = nil } - let members = self.parseMemberDeclList(introducer: extensionKeyword) + let memberBlock = self.parseMemberDeclList(introducer: extensionKeyword) return RawExtensionDeclSyntax( attributes: attrs.attributes, modifiers: attrs.modifiers, @@ -428,7 +428,7 @@ extension Parser { extendedType: type, inheritanceClause: inheritance, genericWhereClause: whereClause, - members: members, + memberBlock: memberBlock, arena: self.arena ) } diff --git a/Sources/SwiftParser/Nominals.swift b/Sources/SwiftParser/Nominals.swift index 8f7cc4952f9..636b1c1fe25 100644 --- a/Sources/SwiftParser/Nominals.swift +++ b/Sources/SwiftParser/Nominals.swift @@ -25,7 +25,7 @@ protocol NominalTypeDeclarationTrait { primaryOrGenerics: PrimaryOrGenerics?, inheritanceClause: RawTypeInheritanceClauseSyntax?, genericWhereClause: RawGenericWhereClauseSyntax?, - members: RawMemberDeclBlockSyntax, + memberBlock: RawMemberDeclBlockSyntax, arena: __shared SyntaxArena ) @@ -43,10 +43,22 @@ extension RawProtocolDeclSyntax: NominalTypeDeclarationTrait { primaryOrGenerics: RawPrimaryAssociatedTypeClauseSyntax?, inheritanceClause: RawTypeInheritanceClauseSyntax?, genericWhereClause: RawGenericWhereClauseSyntax?, - members: RawMemberDeclBlockSyntax, + memberBlock: RawMemberDeclBlockSyntax, arena: __shared SyntaxArena ) { - self.init(attributes: attributes, modifiers: modifiers, unexpectedBeforeIntroducerKeyword, protocolKeyword: introducerKeyword, unexpectedBeforeIdentifier, identifier: identifier, primaryAssociatedTypeClause: primaryOrGenerics, inheritanceClause: inheritanceClause, genericWhereClause: genericWhereClause, members: members, arena: arena) + self.init( + attributes: attributes, + modifiers: modifiers, + unexpectedBeforeIntroducerKeyword, + protocolKeyword: introducerKeyword, + unexpectedBeforeIdentifier, + identifier: identifier, + primaryAssociatedTypeClause: primaryOrGenerics, + inheritanceClause: inheritanceClause, + genericWhereClause: genericWhereClause, + memberBlock: memberBlock, + arena: arena + ) } static func parsePrimaryOrGenerics(_ parser: inout Parser) -> RawPrimaryAssociatedTypeClauseSyntax? { @@ -65,10 +77,22 @@ extension RawClassDeclSyntax: NominalTypeDeclarationTrait { primaryOrGenerics: RawGenericParameterClauseSyntax?, inheritanceClause: RawTypeInheritanceClauseSyntax?, genericWhereClause: RawGenericWhereClauseSyntax?, - members: RawMemberDeclBlockSyntax, + memberBlock: RawMemberDeclBlockSyntax, arena: __shared SyntaxArena ) { - self.init(attributes: attributes, modifiers: modifiers, unexpectedBeforeIntroducerKeyword, classKeyword: introducerKeyword, unexpectedBeforeIdentifier, identifier: identifier, genericParameterClause: primaryOrGenerics, inheritanceClause: inheritanceClause, genericWhereClause: genericWhereClause, members: members, arena: arena) + self.init( + attributes: attributes, + modifiers: modifiers, + unexpectedBeforeIntroducerKeyword, + classKeyword: introducerKeyword, + unexpectedBeforeIdentifier, + identifier: identifier, + genericParameterClause: primaryOrGenerics, + inheritanceClause: inheritanceClause, + genericWhereClause: genericWhereClause, + memberBlock: memberBlock, + arena: arena + ) } static func parsePrimaryOrGenerics(_ parser: inout Parser) -> RawGenericParameterClauseSyntax? { @@ -87,10 +111,22 @@ extension RawActorDeclSyntax: NominalTypeDeclarationTrait { primaryOrGenerics: RawGenericParameterClauseSyntax?, inheritanceClause: RawTypeInheritanceClauseSyntax?, genericWhereClause: RawGenericWhereClauseSyntax?, - members: RawMemberDeclBlockSyntax, + memberBlock: RawMemberDeclBlockSyntax, arena: __shared SyntaxArena ) { - self.init(attributes: attributes, modifiers: modifiers, unexpectedBeforeIntroducerKeyword, actorKeyword: introducerKeyword, unexpectedBeforeIdentifier, identifier: identifier, genericParameterClause: primaryOrGenerics, inheritanceClause: inheritanceClause, genericWhereClause: genericWhereClause, members: members, arena: arena) + self.init( + attributes: attributes, + modifiers: modifiers, + unexpectedBeforeIntroducerKeyword, + actorKeyword: introducerKeyword, + unexpectedBeforeIdentifier, + identifier: identifier, + genericParameterClause: primaryOrGenerics, + inheritanceClause: inheritanceClause, + genericWhereClause: genericWhereClause, + memberBlock: memberBlock, + arena: arena + ) } static func parsePrimaryOrGenerics(_ parser: inout Parser) -> RawGenericParameterClauseSyntax? { @@ -109,10 +145,22 @@ extension RawStructDeclSyntax: NominalTypeDeclarationTrait { primaryOrGenerics: RawGenericParameterClauseSyntax?, inheritanceClause: RawTypeInheritanceClauseSyntax?, genericWhereClause: RawGenericWhereClauseSyntax?, - members: RawMemberDeclBlockSyntax, + memberBlock: RawMemberDeclBlockSyntax, arena: __shared SyntaxArena ) { - self.init(attributes: attributes, modifiers: modifiers, unexpectedBeforeIntroducerKeyword, structKeyword: introducerKeyword, unexpectedBeforeIdentifier, identifier: identifier, genericParameterClause: primaryOrGenerics, inheritanceClause: inheritanceClause, genericWhereClause: genericWhereClause, members: members, arena: arena) + self.init( + attributes: attributes, + modifiers: modifiers, + unexpectedBeforeIntroducerKeyword, + structKeyword: introducerKeyword, + unexpectedBeforeIdentifier, + identifier: identifier, + genericParameterClause: primaryOrGenerics, + inheritanceClause: inheritanceClause, + genericWhereClause: genericWhereClause, + memberBlock: memberBlock, + arena: arena + ) } static func parsePrimaryOrGenerics(_ parser: inout Parser) -> RawGenericParameterClauseSyntax? { @@ -131,10 +179,22 @@ extension RawEnumDeclSyntax: NominalTypeDeclarationTrait { primaryOrGenerics: RawGenericParameterClauseSyntax?, inheritanceClause: RawTypeInheritanceClauseSyntax?, genericWhereClause: RawGenericWhereClauseSyntax?, - members: RawMemberDeclBlockSyntax, + memberBlock: RawMemberDeclBlockSyntax, arena: __shared SyntaxArena ) { - self.init(attributes: attributes, modifiers: modifiers, unexpectedBeforeIntroducerKeyword, enumKeyword: introducerKeyword, unexpectedBeforeIdentifier, identifier: identifier, genericParameters: primaryOrGenerics, inheritanceClause: inheritanceClause, genericWhereClause: genericWhereClause, members: members, arena: arena) + self.init( + attributes: attributes, + modifiers: modifiers, + unexpectedBeforeIntroducerKeyword, + enumKeyword: introducerKeyword, + unexpectedBeforeIdentifier, + identifier: identifier, + genericParameters: primaryOrGenerics, + inheritanceClause: inheritanceClause, + genericWhereClause: genericWhereClause, + memberBlock: memberBlock, + arena: arena + ) } static func parsePrimaryOrGenerics(_ parser: inout Parser) -> RawGenericParameterClauseSyntax? { @@ -162,7 +222,7 @@ extension Parser { primaryOrGenerics: nil, inheritanceClause: nil, genericWhereClause: nil, - members: RawMemberDeclBlockSyntax( + memberBlock: RawMemberDeclBlockSyntax( leftBrace: RawTokenSyntax(missing: .leftBrace, arena: self.arena), members: RawMemberDeclListSyntax(elements: [], arena: self.arena), rightBrace: RawTokenSyntax(missing: .rightBrace, arena: self.arena), @@ -194,7 +254,7 @@ extension Parser { whereClause = nil } - let members = self.parseMemberDeclList(introducer: introducerKeyword) + let memberBlock = self.parseMemberDeclList(introducer: introducerKeyword) return T.init( attributes: attrs.attributes, modifiers: attrs.modifiers, @@ -205,7 +265,7 @@ extension Parser { primaryOrGenerics: primaryOrGenerics, inheritanceClause: inheritance, genericWhereClause: whereClause, - members: members, + memberBlock: memberBlock, arena: self.arena ) } diff --git a/Sources/SwiftParserDiagnostics/PresenceUtils.swift b/Sources/SwiftParserDiagnostics/PresenceUtils.swift index e52c0d766c3..fdc4a711990 100644 --- a/Sources/SwiftParserDiagnostics/PresenceUtils.swift +++ b/Sources/SwiftParserDiagnostics/PresenceUtils.swift @@ -78,7 +78,7 @@ class PresentMaker: SyntaxRewriter { modifiers: node.modifiers, structKeyword: .keyword(.struct, presence: .missing), identifier: .identifier("<#declaration#>", leadingTrivia: leadingTriviaBeforePlaceholder), - members: MemberDeclBlockSyntax( + memberBlock: MemberDeclBlockSyntax( leftBrace: .leftBraceToken(presence: .missing), members: MemberDeclListSyntax([]), rightBrace: .rightBraceToken(presence: .missing) diff --git a/Sources/SwiftSyntax/generated/SyntaxTraits.swift b/Sources/SwiftSyntax/generated/SyntaxTraits.swift index 1586f0b6fc6..9dcf92b57e1 100644 --- a/Sources/SwiftSyntax/generated/SyntaxTraits.swift +++ b/Sources/SwiftSyntax/generated/SyntaxTraits.swift @@ -102,7 +102,7 @@ public protocol DeclGroupSyntax: SyntaxProtocol { set } - var members: MemberDeclBlockSyntax { + var memberBlock: MemberDeclBlockSyntax { get set } diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift index af768167810..76b85615604 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift @@ -593,9 +593,9 @@ public struct RawActorDeclSyntax: RawDeclSyntaxNodeProtocol { inheritanceClause: RawTypeInheritanceClauseSyntax?, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: RawUnexpectedNodesSyntax? = nil, genericWhereClause: RawGenericWhereClauseSyntax?, - _ unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? = nil, - members: RawMemberDeclBlockSyntax, - _ unexpectedAfterMembers: RawUnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? = nil, + memberBlock: RawMemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { let raw = RawSyntax.makeLayout( @@ -615,9 +615,9 @@ public struct RawActorDeclSyntax: RawDeclSyntaxNodeProtocol { layout[11] = inheritanceClause?.raw layout[12] = unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw layout[13] = genericWhereClause?.raw - layout[14] = unexpectedBetweenGenericWhereClauseAndMembers?.raw - layout[15] = members.raw - layout[16] = unexpectedAfterMembers?.raw + layout[14] = unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw + layout[15] = memberBlock.raw + layout[16] = unexpectedAfterMemberBlock?.raw } self.init(unchecked: raw) } @@ -678,15 +678,15 @@ public struct RawActorDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[13].map(RawGenericWhereClauseSyntax.init(raw:)) } - public var unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[14].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var members: RawMemberDeclBlockSyntax { + public var memberBlock: RawMemberDeclBlockSyntax { layoutView.children[15].map(RawMemberDeclBlockSyntax.init(raw:))! } - public var unexpectedAfterMembers: RawUnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[16].map(RawUnexpectedNodesSyntax.init(raw:)) } } @@ -3250,9 +3250,9 @@ public struct RawClassDeclSyntax: RawDeclSyntaxNodeProtocol { inheritanceClause: RawTypeInheritanceClauseSyntax?, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: RawUnexpectedNodesSyntax? = nil, genericWhereClause: RawGenericWhereClauseSyntax?, - _ unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? = nil, - members: RawMemberDeclBlockSyntax, - _ unexpectedAfterMembers: RawUnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? = nil, + memberBlock: RawMemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { let raw = RawSyntax.makeLayout( @@ -3272,9 +3272,9 @@ public struct RawClassDeclSyntax: RawDeclSyntaxNodeProtocol { layout[11] = inheritanceClause?.raw layout[12] = unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw layout[13] = genericWhereClause?.raw - layout[14] = unexpectedBetweenGenericWhereClauseAndMembers?.raw - layout[15] = members.raw - layout[16] = unexpectedAfterMembers?.raw + layout[14] = unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw + layout[15] = memberBlock.raw + layout[16] = unexpectedAfterMemberBlock?.raw } self.init(unchecked: raw) } @@ -3335,15 +3335,15 @@ public struct RawClassDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[13].map(RawGenericWhereClauseSyntax.init(raw:)) } - public var unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[14].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var members: RawMemberDeclBlockSyntax { + public var memberBlock: RawMemberDeclBlockSyntax { layoutView.children[15].map(RawMemberDeclBlockSyntax.init(raw:))! } - public var unexpectedAfterMembers: RawUnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[16].map(RawUnexpectedNodesSyntax.init(raw:)) } } @@ -8136,9 +8136,9 @@ public struct RawEnumDeclSyntax: RawDeclSyntaxNodeProtocol { inheritanceClause: RawTypeInheritanceClauseSyntax?, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: RawUnexpectedNodesSyntax? = nil, genericWhereClause: RawGenericWhereClauseSyntax?, - _ unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? = nil, - members: RawMemberDeclBlockSyntax, - _ unexpectedAfterMembers: RawUnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? = nil, + memberBlock: RawMemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { let raw = RawSyntax.makeLayout( @@ -8158,9 +8158,9 @@ public struct RawEnumDeclSyntax: RawDeclSyntaxNodeProtocol { layout[11] = inheritanceClause?.raw layout[12] = unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw layout[13] = genericWhereClause?.raw - layout[14] = unexpectedBetweenGenericWhereClauseAndMembers?.raw - layout[15] = members.raw - layout[16] = unexpectedAfterMembers?.raw + layout[14] = unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw + layout[15] = memberBlock.raw + layout[16] = unexpectedAfterMemberBlock?.raw } self.init(unchecked: raw) } @@ -8221,15 +8221,15 @@ public struct RawEnumDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[13].map(RawGenericWhereClauseSyntax.init(raw:)) } - public var unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[14].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var members: RawMemberDeclBlockSyntax { + public var memberBlock: RawMemberDeclBlockSyntax { layoutView.children[15].map(RawMemberDeclBlockSyntax.init(raw:))! } - public var unexpectedAfterMembers: RawUnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[16].map(RawUnexpectedNodesSyntax.init(raw:)) } } @@ -8669,9 +8669,9 @@ public struct RawExtensionDeclSyntax: RawDeclSyntaxNodeProtocol { inheritanceClause: RawTypeInheritanceClauseSyntax?, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: RawUnexpectedNodesSyntax? = nil, genericWhereClause: RawGenericWhereClauseSyntax?, - _ unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? = nil, - members: RawMemberDeclBlockSyntax, - _ unexpectedAfterMembers: RawUnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? = nil, + memberBlock: RawMemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { let raw = RawSyntax.makeLayout( @@ -8689,9 +8689,9 @@ public struct RawExtensionDeclSyntax: RawDeclSyntaxNodeProtocol { layout[9] = inheritanceClause?.raw layout[10] = unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw layout[11] = genericWhereClause?.raw - layout[12] = unexpectedBetweenGenericWhereClauseAndMembers?.raw - layout[13] = members.raw - layout[14] = unexpectedAfterMembers?.raw + layout[12] = unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw + layout[13] = memberBlock.raw + layout[14] = unexpectedAfterMemberBlock?.raw } self.init(unchecked: raw) } @@ -8744,15 +8744,15 @@ public struct RawExtensionDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[11].map(RawGenericWhereClauseSyntax.init(raw:)) } - public var unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[12].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var members: RawMemberDeclBlockSyntax { + public var memberBlock: RawMemberDeclBlockSyntax { layoutView.children[13].map(RawMemberDeclBlockSyntax.init(raw:))! } - public var unexpectedAfterMembers: RawUnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[14].map(RawUnexpectedNodesSyntax.init(raw:)) } } @@ -17189,9 +17189,9 @@ public struct RawProtocolDeclSyntax: RawDeclSyntaxNodeProtocol { inheritanceClause: RawTypeInheritanceClauseSyntax?, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: RawUnexpectedNodesSyntax? = nil, genericWhereClause: RawGenericWhereClauseSyntax?, - _ unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? = nil, - members: RawMemberDeclBlockSyntax, - _ unexpectedAfterMembers: RawUnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? = nil, + memberBlock: RawMemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { let raw = RawSyntax.makeLayout( @@ -17211,9 +17211,9 @@ public struct RawProtocolDeclSyntax: RawDeclSyntaxNodeProtocol { layout[11] = inheritanceClause?.raw layout[12] = unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw layout[13] = genericWhereClause?.raw - layout[14] = unexpectedBetweenGenericWhereClauseAndMembers?.raw - layout[15] = members.raw - layout[16] = unexpectedAfterMembers?.raw + layout[14] = unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw + layout[15] = memberBlock.raw + layout[16] = unexpectedAfterMemberBlock?.raw } self.init(unchecked: raw) } @@ -17274,15 +17274,15 @@ public struct RawProtocolDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[13].map(RawGenericWhereClauseSyntax.init(raw:)) } - public var unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[14].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var members: RawMemberDeclBlockSyntax { + public var memberBlock: RawMemberDeclBlockSyntax { layoutView.children[15].map(RawMemberDeclBlockSyntax.init(raw:))! } - public var unexpectedAfterMembers: RawUnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[16].map(RawUnexpectedNodesSyntax.init(raw:)) } } @@ -18494,9 +18494,9 @@ public struct RawStructDeclSyntax: RawDeclSyntaxNodeProtocol { inheritanceClause: RawTypeInheritanceClauseSyntax?, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: RawUnexpectedNodesSyntax? = nil, genericWhereClause: RawGenericWhereClauseSyntax?, - _ unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? = nil, - members: RawMemberDeclBlockSyntax, - _ unexpectedAfterMembers: RawUnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? = nil, + memberBlock: RawMemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { let raw = RawSyntax.makeLayout( @@ -18516,9 +18516,9 @@ public struct RawStructDeclSyntax: RawDeclSyntaxNodeProtocol { layout[11] = inheritanceClause?.raw layout[12] = unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw layout[13] = genericWhereClause?.raw - layout[14] = unexpectedBetweenGenericWhereClauseAndMembers?.raw - layout[15] = members.raw - layout[16] = unexpectedAfterMembers?.raw + layout[14] = unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw + layout[15] = memberBlock.raw + layout[16] = unexpectedAfterMemberBlock?.raw } self.init(unchecked: raw) } @@ -18579,15 +18579,15 @@ public struct RawStructDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[13].map(RawGenericWhereClauseSyntax.init(raw:)) } - public var unexpectedBetweenGenericWhereClauseAndMembers: RawUnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[14].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var members: RawMemberDeclBlockSyntax { + public var memberBlock: RawMemberDeclBlockSyntax { layoutView.children[15].map(RawMemberDeclBlockSyntax.init(raw:))! } - public var unexpectedAfterMembers: RawUnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: RawUnexpectedNodesSyntax? { layoutView.children[16].map(RawUnexpectedNodesSyntax.init(raw:)) } } diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift index 5e1946664e0..918abc67483 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift @@ -287,9 +287,9 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause: TypeInheritanceClauseSyntax? = nil, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - _ unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - members: MemberDeclBlockSyntax, - _ unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + memberBlock: MemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil ) { @@ -310,9 +310,9 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members, - unexpectedAfterMembers + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock, + unexpectedAfterMemberBlock ))) {(arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, @@ -329,9 +329,9 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause?.raw, unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw, genericWhereClause?.raw, - unexpectedBetweenGenericWhereClauseAndMembers?.raw, - members.raw, - unexpectedAfterMembers?.raw + unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw, + memberBlock.raw, + unexpectedAfterMemberBlock?.raw ] let raw = RawSyntax.makeLayout( kind: SyntaxKind.actorDecl, @@ -509,7 +509,7 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 14, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -518,7 +518,7 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var members: MemberDeclBlockSyntax { + public var memberBlock: MemberDeclBlockSyntax { get { return MemberDeclBlockSyntax(data.child(at: 15, parent: Syntax(self))!) } @@ -527,7 +527,7 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedAfterMembers: UnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 16, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -552,9 +552,9 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.inheritanceClause, \Self.unexpectedBetweenInheritanceClauseAndGenericWhereClause, \Self.genericWhereClause, - \Self.unexpectedBetweenGenericWhereClauseAndMembers, - \Self.members, - \Self.unexpectedAfterMembers + \Self.unexpectedBetweenGenericWhereClauseAndMemberBlock, + \Self.memberBlock, + \Self.unexpectedAfterMemberBlock ]) } } @@ -879,9 +879,9 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause: TypeInheritanceClauseSyntax? = nil, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - _ unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - members: MemberDeclBlockSyntax, - _ unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + memberBlock: MemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil ) { @@ -902,9 +902,9 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members, - unexpectedAfterMembers + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock, + unexpectedAfterMemberBlock ))) {(arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, @@ -921,9 +921,9 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause?.raw, unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw, genericWhereClause?.raw, - unexpectedBetweenGenericWhereClauseAndMembers?.raw, - members.raw, - unexpectedAfterMembers?.raw + unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw, + memberBlock.raw, + unexpectedAfterMemberBlock?.raw ] let raw = RawSyntax.makeLayout( kind: SyntaxKind.classDecl, @@ -1101,7 +1101,7 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 14, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -1110,7 +1110,7 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var members: MemberDeclBlockSyntax { + public var memberBlock: MemberDeclBlockSyntax { get { return MemberDeclBlockSyntax(data.child(at: 15, parent: Syntax(self))!) } @@ -1119,7 +1119,7 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedAfterMembers: UnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 16, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -1144,9 +1144,9 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.inheritanceClause, \Self.unexpectedBetweenInheritanceClauseAndGenericWhereClause, \Self.genericWhereClause, - \Self.unexpectedBetweenGenericWhereClauseAndMembers, - \Self.members, - \Self.unexpectedAfterMembers + \Self.unexpectedBetweenGenericWhereClauseAndMemberBlock, + \Self.memberBlock, + \Self.unexpectedAfterMemberBlock ]) } } @@ -1698,9 +1698,9 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause: TypeInheritanceClauseSyntax? = nil, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - _ unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - members: MemberDeclBlockSyntax, - _ unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + memberBlock: MemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil ) { @@ -1721,9 +1721,9 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members, - unexpectedAfterMembers + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock, + unexpectedAfterMemberBlock ))) {(arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, @@ -1740,9 +1740,9 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause?.raw, unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw, genericWhereClause?.raw, - unexpectedBetweenGenericWhereClauseAndMembers?.raw, - members.raw, - unexpectedAfterMembers?.raw + unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw, + memberBlock.raw, + unexpectedAfterMemberBlock?.raw ] let raw = RawSyntax.makeLayout( kind: SyntaxKind.enumDecl, @@ -1927,7 +1927,7 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 14, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -1937,7 +1937,7 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// The cases and other members of this enum. - public var members: MemberDeclBlockSyntax { + public var memberBlock: MemberDeclBlockSyntax { get { return MemberDeclBlockSyntax(data.child(at: 15, parent: Syntax(self))!) } @@ -1946,7 +1946,7 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedAfterMembers: UnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 16, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -1971,9 +1971,9 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.inheritanceClause, \Self.unexpectedBetweenInheritanceClauseAndGenericWhereClause, \Self.genericWhereClause, - \Self.unexpectedBetweenGenericWhereClauseAndMembers, - \Self.members, - \Self.unexpectedAfterMembers + \Self.unexpectedBetweenGenericWhereClauseAndMemberBlock, + \Self.memberBlock, + \Self.unexpectedAfterMemberBlock ]) } } @@ -2013,9 +2013,9 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause: TypeInheritanceClauseSyntax? = nil, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - _ unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - members: MemberDeclBlockSyntax, - _ unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + memberBlock: MemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil ) { @@ -2034,9 +2034,9 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members, - unexpectedAfterMembers + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock, + unexpectedAfterMemberBlock ))) {(arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, @@ -2051,9 +2051,9 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause?.raw, unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw, genericWhereClause?.raw, - unexpectedBetweenGenericWhereClauseAndMembers?.raw, - members.raw, - unexpectedAfterMembers?.raw + unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw, + memberBlock.raw, + unexpectedAfterMemberBlock?.raw ] let raw = RawSyntax.makeLayout( kind: SyntaxKind.extensionDecl, @@ -2213,7 +2213,7 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 12, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -2222,7 +2222,7 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var members: MemberDeclBlockSyntax { + public var memberBlock: MemberDeclBlockSyntax { get { return MemberDeclBlockSyntax(data.child(at: 13, parent: Syntax(self))!) } @@ -2231,7 +2231,7 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedAfterMembers: UnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 14, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -2254,9 +2254,9 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.inheritanceClause, \Self.unexpectedBetweenInheritanceClauseAndGenericWhereClause, \Self.genericWhereClause, - \Self.unexpectedBetweenGenericWhereClauseAndMembers, - \Self.members, - \Self.unexpectedAfterMembers + \Self.unexpectedBetweenGenericWhereClauseAndMemberBlock, + \Self.memberBlock, + \Self.unexpectedAfterMemberBlock ]) } } @@ -4794,9 +4794,9 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause: TypeInheritanceClauseSyntax? = nil, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - _ unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - members: MemberDeclBlockSyntax, - _ unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + memberBlock: MemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil ) { @@ -4817,9 +4817,9 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members, - unexpectedAfterMembers + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock, + unexpectedAfterMemberBlock ))) {(arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, @@ -4836,9 +4836,9 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause?.raw, unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw, genericWhereClause?.raw, - unexpectedBetweenGenericWhereClauseAndMembers?.raw, - members.raw, - unexpectedAfterMembers?.raw + unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw, + memberBlock.raw, + unexpectedAfterMemberBlock?.raw ] let raw = RawSyntax.makeLayout( kind: SyntaxKind.protocolDecl, @@ -5016,7 +5016,7 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 14, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -5025,7 +5025,7 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var members: MemberDeclBlockSyntax { + public var memberBlock: MemberDeclBlockSyntax { get { return MemberDeclBlockSyntax(data.child(at: 15, parent: Syntax(self))!) } @@ -5034,7 +5034,7 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedAfterMembers: UnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 16, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -5059,9 +5059,9 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.inheritanceClause, \Self.unexpectedBetweenInheritanceClauseAndGenericWhereClause, \Self.genericWhereClause, - \Self.unexpectedBetweenGenericWhereClauseAndMembers, - \Self.members, - \Self.unexpectedAfterMembers + \Self.unexpectedBetweenGenericWhereClauseAndMemberBlock, + \Self.memberBlock, + \Self.unexpectedAfterMemberBlock ]) } } @@ -5103,9 +5103,9 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause: TypeInheritanceClauseSyntax? = nil, _ unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - _ unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - members: MemberDeclBlockSyntax, - _ unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, + _ unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + memberBlock: MemberDeclBlockSyntax, + _ unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil ) { @@ -5126,9 +5126,9 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members, - unexpectedAfterMembers + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock, + unexpectedAfterMemberBlock ))) {(arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, @@ -5145,9 +5145,9 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { inheritanceClause?.raw, unexpectedBetweenInheritanceClauseAndGenericWhereClause?.raw, genericWhereClause?.raw, - unexpectedBetweenGenericWhereClauseAndMembers?.raw, - members.raw, - unexpectedAfterMembers?.raw + unexpectedBetweenGenericWhereClauseAndMemberBlock?.raw, + memberBlock.raw, + unexpectedAfterMemberBlock?.raw ] let raw = RawSyntax.makeLayout( kind: SyntaxKind.structDecl, @@ -5325,7 +5325,7 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? { + public var unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 14, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -5334,7 +5334,7 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var members: MemberDeclBlockSyntax { + public var memberBlock: MemberDeclBlockSyntax { get { return MemberDeclBlockSyntax(data.child(at: 15, parent: Syntax(self))!) } @@ -5343,7 +5343,7 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var unexpectedAfterMembers: UnexpectedNodesSyntax? { + public var unexpectedAfterMemberBlock: UnexpectedNodesSyntax? { get { return data.child(at: 16, parent: Syntax(self)).map(UnexpectedNodesSyntax.init) } @@ -5368,9 +5368,9 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { \Self.inheritanceClause, \Self.unexpectedBetweenInheritanceClauseAndGenericWhereClause, \Self.genericWhereClause, - \Self.unexpectedBetweenGenericWhereClauseAndMembers, - \Self.members, - \Self.unexpectedAfterMembers + \Self.unexpectedBetweenGenericWhereClauseAndMemberBlock, + \Self.memberBlock, + \Self.unexpectedAfterMemberBlock ]) } } diff --git a/Sources/SwiftSyntaxBuilder/SyntaxNodeWithBody.swift b/Sources/SwiftSyntaxBuilder/SyntaxNodeWithBody.swift index aeced8211f0..e14ced971d7 100644 --- a/Sources/SwiftSyntaxBuilder/SyntaxNodeWithBody.swift +++ b/Sources/SwiftSyntaxBuilder/SyntaxNodeWithBody.swift @@ -93,7 +93,7 @@ extension InitializerDeclSyntax: HasTrailingOptionalCodeBlock {} // MARK: HasTrailingMemberDeclBlock public protocol HasTrailingMemberDeclBlock { - var members: MemberDeclBlockSyntax { get set } + var memberBlock: MemberDeclBlockSyntax { get set } init(_ header: PartialSyntaxNodeString, @MemberDeclListBuilder membersBuilder: () throws -> MemberDeclListSyntax) throws } @@ -105,7 +105,7 @@ public extension HasTrailingMemberDeclBlock where Self: DeclSyntaxProtocol { throw SyntaxStringInterpolationError.producedInvalidNodeType(expectedType: Self.self, actualNode: decl) } self = castedDecl - self.members = try MemberDeclBlockSyntax(members: membersBuilder()) + self.memberBlock = try MemberDeclBlockSyntax(members: membersBuilder()) } } diff --git a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift index 739585f2e1d..30439c02e73 100644 --- a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift +++ b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift @@ -73,9 +73,9 @@ extension ActorDeclSyntax { inheritanceClause: TypeInheritanceClauseSyntax? = nil, unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, - @MemberDeclListBuilder membersBuilder: () throws -> MemberDeclListSyntax, + unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, + @MemberDeclListBuilder memberBlockBuilder: () throws -> MemberDeclListSyntax, trailingTrivia: Trivia? = nil ) rethrows { try self.init( @@ -94,9 +94,9 @@ extension ActorDeclSyntax { inheritanceClause: inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause: genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members: MemberDeclBlockSyntax(members: membersBuilder()), - unexpectedAfterMembers, + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock: MemberDeclBlockSyntax(members: memberBlockBuilder()), + unexpectedAfterMemberBlock, trailingTrivia: trailingTrivia ) } @@ -174,9 +174,9 @@ extension ClassDeclSyntax { inheritanceClause: TypeInheritanceClauseSyntax? = nil, unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, - @MemberDeclListBuilder membersBuilder: () throws -> MemberDeclListSyntax, + unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, + @MemberDeclListBuilder memberBlockBuilder: () throws -> MemberDeclListSyntax, trailingTrivia: Trivia? = nil ) rethrows { try self.init( @@ -195,9 +195,9 @@ extension ClassDeclSyntax { inheritanceClause: inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause: genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members: MemberDeclBlockSyntax(members: membersBuilder()), - unexpectedAfterMembers, + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock: MemberDeclBlockSyntax(members: memberBlockBuilder()), + unexpectedAfterMemberBlock, trailingTrivia: trailingTrivia ) } @@ -422,9 +422,9 @@ extension EnumDeclSyntax { inheritanceClause: TypeInheritanceClauseSyntax? = nil, unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, - @MemberDeclListBuilder membersBuilder: () throws -> MemberDeclListSyntax, + unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, + @MemberDeclListBuilder memberBlockBuilder: () throws -> MemberDeclListSyntax, trailingTrivia: Trivia? = nil ) rethrows { try self.init( @@ -443,9 +443,9 @@ extension EnumDeclSyntax { inheritanceClause: inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause: genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members: MemberDeclBlockSyntax(members: membersBuilder()), - unexpectedAfterMembers, + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock: MemberDeclBlockSyntax(members: memberBlockBuilder()), + unexpectedAfterMemberBlock, trailingTrivia: trailingTrivia ) } @@ -502,9 +502,9 @@ extension ExtensionDeclSyntax { inheritanceClause: TypeInheritanceClauseSyntax? = nil, unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, - @MemberDeclListBuilder membersBuilder: () throws -> MemberDeclListSyntax, + unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, + @MemberDeclListBuilder memberBlockBuilder: () throws -> MemberDeclListSyntax, trailingTrivia: Trivia? = nil ) rethrows { try self.init( @@ -521,9 +521,9 @@ extension ExtensionDeclSyntax { inheritanceClause: inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause: genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members: MemberDeclBlockSyntax(members: membersBuilder()), - unexpectedAfterMembers, + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock: MemberDeclBlockSyntax(members: memberBlockBuilder()), + unexpectedAfterMemberBlock, trailingTrivia: trailingTrivia ) } @@ -1069,9 +1069,9 @@ extension ProtocolDeclSyntax { inheritanceClause: TypeInheritanceClauseSyntax? = nil, unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, - @MemberDeclListBuilder membersBuilder: () throws -> MemberDeclListSyntax, + unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, + @MemberDeclListBuilder memberBlockBuilder: () throws -> MemberDeclListSyntax, trailingTrivia: Trivia? = nil ) rethrows { try self.init( @@ -1090,9 +1090,9 @@ extension ProtocolDeclSyntax { inheritanceClause: inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause: genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members: MemberDeclBlockSyntax(members: membersBuilder()), - unexpectedAfterMembers, + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock: MemberDeclBlockSyntax(members: memberBlockBuilder()), + unexpectedAfterMemberBlock, trailingTrivia: trailingTrivia ) } @@ -1189,9 +1189,9 @@ extension StructDeclSyntax { inheritanceClause: TypeInheritanceClauseSyntax? = nil, unexpectedBetweenInheritanceClauseAndGenericWhereClause: UnexpectedNodesSyntax? = nil, genericWhereClause: GenericWhereClauseSyntax? = nil, - unexpectedBetweenGenericWhereClauseAndMembers: UnexpectedNodesSyntax? = nil, - unexpectedAfterMembers: UnexpectedNodesSyntax? = nil, - @MemberDeclListBuilder membersBuilder: () throws -> MemberDeclListSyntax, + unexpectedBetweenGenericWhereClauseAndMemberBlock: UnexpectedNodesSyntax? = nil, + unexpectedAfterMemberBlock: UnexpectedNodesSyntax? = nil, + @MemberDeclListBuilder memberBlockBuilder: () throws -> MemberDeclListSyntax, trailingTrivia: Trivia? = nil ) rethrows { try self.init( @@ -1210,9 +1210,9 @@ extension StructDeclSyntax { inheritanceClause: inheritanceClause, unexpectedBetweenInheritanceClauseAndGenericWhereClause, genericWhereClause: genericWhereClause, - unexpectedBetweenGenericWhereClauseAndMembers, - members: MemberDeclBlockSyntax(members: membersBuilder()), - unexpectedAfterMembers, + unexpectedBetweenGenericWhereClauseAndMemberBlock, + memberBlock: MemberDeclBlockSyntax(members: memberBlockBuilder()), + unexpectedAfterMemberBlock, trailingTrivia: trailingTrivia ) } diff --git a/Sources/SwiftSyntaxMacros/MacroSystem.swift b/Sources/SwiftSyntaxMacros/MacroSystem.swift index 365bc7debfb..1c3bf921639 100644 --- a/Sources/SwiftSyntaxMacros/MacroSystem.swift +++ b/Sources/SwiftSyntaxMacros/MacroSystem.swift @@ -249,9 +249,9 @@ class MacroApplication: SyntaxRewriter { let expandedDeclGroup = expandMembers(of: declGroup) // Recurse into member decls. - let newMembers = visit(expandedDeclGroup.members) + let newMembers = visit(expandedDeclGroup.memberBlock) - return DeclSyntax(expandedDeclGroup.with(\.members, newMembers)) + return DeclSyntax(expandedDeclGroup.with(\.memberBlock, newMembers)) } override func visit(_ node: ActorDeclSyntax) -> DeclSyntax { @@ -400,8 +400,8 @@ extension MacroApplication { // FIXME: Is there a better way to add N members to a decl? return decl.with( - \.members, - newMembers.reduce(decl.members) { partialMembers, newMember in + \.memberBlock, + newMembers.reduce(decl.memberBlock) { partialMembers, newMember in partialMembers.addMember(.init(decl: newMember)) } ) diff --git a/Tests/SwiftParserTest/DeclarationTests.swift b/Tests/SwiftParserTest/DeclarationTests.swift index 9a0360d9d39..4f9bcce7563 100644 --- a/Tests/SwiftParserTest/DeclarationTests.swift +++ b/Tests/SwiftParserTest/DeclarationTests.swift @@ -1273,7 +1273,7 @@ final class DeclarationTests: XCTestCase { ClassDeclSyntax( classKeyword: .keyword(.class), identifier: .identifier("A"), - members: MemberDeclBlockSyntax( + memberBlock: MemberDeclBlockSyntax( leftBrace: .leftBraceToken(), members: MemberDeclListSyntax([ MemberDeclListItemSyntax( @@ -1302,7 +1302,7 @@ final class DeclarationTests: XCTestCase { ClassDeclSyntax( classKeyword: .keyword(.class), identifier: .identifier("B"), - members: MemberDeclBlockSyntax( + memberBlock: MemberDeclBlockSyntax( leftBrace: .leftBraceToken(), members: MemberDeclListSyntax([]), rightBrace: .rightBraceToken() diff --git a/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift b/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift index bc36539b993..4fb1a5d4d94 100644 --- a/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift +++ b/Tests/SwiftParserTest/translated/HashbangLibraryTests.swift @@ -41,7 +41,7 @@ final class HashbangLibraryTests: XCTestCase { trailingTrivia: .space ), identifier: .identifier("Foo", trailingTrivia: .space), - members: MemberDeclBlockSyntax( + memberBlock: MemberDeclBlockSyntax( members: MemberDeclListSyntax([]) ) ) diff --git a/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift b/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift index cf7b343037d..b9a47a88c36 100644 --- a/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ExtensionDeclTests.swift @@ -37,7 +37,7 @@ final class ExtensionDeclTests: XCTestCase { let members = MemberDeclListSyntax(keywords.map { MemberDeclListItemSyntax(decl: $0) }) let buildable = ExtensionDeclSyntax( extendedType: TypeSyntax("TokenSyntax"), - members: MemberDeclBlockSyntax(members: members) + memberBlock: MemberDeclBlockSyntax(members: members) ) assertBuildResult( diff --git a/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift b/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift index e0ab8f9678e..e6ae4de9b4d 100644 --- a/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/SourceFileTests.swift @@ -22,7 +22,7 @@ final class SourceFileTests: XCTestCase { ClassDeclSyntax( classKeyword: .keyword(.class), identifier: "SomeViewController", - membersBuilder: { + memberBlockBuilder: { DeclSyntax("let tableView: UITableView") } ) diff --git a/Tests/SwiftSyntaxBuilderTest/StructTests.swift b/Tests/SwiftSyntaxBuilderTest/StructTests.swift index 467e456c84c..f69a5e2c5ec 100644 --- a/Tests/SwiftSyntaxBuilderTest/StructTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/StructTests.swift @@ -46,7 +46,7 @@ final class StructTests: XCTestCase { ], structKeyword: .keyword(.struct), identifier: "CarriateReturnsStruct", - members: MemberDeclBlockSyntax(members: []) + memberBlock: MemberDeclBlockSyntax(members: []) ) let carriageReturnFormFeedsStruct = StructDeclSyntax( leadingTrivia: [ @@ -57,7 +57,7 @@ final class StructTests: XCTestCase { ], structKeyword: .keyword(.struct), identifier: "CarriageReturnFormFeedsStruct", - members: MemberDeclBlockSyntax(members: []) + memberBlock: MemberDeclBlockSyntax(members: []) ) let testStruct = try StructDeclSyntax("public struct TestStruct") { nestedStruct diff --git a/Tests/SwiftSyntaxParserTest/ParseFileTests.swift b/Tests/SwiftSyntaxParserTest/ParseFileTests.swift index 38394c59fc5..5f40f4f4b3e 100644 --- a/Tests/SwiftSyntaxParserTest/ParseFileTests.swift +++ b/Tests/SwiftSyntaxParserTest/ParseFileTests.swift @@ -54,7 +54,7 @@ public class ParseFileTests: XCTestCase { var cases: [EnumCaseDeclSyntax] = [] override func visit(_ node: EnumDeclSyntax) -> SyntaxVisitorContinueKind { cases.append( - contentsOf: node.members.members.compactMap { + contentsOf: node.memberBlock.members.compactMap { $0.decl.as(EnumCaseDeclSyntax.self) } ) diff --git a/Tests/SwiftSyntaxTest/RawSyntaxTests.swift b/Tests/SwiftSyntaxTest/RawSyntaxTests.swift index cc50c50019f..57b1bfb91bf 100644 --- a/Tests/SwiftSyntaxTest/RawSyntaxTests.swift +++ b/Tests/SwiftSyntaxTest/RawSyntaxTests.swift @@ -46,7 +46,7 @@ fileprivate func cannedStructDecl(arena: SyntaxArena) -> RawStructDeclSyntax { presence: .present, arena: arena ) - let members = RawMemberDeclBlockSyntax( + let memberBlock = RawMemberDeclBlockSyntax( leftBrace: lBrace, members: RawMemberDeclListSyntax(elements: [], arena: arena), rightBrace: rBrace, @@ -60,7 +60,7 @@ fileprivate func cannedStructDecl(arena: SyntaxArena) -> RawStructDeclSyntax { genericParameterClause: nil, inheritanceClause: nil, genericWhereClause: nil, - members: members, + memberBlock: memberBlock, arena: arena ) } @@ -85,8 +85,8 @@ final class RawSyntaxTests: XCTestCase { let structDecl = cannedStructDecl(arena: arena) XCTAssertEqual(structDecl.identifier.tokenKind, .identifier) XCTAssertEqual(structDecl.structKeyword.tokenText, "struct") - XCTAssertEqual(structDecl.members.leftBrace.tokenText, "{") - XCTAssertEqual(structDecl.members.members.elements.count, 0) + XCTAssertEqual(structDecl.memberBlock.leftBrace.tokenText, "{") + XCTAssertEqual(structDecl.memberBlock.members.elements.count, 0) XCTAssert(structDecl.is(RawDeclSyntax.self)) XCTAssertNotNil(structDecl.as(RawDeclSyntax.self)) diff --git a/Tests/SwiftSyntaxTest/SyntaxCreationTests.swift b/Tests/SwiftSyntaxTest/SyntaxCreationTests.swift index c8e67e50c30..83764c0e95d 100644 --- a/Tests/SwiftSyntaxTest/SyntaxCreationTests.swift +++ b/Tests/SwiftSyntaxTest/SyntaxCreationTests.swift @@ -17,7 +17,7 @@ fileprivate func cannedStructDecl() -> StructDeclSyntax { let structKW = TokenSyntax.keyword(.struct, trailingTrivia: .space) let fooID = TokenSyntax.identifier("Foo", trailingTrivia: .space) let rBrace = TokenSyntax.rightBraceToken(leadingTrivia: .newline) - let members = MemberDeclBlockSyntax( + let memberBlock = MemberDeclBlockSyntax( leftBrace: .leftBraceToken(), members: MemberDeclListSyntax([]), rightBrace: rBrace @@ -25,7 +25,7 @@ fileprivate func cannedStructDecl() -> StructDeclSyntax { return StructDeclSyntax( structKeyword: structKW, identifier: fooID, - members: members + memberBlock: memberBlock ) } @@ -48,8 +48,8 @@ public class SyntaxCreationTests: XCTestCase { let renamed = structDecl.with(\.identifier, forType) .with( - \.members, - structDecl.members + \.memberBlock, + structDecl.memberBlock .with(\.rightBrace, newBrace) ) @@ -62,14 +62,14 @@ public class SyntaxCreationTests: XCTestCase { """ ) - XCTAssertNotEqual(structDecl.members, renamed.members) + XCTAssertNotEqual(structDecl.memberBlock, renamed.memberBlock) XCTAssertEqual(structDecl, StructDeclSyntax(structDecl.root)) XCTAssertNil(structDecl.parent) - XCTAssertNotNil(structDecl.members.parent) - XCTAssertEqual(structDecl.members.parent.map(StructDeclSyntax.init), structDecl) + XCTAssertNotNil(structDecl.memberBlock.parent) + XCTAssertEqual(structDecl.memberBlock.parent.map(StructDeclSyntax.init), structDecl) XCTAssertEqual( - "\(structDecl.members.rightBrace)", + "\(structDecl.memberBlock.rightBrace)", """ } diff --git a/Tests/SwiftSyntaxTest/SyntaxTests.swift b/Tests/SwiftSyntaxTest/SyntaxTests.swift index 26da15a76fe..e37902dade1 100644 --- a/Tests/SwiftSyntaxTest/SyntaxTests.swift +++ b/Tests/SwiftSyntaxTest/SyntaxTests.swift @@ -42,10 +42,10 @@ public class SyntaxTests: XCTestCase { let s = StructDeclSyntax( structKeyword: .keyword(.struct), identifier: .identifier("someStruct"), - members: MemberDeclBlockSyntax(leftBrace: .leftBraceToken(), members: [], rightBrace: .rightBraceToken()) + memberBlock: MemberDeclBlockSyntax(leftBrace: .leftBraceToken(), members: [], rightBrace: .rightBraceToken()) ) - XCTAssertEqual(Syntax(s), s.members.parent) - XCTAssertNil(s.members.detach().parent) + XCTAssertEqual(Syntax(s), s.memberBlock.parent) + XCTAssertNil(s.memberBlock.detach().parent) } } From fe1d21ddbdfa62e3858196644d68a54b02a883e2 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Mon, 17 Apr 2023 17:23:06 -0700 Subject: [PATCH 16/22] Merge pull request #1538 from ahoppen/ahoppen/source-alteration-fixes Fix parser failures found by source alteration in test cases --- .../Sources/SyntaxSupport/DeclNodes.swift | 41 +++++++++++++++++- Sources/SwiftParser/Modifiers.swift | 3 +- Sources/SwiftParser/Specifiers.swift | 26 +++++++---- .../generated/raw/RawSyntaxValidation.swift | 43 ++++++++++--------- 4 files changed, 81 insertions(+), 32 deletions(-) diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift index e0c169e390a..eaf2eef668a 100644 --- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift @@ -332,7 +332,7 @@ public let DECL_NODES: [Node] = [ ), Child( name: "Detail", - kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .keyword(text: "set")]) + kind: .token(choices: [.token(tokenKind: "IdentifierToken")]) ), Child( name: "RightParen", @@ -348,7 +348,44 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Name", - kind: .token(choices: [.keyword(text: "class"), .keyword(text: "convenience"), .keyword(text: "dynamic"), .keyword(text: "final"), .keyword(text: "infix"), .keyword(text: "lazy"), .keyword(text: "optional"), .keyword(text: "override"), .keyword(text: "postfix"), .keyword(text: "prefix"), .keyword(text: "required"), .keyword(text: "static"), .keyword(text: "unowned"), .keyword(text: "weak"), .keyword(text: "private"), .keyword(text: "fileprivate"), .keyword(text: "internal"), .keyword(text: "public"), .keyword(text: "open"), .keyword(text: "mutating"), .keyword(text: "nonmutating"), .keyword(text: "indirect"), .keyword(text: "__consuming"), .keyword(text: "borrowing"), .keyword(text: "consuming"), .keyword(text: "actor"), .keyword(text: "async"), .keyword(text: "distributed"), .keyword(text: "isolated"), .keyword(text: "nonisolated"), .keyword(text: "_const"), .keyword(text: "_local"), .keyword(text: "package")]), + kind: .token(choices: [ + .keyword(text: "__consuming"), + .keyword(text: "__setter_access"), + .keyword(text: "_const"), + .keyword(text: "_local"), + .keyword(text: "actor"), + .keyword(text: "async"), + .keyword(text: "borrowing"), + .keyword(text: "class"), + .keyword(text: "consuming"), + .keyword(text: "convenience"), + .keyword(text: "distributed"), + .keyword(text: "dynamic"), + .keyword(text: "fileprivate"), + .keyword(text: "final"), + .keyword(text: "indirect"), + .keyword(text: "infix"), + .keyword(text: "internal"), + .keyword(text: "isolated"), + .keyword(text: "lazy"), + .keyword(text: "mutating"), + .keyword(text: "nonisolated"), + .keyword(text: "nonmutating"), + .keyword(text: "open"), + .keyword(text: "optional"), + .keyword(text: "override"), + .keyword(text: "package"), + .keyword(text: "postfix"), + .keyword(text: "prefix"), + .keyword(text: "private"), + .keyword(text: "public"), + .keyword(text: "reasync"), + .keyword(text: "required"), + .keyword(text: "setter_access"), + .keyword(text: "static"), + .keyword(text: "unowned"), + .keyword(text: "weak"), + ]), classification: "Attribute" ), Child( diff --git a/Sources/SwiftParser/Modifiers.swift b/Sources/SwiftParser/Modifiers.swift index bacd4929eab..27e13862a72 100644 --- a/Sources/SwiftParser/Modifiers.swift +++ b/Sources/SwiftParser/Modifiers.swift @@ -99,11 +99,12 @@ extension Parser { extension Parser { mutating func parseModifierDetail() -> RawDeclModifierDetailSyntax { let (unexpectedBeforeLeftParen, leftParen) = self.expect(.leftParen) - let detailToken = self.consumeAnyToken() + let (unexpectedBeforeDetailToken, detailToken) = self.expect(.identifier, TokenSpec(.set, remapping: .identifier), default: .identifier) let (unexpectedBeforeRightParen, rightParen) = self.expect(.rightParen) return RawDeclModifierDetailSyntax( unexpectedBeforeLeftParen, leftParen: leftParen, + unexpectedBeforeDetailToken, detail: detailToken, unexpectedBeforeRightParen, rightParen: rightParen, diff --git a/Sources/SwiftParser/Specifiers.swift b/Sources/SwiftParser/Specifiers.swift index 18749f12b1a..9bd2622d41e 100644 --- a/Sources/SwiftParser/Specifiers.swift +++ b/Sources/SwiftParser/Specifiers.swift @@ -412,11 +412,11 @@ extension RawAccessorEffectSpecifiersSyntax: RawEffectSpecifiersTrait { } extension TokenConsumer { - mutating func at(anyIn specSet1: SpecSet1.Type, or specSet2: SpecSet2.Type) -> (TokenSpec, TokenConsumptionHandle)? { + mutating func at(anyIn specSet1: SpecSet1.Type, or specSet2: SpecSet2.Type) -> (spec: TokenSpec, handle: TokenConsumptionHandle, matchedSubset: Any.Type)? { if let (spec, handle) = self.at(anyIn: specSet1) { - return (spec.spec, handle) + return (spec.spec, handle, SpecSet1.self) } else if let (spec, handle) = self.at(anyIn: specSet2) { - return (spec.spec, handle) + return (spec.spec, handle, SpecSet2.self) } else { return nil } @@ -470,14 +470,14 @@ extension Parser { var unexpectedAfterThrowsLoopProgress = LoopProgressCondition() while unexpectedAfterThrowsLoopProgress.evaluate(self.currentToken) { - if let (_, handle) = self.at(anyIn: S.MisspelledAsyncSpecifiers.self, or: S.CorrectAsyncTokenKinds.self) { + if let (_, handle, _) = self.at(anyIn: S.MisspelledAsyncSpecifiers.self, or: S.CorrectAsyncTokenKinds.self) { let misspelledAsync = self.eat(handle) unexpectedAfterThrows.append(RawSyntax(misspelledAsync)) if asyncKeyword == nil { // Handle `async` after `throws` asyncKeyword = missingToken(.keyword(.async)) } - } else if let (_, handle) = self.at(anyIn: S.MisspelledThrowsTokenKinds.self, or: S.CorrectThrowsTokenKinds.self) { + } else if let (_, handle, _) = self.at(anyIn: S.MisspelledThrowsTokenKinds.self, or: S.CorrectThrowsTokenKinds.self) { let misspelledThrows = self.eat(handle) unexpectedAfterThrows.append(RawSyntax(misspelledThrows)) } else { @@ -521,17 +521,25 @@ extension Parser { var unexpected: [RawTokenSyntax] = [] var loopProgress = LoopProgressCondition() while loopProgress.evaluate(self.currentToken) { - if let (spec, handle) = self.at(anyIn: S.MisspelledAsyncSpecifiers.self, or: S.CorrectAsyncTokenKinds.self) { + if let (spec, handle, matchedSubset) = self.at(anyIn: S.MisspelledAsyncSpecifiers.self, or: S.CorrectAsyncTokenKinds.self) { let misspelledAsync = self.eat(handle) unexpected.append(misspelledAsync) if effectSpecifiers?.asyncSpecifier == nil { - synthesizedAsync = missingToken(spec) + if matchedSubset == S.CorrectAsyncTokenKinds.self { + synthesizedAsync = missingToken(spec) + } else { + synthesizedAsync = missingToken(.async) + } } - } else if let (spec, handle) = self.at(anyIn: S.MisspelledThrowsTokenKinds.self, or: S.CorrectThrowsTokenKinds.self) { + } else if let (spec, handle, matchedSubset) = self.at(anyIn: S.MisspelledThrowsTokenKinds.self, or: S.CorrectThrowsTokenKinds.self) { let misspelledThrows = self.eat(handle) unexpected.append(misspelledThrows) if effectSpecifiers?.throwsSpecifier == nil { - synthesizedThrows = missingToken(spec) + if matchedSubset == S.CorrectThrowsTokenKinds.self { + synthesizedThrows = missingToken(spec) + } else { + synthesizedThrows = missingToken(.throws) + } } } else { break diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index b30781dc9a2..2239903f941 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -807,39 +807,42 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assert(layout.count == 5) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax.self, tokenChoices: [ + .keyword("__consuming"), + .keyword("__setter_access"), + .keyword("_const"), + .keyword("_local"), + .keyword("actor"), + .keyword("async"), + .keyword("borrowing"), .keyword("class"), + .keyword("consuming"), .keyword("convenience"), + .keyword("distributed"), .keyword("dynamic"), + .keyword("fileprivate"), .keyword("final"), + .keyword("indirect"), .keyword("infix"), + .keyword("internal"), + .keyword("isolated"), .keyword("lazy"), + .keyword("mutating"), + .keyword("nonisolated"), + .keyword("nonmutating"), + .keyword("open"), .keyword("optional"), .keyword("override"), + .keyword("package"), .keyword("postfix"), .keyword("prefix"), + .keyword("private"), + .keyword("public"), + .keyword("reasync"), .keyword("required"), + .keyword("setter_access"), .keyword("static"), .keyword("unowned"), - .keyword("weak"), - .keyword("private"), - .keyword("fileprivate"), - .keyword("internal"), - .keyword("public"), - .keyword("open"), - .keyword("mutating"), - .keyword("nonmutating"), - .keyword("indirect"), - .keyword("__consuming"), - .keyword("borrowing"), - .keyword("consuming"), - .keyword("actor"), - .keyword("async"), - .keyword("distributed"), - .keyword("isolated"), - .keyword("nonisolated"), - .keyword("_const"), - .keyword("_local"), - .keyword("package") + .keyword("weak") ])) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierDetailSyntax?.self)) From 6e8adda162a64cdf403d7ab4c524091b3d71763b Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Sat, 15 Apr 2023 08:01:25 -0700 Subject: [PATCH 17/22] Merge pull request #1541 from ahoppen/ahoppen/package-formatting Add some structure to Package.swift --- Package.swift | 278 +++++++++++++++++++++++++++++--------------------- 1 file changed, 159 insertions(+), 119 deletions(-) diff --git a/Package.swift b/Package.swift index 6d26c21167c..a1570007ae7 100644 --- a/Package.swift +++ b/Package.swift @@ -39,187 +39,227 @@ let package = Package( ], products: [ .library(name: "IDEUtils", type: .static, targets: ["IDEUtils"]), + .library(name: "SwiftCompilerPlugin", type: .static, targets: ["SwiftCompilerPlugin"]), + .library(name: "SwiftCompilerPluginMessageHandling", type: .static, targets: ["SwiftCompilerPluginMessageHandling"]), .library(name: "SwiftDiagnostics", type: .static, targets: ["SwiftDiagnostics"]), .library(name: "SwiftOperators", type: .static, targets: ["SwiftOperators"]), .library(name: "SwiftParser", type: .static, targets: ["SwiftParser"]), .library(name: "SwiftParserDiagnostics", type: .static, targets: ["SwiftParserDiagnostics"]), + .library(name: "SwiftRefactor", type: .static, targets: ["SwiftRefactor"]), .library(name: "SwiftSyntax", type: .static, targets: ["SwiftSyntax"]), - .library(name: "SwiftSyntaxParser", type: .static, targets: ["SwiftSyntaxParser"]), .library(name: "SwiftSyntaxBuilder", type: .static, targets: ["SwiftSyntaxBuilder"]), .library(name: "SwiftSyntaxMacros", type: .static, targets: ["SwiftSyntaxMacros"]), - .library(name: "SwiftCompilerPlugin", type: .static, targets: ["SwiftCompilerPlugin"]), - .library(name: "SwiftCompilerPluginMessageHandling", type: .static, targets: ["SwiftCompilerPluginMessageHandling"]), - .library(name: "SwiftRefactor", type: .static, targets: ["SwiftRefactor"]), + .library(name: "SwiftSyntaxParser", type: .static, targets: ["SwiftSyntaxParser"]), ], targets: [ - .target(name: "_InstructionCounter"), - .target( - name: "SwiftBasicFormat", - dependencies: ["SwiftSyntax"], - exclude: [ - "CMakeLists.txt" - ] - ), - .target( - name: "SwiftDiagnostics", - dependencies: ["SwiftSyntax"], - exclude: [ - "CMakeLists.txt" - ] - ), - .target( - name: "SwiftSyntax", - dependencies: [], - exclude: [ - "CMakeLists.txt" - ], - swiftSettings: swiftSyntaxSwiftSettings - ), - .target( - name: "SwiftSyntaxBuilder", - dependencies: ["SwiftBasicFormat", "SwiftSyntax", "SwiftParser", "SwiftParserDiagnostics"], - exclude: [ - "CMakeLists.txt" - ] - ), + // MARK: - Internal helper targets + .target( - name: "SwiftSyntaxParser", - dependencies: ["SwiftSyntax", "SwiftParser"] + name: "_InstructionCounter" ), + .target( name: "_SwiftSyntaxTestSupport", dependencies: ["SwiftBasicFormat", "SwiftSyntax", "SwiftSyntaxBuilder"] ), + + // MARK: - Library targets + // Formatting style: + // - One section for each target and its test target + // - Sections are sorted alphabetically + // - Each target argument takes exactly one line, unless there are external dependencies. + // In that case package and internal dependencies are on different lines. + // - All array elements are sorted alphabetically + + // MARK: IDEUtils + .target( name: "IDEUtils", dependencies: ["SwiftSyntax"], - exclude: [ - "CMakeLists.txt" - ] - ), - .target( - name: "SwiftParser", - dependencies: ["SwiftSyntax"], - exclude: [ - "CMakeLists.txt", - "README.md", - ] + exclude: ["CMakeLists.txt"] ), - .target( - name: "SwiftParserDiagnostics", - dependencies: ["SwiftBasicFormat", "SwiftDiagnostics", "SwiftParser", "SwiftSyntax"], - exclude: [ - "CMakeLists.txt" - ] - ), - .target( - name: "SwiftOperators", - dependencies: ["SwiftSyntax", "SwiftParser", "SwiftDiagnostics"], - exclude: [ - "CMakeLists.txt" - ] + + .testTarget( + name: "IDEUtilsTest", + dependencies: ["_SwiftSyntaxTestSupport", "IDEUtils", "SwiftParser", "SwiftSyntax"] ), + + // MARK: SwiftBasicFormat + .target( - name: "SwiftSyntaxMacros", - dependencies: [ - "SwiftSyntax", "SwiftSyntaxBuilder", "SwiftParser", "SwiftDiagnostics", - ], - exclude: [ - "CMakeLists.txt" - ] + name: "SwiftBasicFormat", + dependencies: ["SwiftSyntax"], + exclude: ["CMakeLists.txt"] ), + + // MARK: SwiftCompilerPlugin + .target( name: "SwiftCompilerPlugin", - dependencies: [ - "SwiftCompilerPluginMessageHandling", "SwiftSyntaxMacros", - ] + dependencies: ["SwiftCompilerPluginMessageHandling", "SwiftSyntaxMacros"] + ), + + .testTarget( + name: "SwiftCompilerPluginTest", + dependencies: ["SwiftCompilerPlugin"] ), + + // MARK: SwiftCompilerPluginMessageHandling + .target( name: "SwiftCompilerPluginMessageHandling", - dependencies: [ - "SwiftSyntax", "SwiftParser", "SwiftDiagnostics", "SwiftSyntaxMacros", "SwiftOperators", - ], - exclude: [ - "CMakeLists.txt" - ] + dependencies: ["SwiftDiagnostics", "SwiftOperators", "SwiftParser", "SwiftSyntax", "SwiftSyntaxMacros"], + exclude: ["CMakeLists.txt"] ), + + // MARK: SwiftDiagnostics + .target( - name: "SwiftRefactor", - dependencies: [ - "SwiftSyntax", "SwiftParser", - ] - ), - .executableTarget( - name: "lit-test-helper", - dependencies: ["IDEUtils", "SwiftSyntax", "SwiftSyntaxParser"] - ), - .executableTarget( - name: "swift-parser-cli", - dependencies: [ - "_InstructionCounter", "SwiftDiagnostics", "SwiftSyntax", "SwiftParser", "SwiftParserDiagnostics", "SwiftOperators", - .product(name: "ArgumentParser", package: "swift-argument-parser"), - ] + name: "SwiftDiagnostics", + dependencies: ["SwiftSyntax"], + exclude: ["CMakeLists.txt"] ), - .testTarget(name: "IDEUtilsTest", dependencies: ["_SwiftSyntaxTestSupport", "SwiftParser", "SwiftSyntax", "IDEUtils"]), + .testTarget( name: "SwiftDiagnosticsTest", dependencies: ["_SwiftSyntaxTestSupport", "SwiftDiagnostics", "SwiftParser", "SwiftParserDiagnostics"] ), + + // MARK: SwiftSyntax + + .target( + name: "SwiftSyntax", + dependencies: [], + exclude: ["CMakeLists.txt"], + swiftSettings: swiftSyntaxSwiftSettings + ), + .testTarget( name: "SwiftSyntaxTest", - dependencies: ["SwiftSyntax", "_SwiftSyntaxTestSupport"] + dependencies: ["_SwiftSyntaxTestSupport", "SwiftSyntax"] + ), + + // MARK: SwiftSyntaxBuilder + + .target( + name: "SwiftSyntaxBuilder", + dependencies: ["SwiftBasicFormat", "SwiftParser", "SwiftParserDiagnostics", "SwiftSyntax"], + exclude: ["CMakeLists.txt"] ), + .testTarget( name: "SwiftSyntaxBuilderTest", dependencies: ["_SwiftSyntaxTestSupport", "SwiftSyntaxBuilder"] ), - .testTarget( - name: "SwiftSyntaxParserTest", - dependencies: ["SwiftSyntaxParser", "_SwiftSyntaxTestSupport"], - exclude: ["Inputs"] + + // MARK: SwiftSyntaxMacros + + .target( + name: "SwiftSyntaxMacros", + dependencies: ["SwiftDiagnostics", "SwiftParser", "SwiftSyntax", "SwiftSyntaxBuilder"], + exclude: ["CMakeLists.txt"] ), + .testTarget( name: "SwiftSyntaxMacrosTest", - dependencies: [ - "SwiftDiagnostics", "SwiftOperators", "SwiftParser", - "_SwiftSyntaxTestSupport", "SwiftSyntaxBuilder", - "SwiftSyntaxMacros", - ] + dependencies: ["_SwiftSyntaxTestSupport", "SwiftDiagnostics", "SwiftOperators", "SwiftParser", "SwiftSyntaxBuilder", "SwiftSyntaxMacros"] ), - .testTarget( - name: "PerformanceTest", - dependencies: ["IDEUtils", "SwiftSyntax", "SwiftSyntaxParser", "SwiftParser"], - exclude: ["Inputs"] + + // MARK: SwiftParser + + .target( + name: "SwiftParser", + dependencies: ["SwiftSyntax"], + exclude: ["CMakeLists.txt", "README.md"] ), + .testTarget( name: "SwiftParserTest", - dependencies: [ - "SwiftDiagnostics", "SwiftOperators", "SwiftParser", - "_SwiftSyntaxTestSupport", "SwiftSyntaxBuilder", - ] + dependencies: ["_SwiftSyntaxTestSupport", "SwiftDiagnostics", "SwiftOperators", "SwiftParser", "SwiftSyntaxBuilder"] + ), + + // MARK: SwiftParserDiagnostics + + .target( + name: "SwiftParserDiagnostics", + dependencies: ["SwiftBasicFormat", "SwiftDiagnostics", "SwiftParser", "SwiftSyntax"], + exclude: ["CMakeLists.txt"] ), + .testTarget( name: "SwiftParserDiagnosticsTest", dependencies: ["SwiftDiagnostics", "SwiftParserDiagnostics"] ), + + // MARK: SwiftOperators + + .target( + name: "SwiftOperators", + dependencies: ["SwiftDiagnostics", "SwiftParser", "SwiftSyntax"], + exclude: [ + "CMakeLists.txt" + ] + ), + .testTarget( name: "SwiftOperatorsTest", - dependencies: [ - "SwiftOperators", "_SwiftSyntaxTestSupport", - "SwiftParser", - ] + dependencies: ["_SwiftSyntaxTestSupport", "SwiftOperators", "SwiftParser"] ), + + // MARK: SwiftRefactor + + .target( + name: "SwiftRefactor", + dependencies: ["SwiftParser", "SwiftSyntax"] + ), + .testTarget( name: "SwiftRefactorTest", + dependencies: ["_SwiftSyntaxTestSupport", "SwiftRefactor", "SwiftSyntaxBuilder"] + ), + + // MARK: - Executable targets + + .executableTarget( + name: "swift-parser-cli", dependencies: [ - "SwiftRefactor", "SwiftSyntaxBuilder", "_SwiftSyntaxTestSupport", + "_InstructionCounter", "SwiftDiagnostics", "SwiftOperators", "SwiftParser", "SwiftParserDiagnostics", "SwiftSyntax", + .product(name: "ArgumentParser", package: "swift-argument-parser"), ] ), + + // MARK: - Deprecated targets + + // MARK: lit-test-helper + // TODO: All the lit-based tests should be migrated to XCTest so we don't have a + // dependency on FileCheck + + .executableTarget( + name: "lit-test-helper", + dependencies: ["IDEUtils", "SwiftSyntax", "SwiftSyntaxParser"] + ), + + // MARK: PerformanceTest + // TODO: Should be included in SwiftParserTest/SwiftSyntaxTest + .testTarget( - name: "SwiftCompilerPluginTest", - dependencies: [ - "SwiftCompilerPlugin" - ] + name: "PerformanceTest", + dependencies: ["IDEUtils", "SwiftParser", "SwiftSyntax", "SwiftSyntaxParser"], + exclude: ["Inputs"] + ), + + // MARK: SwiftSyntaxParser + // TODO: All clients should use SwiftParser instead + + .target( + name: "SwiftSyntaxParser", + dependencies: ["SwiftSyntax", "SwiftParser"] + ), + + .testTarget( + name: "SwiftSyntaxParserTest", + dependencies: ["_SwiftSyntaxTestSupport", "SwiftSyntaxParser"], + exclude: ["Inputs"] ), ] ) From c346d3ae526f9ab2c2a13a68e315bece7545aa9a Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Sat, 15 Apr 2023 08:01:42 -0700 Subject: [PATCH 18/22] Merge pull request #1539 from ahoppen/ahoppen/include-child-name-in-debug-description Include property names in debug description --- .../GenerateSwiftSyntax.swift | 1 + .../swiftsyntax/ChildNameForKeyPathFile.swift | 45 + Sources/SwiftSyntax/CMakeLists.txt | 1 + Sources/SwiftSyntax/Syntax.swift | 5 + .../generated/ChildNameForKeyPath.swift | 3348 +++++++++++++++++ ...ests.swift => DebugDescriptionTests.swift} | 33 +- utils/group.json | 1 + 7 files changed, 3419 insertions(+), 15 deletions(-) create mode 100644 CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/ChildNameForKeyPathFile.swift create mode 100644 Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift rename Tests/SwiftSyntaxTest/{CustomReflectableTests.swift => DebugDescriptionTests.swift} (86%) diff --git a/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift b/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift index 3c32c01409a..bd42ede58b8 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift @@ -98,6 +98,7 @@ struct GenerateSwiftSyntax: ParsableCommand { GeneratedFileSpec(swiftParserDiagnosticsGeneratedDir + ["TokenNameForDiagnostics.swift"], tokenNameForDiagnosticFile), // SwiftSyntax + GeneratedFileSpec(swiftSyntaxGeneratedDir + ["ChildNameForKeyPath.swift"], childNameForKeyPathFile), GeneratedFileSpec(swiftSyntaxGeneratedDir + ["Keyword.swift"], keywordFile), GeneratedFileSpec(swiftSyntaxGeneratedDir + ["raw", "RawSyntaxNodes.swift"], rawSyntaxNodesFile), GeneratedFileSpec(swiftSyntaxGeneratedDir + ["raw", "RawSyntaxValidation.swift"], rawSyntaxValidationFile), diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/ChildNameForKeyPathFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/ChildNameForKeyPathFile.swift new file mode 100644 index 00000000000..fc5f3d11a90 --- /dev/null +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/ChildNameForKeyPathFile.swift @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SwiftSyntax +import SwiftSyntaxBuilder +import SyntaxSupport +import Utils + +let childNameForKeyPathFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { + try! FunctionDeclSyntax( + """ + /// If the keyPath is one from a layout structure, return the property name + /// of it. + internal func childName(_ keyPath: AnyKeyPath) -> String? + """ + ) { + try! SwitchExprSyntax("switch keyPath") { + for node in NON_BASE_SYNTAX_NODES where !node.isSyntaxCollection { + for child in node.children { + SwitchCaseSyntax( + """ + case \\\(raw: node.type.syntaxBaseName).\(raw: child.swiftName): + return \(literal: child.swiftName) + """ + ) + } + } + SwitchCaseSyntax( + """ + default: + return nil + """ + ) + } + } +} diff --git a/Sources/SwiftSyntax/CMakeLists.txt b/Sources/SwiftSyntax/CMakeLists.txt index 2560ee6de90..2c914bf601e 100644 --- a/Sources/SwiftSyntax/CMakeLists.txt +++ b/Sources/SwiftSyntax/CMakeLists.txt @@ -34,6 +34,7 @@ add_swift_host_library(SwiftSyntax generated/raw/RawSyntaxNodes.swift generated/raw/RawSyntaxValidation.swift + generated/ChildNameForKeyPath.swift generated/Keyword.swift generated/SyntaxAnyVisitor.swift generated/SyntaxBaseNodes.swift diff --git a/Sources/SwiftSyntax/Syntax.swift b/Sources/SwiftSyntax/Syntax.swift index d6ae1e4b9da..4cb0e2be99e 100644 --- a/Sources/SwiftSyntax/Syntax.swift +++ b/Sources/SwiftSyntax/Syntax.swift @@ -635,6 +635,11 @@ public extension SyntaxProtocol { target.write("\n") target.write(indentString) target.write(isLastChild ? "╰─" : "├─") + if let keyPath = child.keyPathInParent, let name = childName(keyPath) { + target.write("\(name): ") + } else if self.kind.isSyntaxCollection { + target.write("[\(num)]: ") + } let childIndentString = indentString + (isLastChild ? " " : "│ ") child.debugWrite( to: &target, diff --git a/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift b/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift new file mode 100644 index 00000000000..18cb0682971 --- /dev/null +++ b/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift @@ -0,0 +1,3348 @@ +//// Automatically generated by generate-swiftsyntax +//// Do not edit directly! +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +/// If the keyPath is one from a layout structure, return the property name +/// of it. +internal func childName(_ keyPath: AnyKeyPath) -> String? { + switch keyPath { + case \AccessPathComponentSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \AccessPathComponentSyntax.name: + return "name" + case \AccessPathComponentSyntax.unexpectedBetweenNameAndTrailingDot: + return "unexpectedBetweenNameAndTrailingDot" + case \AccessPathComponentSyntax.trailingDot: + return "trailingDot" + case \AccessPathComponentSyntax.unexpectedAfterTrailingDot: + return "unexpectedAfterTrailingDot" + case \AccessorBlockSyntax.unexpectedBeforeLeftBrace: + return "unexpectedBeforeLeftBrace" + case \AccessorBlockSyntax.leftBrace: + return "leftBrace" + case \AccessorBlockSyntax.unexpectedBetweenLeftBraceAndAccessors: + return "unexpectedBetweenLeftBraceAndAccessors" + case \AccessorBlockSyntax.accessors: + return "accessors" + case \AccessorBlockSyntax.unexpectedBetweenAccessorsAndRightBrace: + return "unexpectedBetweenAccessorsAndRightBrace" + case \AccessorBlockSyntax.rightBrace: + return "rightBrace" + case \AccessorBlockSyntax.unexpectedAfterRightBrace: + return "unexpectedAfterRightBrace" + case \AccessorDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \AccessorDeclSyntax.attributes: + return "attributes" + case \AccessorDeclSyntax.unexpectedBetweenAttributesAndModifier: + return "unexpectedBetweenAttributesAndModifier" + case \AccessorDeclSyntax.modifier: + return "modifier" + case \AccessorDeclSyntax.unexpectedBetweenModifierAndAccessorKind: + return "unexpectedBetweenModifierAndAccessorKind" + case \AccessorDeclSyntax.accessorKind: + return "accessorKind" + case \AccessorDeclSyntax.unexpectedBetweenAccessorKindAndParameter: + return "unexpectedBetweenAccessorKindAndParameter" + case \AccessorDeclSyntax.parameter: + return "parameter" + case \AccessorDeclSyntax.unexpectedBetweenParameterAndEffectSpecifiers: + return "unexpectedBetweenParameterAndEffectSpecifiers" + case \AccessorDeclSyntax.effectSpecifiers: + return "effectSpecifiers" + case \AccessorDeclSyntax.unexpectedBetweenEffectSpecifiersAndBody: + return "unexpectedBetweenEffectSpecifiersAndBody" + case \AccessorDeclSyntax.body: + return "body" + case \AccessorDeclSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \AccessorEffectSpecifiersSyntax.unexpectedBeforeAsyncSpecifier: + return "unexpectedBeforeAsyncSpecifier" + case \AccessorEffectSpecifiersSyntax.asyncSpecifier: + return "asyncSpecifier" + case \AccessorEffectSpecifiersSyntax.unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: + return "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier" + case \AccessorEffectSpecifiersSyntax.throwsSpecifier: + return "throwsSpecifier" + case \AccessorEffectSpecifiersSyntax.unexpectedAfterThrowsSpecifier: + return "unexpectedAfterThrowsSpecifier" + case \AccessorParameterSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \AccessorParameterSyntax.leftParen: + return "leftParen" + case \AccessorParameterSyntax.unexpectedBetweenLeftParenAndName: + return "unexpectedBetweenLeftParenAndName" + case \AccessorParameterSyntax.name: + return "name" + case \AccessorParameterSyntax.unexpectedBetweenNameAndRightParen: + return "unexpectedBetweenNameAndRightParen" + case \AccessorParameterSyntax.rightParen: + return "rightParen" + case \AccessorParameterSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \ActorDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \ActorDeclSyntax.attributes: + return "attributes" + case \ActorDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \ActorDeclSyntax.modifiers: + return "modifiers" + case \ActorDeclSyntax.unexpectedBetweenModifiersAndActorKeyword: + return "unexpectedBetweenModifiersAndActorKeyword" + case \ActorDeclSyntax.actorKeyword: + return "actorKeyword" + case \ActorDeclSyntax.unexpectedBetweenActorKeywordAndIdentifier: + return "unexpectedBetweenActorKeywordAndIdentifier" + case \ActorDeclSyntax.identifier: + return "identifier" + case \ActorDeclSyntax.unexpectedBetweenIdentifierAndGenericParameterClause: + return "unexpectedBetweenIdentifierAndGenericParameterClause" + case \ActorDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \ActorDeclSyntax.unexpectedBetweenGenericParameterClauseAndInheritanceClause: + return "unexpectedBetweenGenericParameterClauseAndInheritanceClause" + case \ActorDeclSyntax.inheritanceClause: + return "inheritanceClause" + case \ActorDeclSyntax.unexpectedBetweenInheritanceClauseAndGenericWhereClause: + return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" + case \ActorDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \ActorDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: + return "unexpectedBetweenGenericWhereClauseAndMembers" + case \ActorDeclSyntax.members: + return "members" + case \ActorDeclSyntax.unexpectedAfterMembers: + return "unexpectedAfterMembers" + case \ArrayElementSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \ArrayElementSyntax.expression: + return "expression" + case \ArrayElementSyntax.unexpectedBetweenExpressionAndTrailingComma: + return "unexpectedBetweenExpressionAndTrailingComma" + case \ArrayElementSyntax.trailingComma: + return "trailingComma" + case \ArrayElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \ArrayExprSyntax.unexpectedBeforeLeftSquare: + return "unexpectedBeforeLeftSquare" + case \ArrayExprSyntax.leftSquare: + return "leftSquare" + case \ArrayExprSyntax.unexpectedBetweenLeftSquareAndElements: + return "unexpectedBetweenLeftSquareAndElements" + case \ArrayExprSyntax.elements: + return "elements" + case \ArrayExprSyntax.unexpectedBetweenElementsAndRightSquare: + return "unexpectedBetweenElementsAndRightSquare" + case \ArrayExprSyntax.rightSquare: + return "rightSquare" + case \ArrayExprSyntax.unexpectedAfterRightSquare: + return "unexpectedAfterRightSquare" + case \ArrayTypeSyntax.unexpectedBeforeLeftSquareBracket: + return "unexpectedBeforeLeftSquareBracket" + case \ArrayTypeSyntax.leftSquareBracket: + return "leftSquareBracket" + case \ArrayTypeSyntax.unexpectedBetweenLeftSquareBracketAndElementType: + return "unexpectedBetweenLeftSquareBracketAndElementType" + case \ArrayTypeSyntax.elementType: + return "elementType" + case \ArrayTypeSyntax.unexpectedBetweenElementTypeAndRightSquareBracket: + return "unexpectedBetweenElementTypeAndRightSquareBracket" + case \ArrayTypeSyntax.rightSquareBracket: + return "rightSquareBracket" + case \ArrayTypeSyntax.unexpectedAfterRightSquareBracket: + return "unexpectedAfterRightSquareBracket" + case \ArrowExprSyntax.unexpectedBeforeEffectSpecifiers: + return "unexpectedBeforeEffectSpecifiers" + case \ArrowExprSyntax.effectSpecifiers: + return "effectSpecifiers" + case \ArrowExprSyntax.unexpectedBetweenEffectSpecifiersAndArrowToken: + return "unexpectedBetweenEffectSpecifiersAndArrowToken" + case \ArrowExprSyntax.arrowToken: + return "arrowToken" + case \ArrowExprSyntax.unexpectedAfterArrowToken: + return "unexpectedAfterArrowToken" + case \AsExprSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \AsExprSyntax.expression: + return "expression" + case \AsExprSyntax.unexpectedBetweenExpressionAndAsTok: + return "unexpectedBetweenExpressionAndAsTok" + case \AsExprSyntax.asTok: + return "asTok" + case \AsExprSyntax.unexpectedBetweenAsTokAndQuestionOrExclamationMark: + return "unexpectedBetweenAsTokAndQuestionOrExclamationMark" + case \AsExprSyntax.questionOrExclamationMark: + return "questionOrExclamationMark" + case \AsExprSyntax.unexpectedBetweenQuestionOrExclamationMarkAndTypeName: + return "unexpectedBetweenQuestionOrExclamationMarkAndTypeName" + case \AsExprSyntax.typeName: + return "typeName" + case \AsExprSyntax.unexpectedAfterTypeName: + return "unexpectedAfterTypeName" + case \AssignmentExprSyntax.unexpectedBeforeAssignToken: + return "unexpectedBeforeAssignToken" + case \AssignmentExprSyntax.assignToken: + return "assignToken" + case \AssignmentExprSyntax.unexpectedAfterAssignToken: + return "unexpectedAfterAssignToken" + case \AssociatedtypeDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \AssociatedtypeDeclSyntax.attributes: + return "attributes" + case \AssociatedtypeDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \AssociatedtypeDeclSyntax.modifiers: + return "modifiers" + case \AssociatedtypeDeclSyntax.unexpectedBetweenModifiersAndAssociatedtypeKeyword: + return "unexpectedBetweenModifiersAndAssociatedtypeKeyword" + case \AssociatedtypeDeclSyntax.associatedtypeKeyword: + return "associatedtypeKeyword" + case \AssociatedtypeDeclSyntax.unexpectedBetweenAssociatedtypeKeywordAndIdentifier: + return "unexpectedBetweenAssociatedtypeKeywordAndIdentifier" + case \AssociatedtypeDeclSyntax.identifier: + return "identifier" + case \AssociatedtypeDeclSyntax.unexpectedBetweenIdentifierAndInheritanceClause: + return "unexpectedBetweenIdentifierAndInheritanceClause" + case \AssociatedtypeDeclSyntax.inheritanceClause: + return "inheritanceClause" + case \AssociatedtypeDeclSyntax.unexpectedBetweenInheritanceClauseAndInitializer: + return "unexpectedBetweenInheritanceClauseAndInitializer" + case \AssociatedtypeDeclSyntax.initializer: + return "initializer" + case \AssociatedtypeDeclSyntax.unexpectedBetweenInitializerAndGenericWhereClause: + return "unexpectedBetweenInitializerAndGenericWhereClause" + case \AssociatedtypeDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \AssociatedtypeDeclSyntax.unexpectedAfterGenericWhereClause: + return "unexpectedAfterGenericWhereClause" + case \AttributeSyntax.unexpectedBeforeAtSignToken: + return "unexpectedBeforeAtSignToken" + case \AttributeSyntax.atSignToken: + return "atSignToken" + case \AttributeSyntax.unexpectedBetweenAtSignTokenAndAttributeName: + return "unexpectedBetweenAtSignTokenAndAttributeName" + case \AttributeSyntax.attributeName: + return "attributeName" + case \AttributeSyntax.unexpectedBetweenAttributeNameAndLeftParen: + return "unexpectedBetweenAttributeNameAndLeftParen" + case \AttributeSyntax.leftParen: + return "leftParen" + case \AttributeSyntax.unexpectedBetweenLeftParenAndArgument: + return "unexpectedBetweenLeftParenAndArgument" + case \AttributeSyntax.argument: + return "argument" + case \AttributeSyntax.unexpectedBetweenArgumentAndRightParen: + return "unexpectedBetweenArgumentAndRightParen" + case \AttributeSyntax.rightParen: + return "rightParen" + case \AttributeSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \AttributedTypeSyntax.unexpectedBeforeSpecifier: + return "unexpectedBeforeSpecifier" + case \AttributedTypeSyntax.specifier: + return "specifier" + case \AttributedTypeSyntax.unexpectedBetweenSpecifierAndAttributes: + return "unexpectedBetweenSpecifierAndAttributes" + case \AttributedTypeSyntax.attributes: + return "attributes" + case \AttributedTypeSyntax.unexpectedBetweenAttributesAndBaseType: + return "unexpectedBetweenAttributesAndBaseType" + case \AttributedTypeSyntax.baseType: + return "baseType" + case \AttributedTypeSyntax.unexpectedAfterBaseType: + return "unexpectedAfterBaseType" + case \AvailabilityArgumentSyntax.unexpectedBeforeEntry: + return "unexpectedBeforeEntry" + case \AvailabilityArgumentSyntax.entry: + return "entry" + case \AvailabilityArgumentSyntax.unexpectedBetweenEntryAndTrailingComma: + return "unexpectedBetweenEntryAndTrailingComma" + case \AvailabilityArgumentSyntax.trailingComma: + return "trailingComma" + case \AvailabilityArgumentSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \AvailabilityConditionSyntax.unexpectedBeforeAvailabilityKeyword: + return "unexpectedBeforeAvailabilityKeyword" + case \AvailabilityConditionSyntax.availabilityKeyword: + return "availabilityKeyword" + case \AvailabilityConditionSyntax.unexpectedBetweenAvailabilityKeywordAndLeftParen: + return "unexpectedBetweenAvailabilityKeywordAndLeftParen" + case \AvailabilityConditionSyntax.leftParen: + return "leftParen" + case \AvailabilityConditionSyntax.unexpectedBetweenLeftParenAndAvailabilitySpec: + return "unexpectedBetweenLeftParenAndAvailabilitySpec" + case \AvailabilityConditionSyntax.availabilitySpec: + return "availabilitySpec" + case \AvailabilityConditionSyntax.unexpectedBetweenAvailabilitySpecAndRightParen: + return "unexpectedBetweenAvailabilitySpecAndRightParen" + case \AvailabilityConditionSyntax.rightParen: + return "rightParen" + case \AvailabilityConditionSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \AvailabilityEntrySyntax.unexpectedBeforeLabel: + return "unexpectedBeforeLabel" + case \AvailabilityEntrySyntax.label: + return "label" + case \AvailabilityEntrySyntax.unexpectedBetweenLabelAndColon: + return "unexpectedBetweenLabelAndColon" + case \AvailabilityEntrySyntax.colon: + return "colon" + case \AvailabilityEntrySyntax.unexpectedBetweenColonAndAvailabilityList: + return "unexpectedBetweenColonAndAvailabilityList" + case \AvailabilityEntrySyntax.availabilityList: + return "availabilityList" + case \AvailabilityEntrySyntax.unexpectedBetweenAvailabilityListAndSemicolon: + return "unexpectedBetweenAvailabilityListAndSemicolon" + case \AvailabilityEntrySyntax.semicolon: + return "semicolon" + case \AvailabilityEntrySyntax.unexpectedAfterSemicolon: + return "unexpectedAfterSemicolon" + case \AvailabilityLabeledArgumentSyntax.unexpectedBeforeLabel: + return "unexpectedBeforeLabel" + case \AvailabilityLabeledArgumentSyntax.label: + return "label" + case \AvailabilityLabeledArgumentSyntax.unexpectedBetweenLabelAndColon: + return "unexpectedBetweenLabelAndColon" + case \AvailabilityLabeledArgumentSyntax.colon: + return "colon" + case \AvailabilityLabeledArgumentSyntax.unexpectedBetweenColonAndValue: + return "unexpectedBetweenColonAndValue" + case \AvailabilityLabeledArgumentSyntax.value: + return "value" + case \AvailabilityLabeledArgumentSyntax.unexpectedAfterValue: + return "unexpectedAfterValue" + case \AvailabilityVersionRestrictionListEntrySyntax.unexpectedBeforeAvailabilityVersionRestriction: + return "unexpectedBeforeAvailabilityVersionRestriction" + case \AvailabilityVersionRestrictionListEntrySyntax.availabilityVersionRestriction: + return "availabilityVersionRestriction" + case \AvailabilityVersionRestrictionListEntrySyntax.unexpectedBetweenAvailabilityVersionRestrictionAndTrailingComma: + return "unexpectedBetweenAvailabilityVersionRestrictionAndTrailingComma" + case \AvailabilityVersionRestrictionListEntrySyntax.trailingComma: + return "trailingComma" + case \AvailabilityVersionRestrictionListEntrySyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \AvailabilityVersionRestrictionSyntax.unexpectedBeforePlatform: + return "unexpectedBeforePlatform" + case \AvailabilityVersionRestrictionSyntax.platform: + return "platform" + case \AvailabilityVersionRestrictionSyntax.unexpectedBetweenPlatformAndVersion: + return "unexpectedBetweenPlatformAndVersion" + case \AvailabilityVersionRestrictionSyntax.version: + return "version" + case \AvailabilityVersionRestrictionSyntax.unexpectedAfterVersion: + return "unexpectedAfterVersion" + case \AwaitExprSyntax.unexpectedBeforeAwaitKeyword: + return "unexpectedBeforeAwaitKeyword" + case \AwaitExprSyntax.awaitKeyword: + return "awaitKeyword" + case \AwaitExprSyntax.unexpectedBetweenAwaitKeywordAndExpression: + return "unexpectedBetweenAwaitKeywordAndExpression" + case \AwaitExprSyntax.expression: + return "expression" + case \AwaitExprSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \BackDeployedAttributeSpecListSyntax.unexpectedBeforeBeforeLabel: + return "unexpectedBeforeBeforeLabel" + case \BackDeployedAttributeSpecListSyntax.beforeLabel: + return "beforeLabel" + case \BackDeployedAttributeSpecListSyntax.unexpectedBetweenBeforeLabelAndColon: + return "unexpectedBetweenBeforeLabelAndColon" + case \BackDeployedAttributeSpecListSyntax.colon: + return "colon" + case \BackDeployedAttributeSpecListSyntax.unexpectedBetweenColonAndVersionList: + return "unexpectedBetweenColonAndVersionList" + case \BackDeployedAttributeSpecListSyntax.versionList: + return "versionList" + case \BackDeployedAttributeSpecListSyntax.unexpectedAfterVersionList: + return "unexpectedAfterVersionList" + case \BinaryOperatorExprSyntax.unexpectedBeforeOperatorToken: + return "unexpectedBeforeOperatorToken" + case \BinaryOperatorExprSyntax.operatorToken: + return "operatorToken" + case \BinaryOperatorExprSyntax.unexpectedAfterOperatorToken: + return "unexpectedAfterOperatorToken" + case \BooleanLiteralExprSyntax.unexpectedBeforeBooleanLiteral: + return "unexpectedBeforeBooleanLiteral" + case \BooleanLiteralExprSyntax.booleanLiteral: + return "booleanLiteral" + case \BooleanLiteralExprSyntax.unexpectedAfterBooleanLiteral: + return "unexpectedAfterBooleanLiteral" + case \BorrowExprSyntax.unexpectedBeforeBorrowKeyword: + return "unexpectedBeforeBorrowKeyword" + case \BorrowExprSyntax.borrowKeyword: + return "borrowKeyword" + case \BorrowExprSyntax.unexpectedBetweenBorrowKeywordAndExpression: + return "unexpectedBetweenBorrowKeywordAndExpression" + case \BorrowExprSyntax.expression: + return "expression" + case \BorrowExprSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \BreakStmtSyntax.unexpectedBeforeBreakKeyword: + return "unexpectedBeforeBreakKeyword" + case \BreakStmtSyntax.breakKeyword: + return "breakKeyword" + case \BreakStmtSyntax.unexpectedBetweenBreakKeywordAndLabel: + return "unexpectedBetweenBreakKeywordAndLabel" + case \BreakStmtSyntax.label: + return "label" + case \BreakStmtSyntax.unexpectedAfterLabel: + return "unexpectedAfterLabel" + case \CaseItemSyntax.unexpectedBeforePattern: + return "unexpectedBeforePattern" + case \CaseItemSyntax.pattern: + return "pattern" + case \CaseItemSyntax.unexpectedBetweenPatternAndWhereClause: + return "unexpectedBetweenPatternAndWhereClause" + case \CaseItemSyntax.whereClause: + return "whereClause" + case \CaseItemSyntax.unexpectedBetweenWhereClauseAndTrailingComma: + return "unexpectedBetweenWhereClauseAndTrailingComma" + case \CaseItemSyntax.trailingComma: + return "trailingComma" + case \CaseItemSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \CatchClauseSyntax.unexpectedBeforeCatchKeyword: + return "unexpectedBeforeCatchKeyword" + case \CatchClauseSyntax.catchKeyword: + return "catchKeyword" + case \CatchClauseSyntax.unexpectedBetweenCatchKeywordAndCatchItems: + return "unexpectedBetweenCatchKeywordAndCatchItems" + case \CatchClauseSyntax.catchItems: + return "catchItems" + case \CatchClauseSyntax.unexpectedBetweenCatchItemsAndBody: + return "unexpectedBetweenCatchItemsAndBody" + case \CatchClauseSyntax.body: + return "body" + case \CatchClauseSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \CatchItemSyntax.unexpectedBeforePattern: + return "unexpectedBeforePattern" + case \CatchItemSyntax.pattern: + return "pattern" + case \CatchItemSyntax.unexpectedBetweenPatternAndWhereClause: + return "unexpectedBetweenPatternAndWhereClause" + case \CatchItemSyntax.whereClause: + return "whereClause" + case \CatchItemSyntax.unexpectedBetweenWhereClauseAndTrailingComma: + return "unexpectedBetweenWhereClauseAndTrailingComma" + case \CatchItemSyntax.trailingComma: + return "trailingComma" + case \CatchItemSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \ClassDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \ClassDeclSyntax.attributes: + return "attributes" + case \ClassDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \ClassDeclSyntax.modifiers: + return "modifiers" + case \ClassDeclSyntax.unexpectedBetweenModifiersAndClassKeyword: + return "unexpectedBetweenModifiersAndClassKeyword" + case \ClassDeclSyntax.classKeyword: + return "classKeyword" + case \ClassDeclSyntax.unexpectedBetweenClassKeywordAndIdentifier: + return "unexpectedBetweenClassKeywordAndIdentifier" + case \ClassDeclSyntax.identifier: + return "identifier" + case \ClassDeclSyntax.unexpectedBetweenIdentifierAndGenericParameterClause: + return "unexpectedBetweenIdentifierAndGenericParameterClause" + case \ClassDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \ClassDeclSyntax.unexpectedBetweenGenericParameterClauseAndInheritanceClause: + return "unexpectedBetweenGenericParameterClauseAndInheritanceClause" + case \ClassDeclSyntax.inheritanceClause: + return "inheritanceClause" + case \ClassDeclSyntax.unexpectedBetweenInheritanceClauseAndGenericWhereClause: + return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" + case \ClassDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \ClassDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: + return "unexpectedBetweenGenericWhereClauseAndMembers" + case \ClassDeclSyntax.members: + return "members" + case \ClassDeclSyntax.unexpectedAfterMembers: + return "unexpectedAfterMembers" + case \ClassRestrictionTypeSyntax.unexpectedBeforeClassKeyword: + return "unexpectedBeforeClassKeyword" + case \ClassRestrictionTypeSyntax.classKeyword: + return "classKeyword" + case \ClassRestrictionTypeSyntax.unexpectedAfterClassKeyword: + return "unexpectedAfterClassKeyword" + case \ClosureCaptureItemSpecifierSyntax.unexpectedBeforeSpecifier: + return "unexpectedBeforeSpecifier" + case \ClosureCaptureItemSpecifierSyntax.specifier: + return "specifier" + case \ClosureCaptureItemSpecifierSyntax.unexpectedBetweenSpecifierAndLeftParen: + return "unexpectedBetweenSpecifierAndLeftParen" + case \ClosureCaptureItemSpecifierSyntax.leftParen: + return "leftParen" + case \ClosureCaptureItemSpecifierSyntax.unexpectedBetweenLeftParenAndDetail: + return "unexpectedBetweenLeftParenAndDetail" + case \ClosureCaptureItemSpecifierSyntax.detail: + return "detail" + case \ClosureCaptureItemSpecifierSyntax.unexpectedBetweenDetailAndRightParen: + return "unexpectedBetweenDetailAndRightParen" + case \ClosureCaptureItemSpecifierSyntax.rightParen: + return "rightParen" + case \ClosureCaptureItemSpecifierSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \ClosureCaptureItemSyntax.unexpectedBeforeSpecifier: + return "unexpectedBeforeSpecifier" + case \ClosureCaptureItemSyntax.specifier: + return "specifier" + case \ClosureCaptureItemSyntax.unexpectedBetweenSpecifierAndName: + return "unexpectedBetweenSpecifierAndName" + case \ClosureCaptureItemSyntax.name: + return "name" + case \ClosureCaptureItemSyntax.unexpectedBetweenNameAndAssignToken: + return "unexpectedBetweenNameAndAssignToken" + case \ClosureCaptureItemSyntax.assignToken: + return "assignToken" + case \ClosureCaptureItemSyntax.unexpectedBetweenAssignTokenAndExpression: + return "unexpectedBetweenAssignTokenAndExpression" + case \ClosureCaptureItemSyntax.expression: + return "expression" + case \ClosureCaptureItemSyntax.unexpectedBetweenExpressionAndTrailingComma: + return "unexpectedBetweenExpressionAndTrailingComma" + case \ClosureCaptureItemSyntax.trailingComma: + return "trailingComma" + case \ClosureCaptureItemSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \ClosureCaptureSignatureSyntax.unexpectedBeforeLeftSquare: + return "unexpectedBeforeLeftSquare" + case \ClosureCaptureSignatureSyntax.leftSquare: + return "leftSquare" + case \ClosureCaptureSignatureSyntax.unexpectedBetweenLeftSquareAndItems: + return "unexpectedBetweenLeftSquareAndItems" + case \ClosureCaptureSignatureSyntax.items: + return "items" + case \ClosureCaptureSignatureSyntax.unexpectedBetweenItemsAndRightSquare: + return "unexpectedBetweenItemsAndRightSquare" + case \ClosureCaptureSignatureSyntax.rightSquare: + return "rightSquare" + case \ClosureCaptureSignatureSyntax.unexpectedAfterRightSquare: + return "unexpectedAfterRightSquare" + case \ClosureExprSyntax.unexpectedBeforeLeftBrace: + return "unexpectedBeforeLeftBrace" + case \ClosureExprSyntax.leftBrace: + return "leftBrace" + case \ClosureExprSyntax.unexpectedBetweenLeftBraceAndSignature: + return "unexpectedBetweenLeftBraceAndSignature" + case \ClosureExprSyntax.signature: + return "signature" + case \ClosureExprSyntax.unexpectedBetweenSignatureAndStatements: + return "unexpectedBetweenSignatureAndStatements" + case \ClosureExprSyntax.statements: + return "statements" + case \ClosureExprSyntax.unexpectedBetweenStatementsAndRightBrace: + return "unexpectedBetweenStatementsAndRightBrace" + case \ClosureExprSyntax.rightBrace: + return "rightBrace" + case \ClosureExprSyntax.unexpectedAfterRightBrace: + return "unexpectedAfterRightBrace" + case \ClosureParamSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \ClosureParamSyntax.name: + return "name" + case \ClosureParamSyntax.unexpectedBetweenNameAndTrailingComma: + return "unexpectedBetweenNameAndTrailingComma" + case \ClosureParamSyntax.trailingComma: + return "trailingComma" + case \ClosureParamSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \ClosureParameterClauseSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \ClosureParameterClauseSyntax.leftParen: + return "leftParen" + case \ClosureParameterClauseSyntax.unexpectedBetweenLeftParenAndParameterList: + return "unexpectedBetweenLeftParenAndParameterList" + case \ClosureParameterClauseSyntax.parameterList: + return "parameterList" + case \ClosureParameterClauseSyntax.unexpectedBetweenParameterListAndRightParen: + return "unexpectedBetweenParameterListAndRightParen" + case \ClosureParameterClauseSyntax.rightParen: + return "rightParen" + case \ClosureParameterClauseSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \ClosureParameterSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \ClosureParameterSyntax.attributes: + return "attributes" + case \ClosureParameterSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \ClosureParameterSyntax.modifiers: + return "modifiers" + case \ClosureParameterSyntax.unexpectedBetweenModifiersAndFirstName: + return "unexpectedBetweenModifiersAndFirstName" + case \ClosureParameterSyntax.firstName: + return "firstName" + case \ClosureParameterSyntax.unexpectedBetweenFirstNameAndSecondName: + return "unexpectedBetweenFirstNameAndSecondName" + case \ClosureParameterSyntax.secondName: + return "secondName" + case \ClosureParameterSyntax.unexpectedBetweenSecondNameAndColon: + return "unexpectedBetweenSecondNameAndColon" + case \ClosureParameterSyntax.colon: + return "colon" + case \ClosureParameterSyntax.unexpectedBetweenColonAndType: + return "unexpectedBetweenColonAndType" + case \ClosureParameterSyntax.type: + return "type" + case \ClosureParameterSyntax.unexpectedBetweenTypeAndEllipsis: + return "unexpectedBetweenTypeAndEllipsis" + case \ClosureParameterSyntax.ellipsis: + return "ellipsis" + case \ClosureParameterSyntax.unexpectedBetweenEllipsisAndTrailingComma: + return "unexpectedBetweenEllipsisAndTrailingComma" + case \ClosureParameterSyntax.trailingComma: + return "trailingComma" + case \ClosureParameterSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \ClosureSignatureSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \ClosureSignatureSyntax.attributes: + return "attributes" + case \ClosureSignatureSyntax.unexpectedBetweenAttributesAndCapture: + return "unexpectedBetweenAttributesAndCapture" + case \ClosureSignatureSyntax.capture: + return "capture" + case \ClosureSignatureSyntax.unexpectedBetweenCaptureAndInput: + return "unexpectedBetweenCaptureAndInput" + case \ClosureSignatureSyntax.input: + return "input" + case \ClosureSignatureSyntax.unexpectedBetweenInputAndEffectSpecifiers: + return "unexpectedBetweenInputAndEffectSpecifiers" + case \ClosureSignatureSyntax.effectSpecifiers: + return "effectSpecifiers" + case \ClosureSignatureSyntax.unexpectedBetweenEffectSpecifiersAndOutput: + return "unexpectedBetweenEffectSpecifiersAndOutput" + case \ClosureSignatureSyntax.output: + return "output" + case \ClosureSignatureSyntax.unexpectedBetweenOutputAndInTok: + return "unexpectedBetweenOutputAndInTok" + case \ClosureSignatureSyntax.inTok: + return "inTok" + case \ClosureSignatureSyntax.unexpectedAfterInTok: + return "unexpectedAfterInTok" + case \CodeBlockItemSyntax.unexpectedBeforeItem: + return "unexpectedBeforeItem" + case \CodeBlockItemSyntax.item: + return "item" + case \CodeBlockItemSyntax.unexpectedBetweenItemAndSemicolon: + return "unexpectedBetweenItemAndSemicolon" + case \CodeBlockItemSyntax.semicolon: + return "semicolon" + case \CodeBlockItemSyntax.unexpectedAfterSemicolon: + return "unexpectedAfterSemicolon" + case \CodeBlockSyntax.unexpectedBeforeLeftBrace: + return "unexpectedBeforeLeftBrace" + case \CodeBlockSyntax.leftBrace: + return "leftBrace" + case \CodeBlockSyntax.unexpectedBetweenLeftBraceAndStatements: + return "unexpectedBetweenLeftBraceAndStatements" + case \CodeBlockSyntax.statements: + return "statements" + case \CodeBlockSyntax.unexpectedBetweenStatementsAndRightBrace: + return "unexpectedBetweenStatementsAndRightBrace" + case \CodeBlockSyntax.rightBrace: + return "rightBrace" + case \CodeBlockSyntax.unexpectedAfterRightBrace: + return "unexpectedAfterRightBrace" + case \CompositionTypeElementSyntax.unexpectedBeforeType: + return "unexpectedBeforeType" + case \CompositionTypeElementSyntax.type: + return "type" + case \CompositionTypeElementSyntax.unexpectedBetweenTypeAndAmpersand: + return "unexpectedBetweenTypeAndAmpersand" + case \CompositionTypeElementSyntax.ampersand: + return "ampersand" + case \CompositionTypeElementSyntax.unexpectedAfterAmpersand: + return "unexpectedAfterAmpersand" + case \CompositionTypeSyntax.unexpectedBeforeElements: + return "unexpectedBeforeElements" + case \CompositionTypeSyntax.elements: + return "elements" + case \CompositionTypeSyntax.unexpectedAfterElements: + return "unexpectedAfterElements" + case \ConditionElementSyntax.unexpectedBeforeCondition: + return "unexpectedBeforeCondition" + case \ConditionElementSyntax.condition: + return "condition" + case \ConditionElementSyntax.unexpectedBetweenConditionAndTrailingComma: + return "unexpectedBetweenConditionAndTrailingComma" + case \ConditionElementSyntax.trailingComma: + return "trailingComma" + case \ConditionElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \ConformanceRequirementSyntax.unexpectedBeforeLeftTypeIdentifier: + return "unexpectedBeforeLeftTypeIdentifier" + case \ConformanceRequirementSyntax.leftTypeIdentifier: + return "leftTypeIdentifier" + case \ConformanceRequirementSyntax.unexpectedBetweenLeftTypeIdentifierAndColon: + return "unexpectedBetweenLeftTypeIdentifierAndColon" + case \ConformanceRequirementSyntax.colon: + return "colon" + case \ConformanceRequirementSyntax.unexpectedBetweenColonAndRightTypeIdentifier: + return "unexpectedBetweenColonAndRightTypeIdentifier" + case \ConformanceRequirementSyntax.rightTypeIdentifier: + return "rightTypeIdentifier" + case \ConformanceRequirementSyntax.unexpectedAfterRightTypeIdentifier: + return "unexpectedAfterRightTypeIdentifier" + case \ConstrainedSugarTypeSyntax.unexpectedBeforeSomeOrAnySpecifier: + return "unexpectedBeforeSomeOrAnySpecifier" + case \ConstrainedSugarTypeSyntax.someOrAnySpecifier: + return "someOrAnySpecifier" + case \ConstrainedSugarTypeSyntax.unexpectedBetweenSomeOrAnySpecifierAndBaseType: + return "unexpectedBetweenSomeOrAnySpecifierAndBaseType" + case \ConstrainedSugarTypeSyntax.baseType: + return "baseType" + case \ConstrainedSugarTypeSyntax.unexpectedAfterBaseType: + return "unexpectedAfterBaseType" + case \ContinueStmtSyntax.unexpectedBeforeContinueKeyword: + return "unexpectedBeforeContinueKeyword" + case \ContinueStmtSyntax.continueKeyword: + return "continueKeyword" + case \ContinueStmtSyntax.unexpectedBetweenContinueKeywordAndLabel: + return "unexpectedBetweenContinueKeywordAndLabel" + case \ContinueStmtSyntax.label: + return "label" + case \ContinueStmtSyntax.unexpectedAfterLabel: + return "unexpectedAfterLabel" + case \ConventionAttributeArgumentsSyntax.unexpectedBeforeConventionLabel: + return "unexpectedBeforeConventionLabel" + case \ConventionAttributeArgumentsSyntax.conventionLabel: + return "conventionLabel" + case \ConventionAttributeArgumentsSyntax.unexpectedBetweenConventionLabelAndComma: + return "unexpectedBetweenConventionLabelAndComma" + case \ConventionAttributeArgumentsSyntax.comma: + return "comma" + case \ConventionAttributeArgumentsSyntax.unexpectedBetweenCommaAndCTypeLabel: + return "unexpectedBetweenCommaAndCTypeLabel" + case \ConventionAttributeArgumentsSyntax.cTypeLabel: + return "cTypeLabel" + case \ConventionAttributeArgumentsSyntax.unexpectedBetweenCTypeLabelAndColon: + return "unexpectedBetweenCTypeLabelAndColon" + case \ConventionAttributeArgumentsSyntax.colon: + return "colon" + case \ConventionAttributeArgumentsSyntax.unexpectedBetweenColonAndCTypeString: + return "unexpectedBetweenColonAndCTypeString" + case \ConventionAttributeArgumentsSyntax.cTypeString: + return "cTypeString" + case \ConventionAttributeArgumentsSyntax.unexpectedAfterCTypeString: + return "unexpectedAfterCTypeString" + case \ConventionWitnessMethodAttributeArgumentsSyntax.unexpectedBeforeWitnessMethodLabel: + return "unexpectedBeforeWitnessMethodLabel" + case \ConventionWitnessMethodAttributeArgumentsSyntax.witnessMethodLabel: + return "witnessMethodLabel" + case \ConventionWitnessMethodAttributeArgumentsSyntax.unexpectedBetweenWitnessMethodLabelAndColon: + return "unexpectedBetweenWitnessMethodLabelAndColon" + case \ConventionWitnessMethodAttributeArgumentsSyntax.colon: + return "colon" + case \ConventionWitnessMethodAttributeArgumentsSyntax.unexpectedBetweenColonAndProtocolName: + return "unexpectedBetweenColonAndProtocolName" + case \ConventionWitnessMethodAttributeArgumentsSyntax.protocolName: + return "protocolName" + case \ConventionWitnessMethodAttributeArgumentsSyntax.unexpectedAfterProtocolName: + return "unexpectedAfterProtocolName" + case \DeclModifierDetailSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \DeclModifierDetailSyntax.leftParen: + return "leftParen" + case \DeclModifierDetailSyntax.unexpectedBetweenLeftParenAndDetail: + return "unexpectedBetweenLeftParenAndDetail" + case \DeclModifierDetailSyntax.detail: + return "detail" + case \DeclModifierDetailSyntax.unexpectedBetweenDetailAndRightParen: + return "unexpectedBetweenDetailAndRightParen" + case \DeclModifierDetailSyntax.rightParen: + return "rightParen" + case \DeclModifierDetailSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \DeclModifierSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \DeclModifierSyntax.name: + return "name" + case \DeclModifierSyntax.unexpectedBetweenNameAndDetail: + return "unexpectedBetweenNameAndDetail" + case \DeclModifierSyntax.detail: + return "detail" + case \DeclModifierSyntax.unexpectedAfterDetail: + return "unexpectedAfterDetail" + case \DeclNameArgumentSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \DeclNameArgumentSyntax.name: + return "name" + case \DeclNameArgumentSyntax.unexpectedBetweenNameAndColon: + return "unexpectedBetweenNameAndColon" + case \DeclNameArgumentSyntax.colon: + return "colon" + case \DeclNameArgumentSyntax.unexpectedAfterColon: + return "unexpectedAfterColon" + case \DeclNameArgumentsSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \DeclNameArgumentsSyntax.leftParen: + return "leftParen" + case \DeclNameArgumentsSyntax.unexpectedBetweenLeftParenAndArguments: + return "unexpectedBetweenLeftParenAndArguments" + case \DeclNameArgumentsSyntax.arguments: + return "arguments" + case \DeclNameArgumentsSyntax.unexpectedBetweenArgumentsAndRightParen: + return "unexpectedBetweenArgumentsAndRightParen" + case \DeclNameArgumentsSyntax.rightParen: + return "rightParen" + case \DeclNameArgumentsSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \DeclNameSyntax.unexpectedBeforeDeclBaseName: + return "unexpectedBeforeDeclBaseName" + case \DeclNameSyntax.declBaseName: + return "declBaseName" + case \DeclNameSyntax.unexpectedBetweenDeclBaseNameAndDeclNameArguments: + return "unexpectedBetweenDeclBaseNameAndDeclNameArguments" + case \DeclNameSyntax.declNameArguments: + return "declNameArguments" + case \DeclNameSyntax.unexpectedAfterDeclNameArguments: + return "unexpectedAfterDeclNameArguments" + case \DeferStmtSyntax.unexpectedBeforeDeferKeyword: + return "unexpectedBeforeDeferKeyword" + case \DeferStmtSyntax.deferKeyword: + return "deferKeyword" + case \DeferStmtSyntax.unexpectedBetweenDeferKeywordAndBody: + return "unexpectedBetweenDeferKeywordAndBody" + case \DeferStmtSyntax.body: + return "body" + case \DeferStmtSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \DeinitializerDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \DeinitializerDeclSyntax.attributes: + return "attributes" + case \DeinitializerDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \DeinitializerDeclSyntax.modifiers: + return "modifiers" + case \DeinitializerDeclSyntax.unexpectedBetweenModifiersAndDeinitKeyword: + return "unexpectedBetweenModifiersAndDeinitKeyword" + case \DeinitializerDeclSyntax.deinitKeyword: + return "deinitKeyword" + case \DeinitializerDeclSyntax.unexpectedBetweenDeinitKeywordAndBody: + return "unexpectedBetweenDeinitKeywordAndBody" + case \DeinitializerDeclSyntax.body: + return "body" + case \DeinitializerDeclSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedBeforeOfLabel: + return "unexpectedBeforeOfLabel" + case \DerivativeRegistrationAttributeArgumentsSyntax.ofLabel: + return "ofLabel" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedBetweenOfLabelAndColon: + return "unexpectedBetweenOfLabelAndColon" + case \DerivativeRegistrationAttributeArgumentsSyntax.colon: + return "colon" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedBetweenColonAndOriginalDeclName: + return "unexpectedBetweenColonAndOriginalDeclName" + case \DerivativeRegistrationAttributeArgumentsSyntax.originalDeclName: + return "originalDeclName" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedBetweenOriginalDeclNameAndPeriod: + return "unexpectedBetweenOriginalDeclNameAndPeriod" + case \DerivativeRegistrationAttributeArgumentsSyntax.period: + return "period" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedBetweenPeriodAndAccessorKind: + return "unexpectedBetweenPeriodAndAccessorKind" + case \DerivativeRegistrationAttributeArgumentsSyntax.accessorKind: + return "accessorKind" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedBetweenAccessorKindAndComma: + return "unexpectedBetweenAccessorKindAndComma" + case \DerivativeRegistrationAttributeArgumentsSyntax.comma: + return "comma" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedBetweenCommaAndDiffParams: + return "unexpectedBetweenCommaAndDiffParams" + case \DerivativeRegistrationAttributeArgumentsSyntax.diffParams: + return "diffParams" + case \DerivativeRegistrationAttributeArgumentsSyntax.unexpectedAfterDiffParams: + return "unexpectedAfterDiffParams" + case \DesignatedTypeElementSyntax.unexpectedBeforeLeadingComma: + return "unexpectedBeforeLeadingComma" + case \DesignatedTypeElementSyntax.leadingComma: + return "leadingComma" + case \DesignatedTypeElementSyntax.unexpectedBetweenLeadingCommaAndName: + return "unexpectedBetweenLeadingCommaAndName" + case \DesignatedTypeElementSyntax.name: + return "name" + case \DesignatedTypeElementSyntax.unexpectedAfterName: + return "unexpectedAfterName" + case \DictionaryElementSyntax.unexpectedBeforeKeyExpression: + return "unexpectedBeforeKeyExpression" + case \DictionaryElementSyntax.keyExpression: + return "keyExpression" + case \DictionaryElementSyntax.unexpectedBetweenKeyExpressionAndColon: + return "unexpectedBetweenKeyExpressionAndColon" + case \DictionaryElementSyntax.colon: + return "colon" + case \DictionaryElementSyntax.unexpectedBetweenColonAndValueExpression: + return "unexpectedBetweenColonAndValueExpression" + case \DictionaryElementSyntax.valueExpression: + return "valueExpression" + case \DictionaryElementSyntax.unexpectedBetweenValueExpressionAndTrailingComma: + return "unexpectedBetweenValueExpressionAndTrailingComma" + case \DictionaryElementSyntax.trailingComma: + return "trailingComma" + case \DictionaryElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \DictionaryExprSyntax.unexpectedBeforeLeftSquare: + return "unexpectedBeforeLeftSquare" + case \DictionaryExprSyntax.leftSquare: + return "leftSquare" + case \DictionaryExprSyntax.unexpectedBetweenLeftSquareAndContent: + return "unexpectedBetweenLeftSquareAndContent" + case \DictionaryExprSyntax.content: + return "content" + case \DictionaryExprSyntax.unexpectedBetweenContentAndRightSquare: + return "unexpectedBetweenContentAndRightSquare" + case \DictionaryExprSyntax.rightSquare: + return "rightSquare" + case \DictionaryExprSyntax.unexpectedAfterRightSquare: + return "unexpectedAfterRightSquare" + case \DictionaryTypeSyntax.unexpectedBeforeLeftSquareBracket: + return "unexpectedBeforeLeftSquareBracket" + case \DictionaryTypeSyntax.leftSquareBracket: + return "leftSquareBracket" + case \DictionaryTypeSyntax.unexpectedBetweenLeftSquareBracketAndKeyType: + return "unexpectedBetweenLeftSquareBracketAndKeyType" + case \DictionaryTypeSyntax.keyType: + return "keyType" + case \DictionaryTypeSyntax.unexpectedBetweenKeyTypeAndColon: + return "unexpectedBetweenKeyTypeAndColon" + case \DictionaryTypeSyntax.colon: + return "colon" + case \DictionaryTypeSyntax.unexpectedBetweenColonAndValueType: + return "unexpectedBetweenColonAndValueType" + case \DictionaryTypeSyntax.valueType: + return "valueType" + case \DictionaryTypeSyntax.unexpectedBetweenValueTypeAndRightSquareBracket: + return "unexpectedBetweenValueTypeAndRightSquareBracket" + case \DictionaryTypeSyntax.rightSquareBracket: + return "rightSquareBracket" + case \DictionaryTypeSyntax.unexpectedAfterRightSquareBracket: + return "unexpectedAfterRightSquareBracket" + case \DifferentiabilityParamSyntax.unexpectedBeforeParameter: + return "unexpectedBeforeParameter" + case \DifferentiabilityParamSyntax.parameter: + return "parameter" + case \DifferentiabilityParamSyntax.unexpectedBetweenParameterAndTrailingComma: + return "unexpectedBetweenParameterAndTrailingComma" + case \DifferentiabilityParamSyntax.trailingComma: + return "trailingComma" + case \DifferentiabilityParamSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \DifferentiabilityParamsClauseSyntax.unexpectedBeforeWrtLabel: + return "unexpectedBeforeWrtLabel" + case \DifferentiabilityParamsClauseSyntax.wrtLabel: + return "wrtLabel" + case \DifferentiabilityParamsClauseSyntax.unexpectedBetweenWrtLabelAndColon: + return "unexpectedBetweenWrtLabelAndColon" + case \DifferentiabilityParamsClauseSyntax.colon: + return "colon" + case \DifferentiabilityParamsClauseSyntax.unexpectedBetweenColonAndParameters: + return "unexpectedBetweenColonAndParameters" + case \DifferentiabilityParamsClauseSyntax.parameters: + return "parameters" + case \DifferentiabilityParamsClauseSyntax.unexpectedAfterParameters: + return "unexpectedAfterParameters" + case \DifferentiabilityParamsSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \DifferentiabilityParamsSyntax.leftParen: + return "leftParen" + case \DifferentiabilityParamsSyntax.unexpectedBetweenLeftParenAndDiffParams: + return "unexpectedBetweenLeftParenAndDiffParams" + case \DifferentiabilityParamsSyntax.diffParams: + return "diffParams" + case \DifferentiabilityParamsSyntax.unexpectedBetweenDiffParamsAndRightParen: + return "unexpectedBetweenDiffParamsAndRightParen" + case \DifferentiabilityParamsSyntax.rightParen: + return "rightParen" + case \DifferentiabilityParamsSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \DifferentiableAttributeArgumentsSyntax.unexpectedBeforeDiffKind: + return "unexpectedBeforeDiffKind" + case \DifferentiableAttributeArgumentsSyntax.diffKind: + return "diffKind" + case \DifferentiableAttributeArgumentsSyntax.unexpectedBetweenDiffKindAndDiffKindComma: + return "unexpectedBetweenDiffKindAndDiffKindComma" + case \DifferentiableAttributeArgumentsSyntax.diffKindComma: + return "diffKindComma" + case \DifferentiableAttributeArgumentsSyntax.unexpectedBetweenDiffKindCommaAndDiffParams: + return "unexpectedBetweenDiffKindCommaAndDiffParams" + case \DifferentiableAttributeArgumentsSyntax.diffParams: + return "diffParams" + case \DifferentiableAttributeArgumentsSyntax.unexpectedBetweenDiffParamsAndDiffParamsComma: + return "unexpectedBetweenDiffParamsAndDiffParamsComma" + case \DifferentiableAttributeArgumentsSyntax.diffParamsComma: + return "diffParamsComma" + case \DifferentiableAttributeArgumentsSyntax.unexpectedBetweenDiffParamsCommaAndWhereClause: + return "unexpectedBetweenDiffParamsCommaAndWhereClause" + case \DifferentiableAttributeArgumentsSyntax.whereClause: + return "whereClause" + case \DifferentiableAttributeArgumentsSyntax.unexpectedAfterWhereClause: + return "unexpectedAfterWhereClause" + case \DiscardAssignmentExprSyntax.unexpectedBeforeWildcard: + return "unexpectedBeforeWildcard" + case \DiscardAssignmentExprSyntax.wildcard: + return "wildcard" + case \DiscardAssignmentExprSyntax.unexpectedAfterWildcard: + return "unexpectedAfterWildcard" + case \DoStmtSyntax.unexpectedBeforeDoKeyword: + return "unexpectedBeforeDoKeyword" + case \DoStmtSyntax.doKeyword: + return "doKeyword" + case \DoStmtSyntax.unexpectedBetweenDoKeywordAndBody: + return "unexpectedBetweenDoKeywordAndBody" + case \DoStmtSyntax.body: + return "body" + case \DoStmtSyntax.unexpectedBetweenBodyAndCatchClauses: + return "unexpectedBetweenBodyAndCatchClauses" + case \DoStmtSyntax.catchClauses: + return "catchClauses" + case \DoStmtSyntax.unexpectedAfterCatchClauses: + return "unexpectedAfterCatchClauses" + case \DocumentationAttributeArgumentSyntax.unexpectedBeforeLabel: + return "unexpectedBeforeLabel" + case \DocumentationAttributeArgumentSyntax.label: + return "label" + case \DocumentationAttributeArgumentSyntax.unexpectedBetweenLabelAndColon: + return "unexpectedBetweenLabelAndColon" + case \DocumentationAttributeArgumentSyntax.colon: + return "colon" + case \DocumentationAttributeArgumentSyntax.unexpectedBetweenColonAndValue: + return "unexpectedBetweenColonAndValue" + case \DocumentationAttributeArgumentSyntax.value: + return "value" + case \DocumentationAttributeArgumentSyntax.unexpectedBetweenValueAndTrailingComma: + return "unexpectedBetweenValueAndTrailingComma" + case \DocumentationAttributeArgumentSyntax.trailingComma: + return "trailingComma" + case \DocumentationAttributeArgumentSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \DynamicReplacementArgumentsSyntax.unexpectedBeforeForLabel: + return "unexpectedBeforeForLabel" + case \DynamicReplacementArgumentsSyntax.forLabel: + return "forLabel" + case \DynamicReplacementArgumentsSyntax.unexpectedBetweenForLabelAndColon: + return "unexpectedBetweenForLabelAndColon" + case \DynamicReplacementArgumentsSyntax.colon: + return "colon" + case \DynamicReplacementArgumentsSyntax.unexpectedBetweenColonAndDeclname: + return "unexpectedBetweenColonAndDeclname" + case \DynamicReplacementArgumentsSyntax.declname: + return "declname" + case \DynamicReplacementArgumentsSyntax.unexpectedAfterDeclname: + return "unexpectedAfterDeclname" + case \EditorPlaceholderDeclSyntax.unexpectedBeforeIdentifier: + return "unexpectedBeforeIdentifier" + case \EditorPlaceholderDeclSyntax.identifier: + return "identifier" + case \EditorPlaceholderDeclSyntax.unexpectedAfterIdentifier: + return "unexpectedAfterIdentifier" + case \EditorPlaceholderExprSyntax.unexpectedBeforeIdentifier: + return "unexpectedBeforeIdentifier" + case \EditorPlaceholderExprSyntax.identifier: + return "identifier" + case \EditorPlaceholderExprSyntax.unexpectedAfterIdentifier: + return "unexpectedAfterIdentifier" + case \EnumCaseDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \EnumCaseDeclSyntax.attributes: + return "attributes" + case \EnumCaseDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \EnumCaseDeclSyntax.modifiers: + return "modifiers" + case \EnumCaseDeclSyntax.unexpectedBetweenModifiersAndCaseKeyword: + return "unexpectedBetweenModifiersAndCaseKeyword" + case \EnumCaseDeclSyntax.caseKeyword: + return "caseKeyword" + case \EnumCaseDeclSyntax.unexpectedBetweenCaseKeywordAndElements: + return "unexpectedBetweenCaseKeywordAndElements" + case \EnumCaseDeclSyntax.elements: + return "elements" + case \EnumCaseDeclSyntax.unexpectedAfterElements: + return "unexpectedAfterElements" + case \EnumCaseElementSyntax.unexpectedBeforeIdentifier: + return "unexpectedBeforeIdentifier" + case \EnumCaseElementSyntax.identifier: + return "identifier" + case \EnumCaseElementSyntax.unexpectedBetweenIdentifierAndAssociatedValue: + return "unexpectedBetweenIdentifierAndAssociatedValue" + case \EnumCaseElementSyntax.associatedValue: + return "associatedValue" + case \EnumCaseElementSyntax.unexpectedBetweenAssociatedValueAndRawValue: + return "unexpectedBetweenAssociatedValueAndRawValue" + case \EnumCaseElementSyntax.rawValue: + return "rawValue" + case \EnumCaseElementSyntax.unexpectedBetweenRawValueAndTrailingComma: + return "unexpectedBetweenRawValueAndTrailingComma" + case \EnumCaseElementSyntax.trailingComma: + return "trailingComma" + case \EnumCaseElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \EnumCaseParameterClauseSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \EnumCaseParameterClauseSyntax.leftParen: + return "leftParen" + case \EnumCaseParameterClauseSyntax.unexpectedBetweenLeftParenAndParameterList: + return "unexpectedBetweenLeftParenAndParameterList" + case \EnumCaseParameterClauseSyntax.parameterList: + return "parameterList" + case \EnumCaseParameterClauseSyntax.unexpectedBetweenParameterListAndRightParen: + return "unexpectedBetweenParameterListAndRightParen" + case \EnumCaseParameterClauseSyntax.rightParen: + return "rightParen" + case \EnumCaseParameterClauseSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \EnumCaseParameterSyntax.unexpectedBeforeModifiers: + return "unexpectedBeforeModifiers" + case \EnumCaseParameterSyntax.modifiers: + return "modifiers" + case \EnumCaseParameterSyntax.unexpectedBetweenModifiersAndFirstName: + return "unexpectedBetweenModifiersAndFirstName" + case \EnumCaseParameterSyntax.firstName: + return "firstName" + case \EnumCaseParameterSyntax.unexpectedBetweenFirstNameAndSecondName: + return "unexpectedBetweenFirstNameAndSecondName" + case \EnumCaseParameterSyntax.secondName: + return "secondName" + case \EnumCaseParameterSyntax.unexpectedBetweenSecondNameAndColon: + return "unexpectedBetweenSecondNameAndColon" + case \EnumCaseParameterSyntax.colon: + return "colon" + case \EnumCaseParameterSyntax.unexpectedBetweenColonAndType: + return "unexpectedBetweenColonAndType" + case \EnumCaseParameterSyntax.type: + return "type" + case \EnumCaseParameterSyntax.unexpectedBetweenTypeAndDefaultArgument: + return "unexpectedBetweenTypeAndDefaultArgument" + case \EnumCaseParameterSyntax.defaultArgument: + return "defaultArgument" + case \EnumCaseParameterSyntax.unexpectedBetweenDefaultArgumentAndTrailingComma: + return "unexpectedBetweenDefaultArgumentAndTrailingComma" + case \EnumCaseParameterSyntax.trailingComma: + return "trailingComma" + case \EnumCaseParameterSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \EnumDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \EnumDeclSyntax.attributes: + return "attributes" + case \EnumDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \EnumDeclSyntax.modifiers: + return "modifiers" + case \EnumDeclSyntax.unexpectedBetweenModifiersAndEnumKeyword: + return "unexpectedBetweenModifiersAndEnumKeyword" + case \EnumDeclSyntax.enumKeyword: + return "enumKeyword" + case \EnumDeclSyntax.unexpectedBetweenEnumKeywordAndIdentifier: + return "unexpectedBetweenEnumKeywordAndIdentifier" + case \EnumDeclSyntax.identifier: + return "identifier" + case \EnumDeclSyntax.unexpectedBetweenIdentifierAndGenericParameters: + return "unexpectedBetweenIdentifierAndGenericParameters" + case \EnumDeclSyntax.genericParameters: + return "genericParameters" + case \EnumDeclSyntax.unexpectedBetweenGenericParametersAndInheritanceClause: + return "unexpectedBetweenGenericParametersAndInheritanceClause" + case \EnumDeclSyntax.inheritanceClause: + return "inheritanceClause" + case \EnumDeclSyntax.unexpectedBetweenInheritanceClauseAndGenericWhereClause: + return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" + case \EnumDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \EnumDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: + return "unexpectedBetweenGenericWhereClauseAndMembers" + case \EnumDeclSyntax.members: + return "members" + case \EnumDeclSyntax.unexpectedAfterMembers: + return "unexpectedAfterMembers" + case \ExposeAttributeArgumentsSyntax.unexpectedBeforeLanguage: + return "unexpectedBeforeLanguage" + case \ExposeAttributeArgumentsSyntax.language: + return "language" + case \ExposeAttributeArgumentsSyntax.unexpectedBetweenLanguageAndComma: + return "unexpectedBetweenLanguageAndComma" + case \ExposeAttributeArgumentsSyntax.comma: + return "comma" + case \ExposeAttributeArgumentsSyntax.unexpectedBetweenCommaAndCxxName: + return "unexpectedBetweenCommaAndCxxName" + case \ExposeAttributeArgumentsSyntax.cxxName: + return "cxxName" + case \ExposeAttributeArgumentsSyntax.unexpectedAfterCxxName: + return "unexpectedAfterCxxName" + case \ExpressionPatternSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \ExpressionPatternSyntax.expression: + return "expression" + case \ExpressionPatternSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \ExpressionSegmentSyntax.unexpectedBeforeBackslash: + return "unexpectedBeforeBackslash" + case \ExpressionSegmentSyntax.backslash: + return "backslash" + case \ExpressionSegmentSyntax.unexpectedBetweenBackslashAndDelimiter: + return "unexpectedBetweenBackslashAndDelimiter" + case \ExpressionSegmentSyntax.delimiter: + return "delimiter" + case \ExpressionSegmentSyntax.unexpectedBetweenDelimiterAndLeftParen: + return "unexpectedBetweenDelimiterAndLeftParen" + case \ExpressionSegmentSyntax.leftParen: + return "leftParen" + case \ExpressionSegmentSyntax.unexpectedBetweenLeftParenAndExpressions: + return "unexpectedBetweenLeftParenAndExpressions" + case \ExpressionSegmentSyntax.expressions: + return "expressions" + case \ExpressionSegmentSyntax.unexpectedBetweenExpressionsAndRightParen: + return "unexpectedBetweenExpressionsAndRightParen" + case \ExpressionSegmentSyntax.rightParen: + return "rightParen" + case \ExpressionSegmentSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \ExpressionStmtSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \ExpressionStmtSyntax.expression: + return "expression" + case \ExpressionStmtSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \ExtensionDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \ExtensionDeclSyntax.attributes: + return "attributes" + case \ExtensionDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \ExtensionDeclSyntax.modifiers: + return "modifiers" + case \ExtensionDeclSyntax.unexpectedBetweenModifiersAndExtensionKeyword: + return "unexpectedBetweenModifiersAndExtensionKeyword" + case \ExtensionDeclSyntax.extensionKeyword: + return "extensionKeyword" + case \ExtensionDeclSyntax.unexpectedBetweenExtensionKeywordAndExtendedType: + return "unexpectedBetweenExtensionKeywordAndExtendedType" + case \ExtensionDeclSyntax.extendedType: + return "extendedType" + case \ExtensionDeclSyntax.unexpectedBetweenExtendedTypeAndInheritanceClause: + return "unexpectedBetweenExtendedTypeAndInheritanceClause" + case \ExtensionDeclSyntax.inheritanceClause: + return "inheritanceClause" + case \ExtensionDeclSyntax.unexpectedBetweenInheritanceClauseAndGenericWhereClause: + return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" + case \ExtensionDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \ExtensionDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: + return "unexpectedBetweenGenericWhereClauseAndMembers" + case \ExtensionDeclSyntax.members: + return "members" + case \ExtensionDeclSyntax.unexpectedAfterMembers: + return "unexpectedAfterMembers" + case \FallthroughStmtSyntax.unexpectedBeforeFallthroughKeyword: + return "unexpectedBeforeFallthroughKeyword" + case \FallthroughStmtSyntax.fallthroughKeyword: + return "fallthroughKeyword" + case \FallthroughStmtSyntax.unexpectedAfterFallthroughKeyword: + return "unexpectedAfterFallthroughKeyword" + case \FloatLiteralExprSyntax.unexpectedBeforeFloatingDigits: + return "unexpectedBeforeFloatingDigits" + case \FloatLiteralExprSyntax.floatingDigits: + return "floatingDigits" + case \FloatLiteralExprSyntax.unexpectedAfterFloatingDigits: + return "unexpectedAfterFloatingDigits" + case \ForInStmtSyntax.unexpectedBeforeForKeyword: + return "unexpectedBeforeForKeyword" + case \ForInStmtSyntax.forKeyword: + return "forKeyword" + case \ForInStmtSyntax.unexpectedBetweenForKeywordAndTryKeyword: + return "unexpectedBetweenForKeywordAndTryKeyword" + case \ForInStmtSyntax.tryKeyword: + return "tryKeyword" + case \ForInStmtSyntax.unexpectedBetweenTryKeywordAndAwaitKeyword: + return "unexpectedBetweenTryKeywordAndAwaitKeyword" + case \ForInStmtSyntax.awaitKeyword: + return "awaitKeyword" + case \ForInStmtSyntax.unexpectedBetweenAwaitKeywordAndCaseKeyword: + return "unexpectedBetweenAwaitKeywordAndCaseKeyword" + case \ForInStmtSyntax.caseKeyword: + return "caseKeyword" + case \ForInStmtSyntax.unexpectedBetweenCaseKeywordAndPattern: + return "unexpectedBetweenCaseKeywordAndPattern" + case \ForInStmtSyntax.pattern: + return "pattern" + case \ForInStmtSyntax.unexpectedBetweenPatternAndTypeAnnotation: + return "unexpectedBetweenPatternAndTypeAnnotation" + case \ForInStmtSyntax.typeAnnotation: + return "typeAnnotation" + case \ForInStmtSyntax.unexpectedBetweenTypeAnnotationAndInKeyword: + return "unexpectedBetweenTypeAnnotationAndInKeyword" + case \ForInStmtSyntax.inKeyword: + return "inKeyword" + case \ForInStmtSyntax.unexpectedBetweenInKeywordAndSequenceExpr: + return "unexpectedBetweenInKeywordAndSequenceExpr" + case \ForInStmtSyntax.sequenceExpr: + return "sequenceExpr" + case \ForInStmtSyntax.unexpectedBetweenSequenceExprAndWhereClause: + return "unexpectedBetweenSequenceExprAndWhereClause" + case \ForInStmtSyntax.whereClause: + return "whereClause" + case \ForInStmtSyntax.unexpectedBetweenWhereClauseAndBody: + return "unexpectedBetweenWhereClauseAndBody" + case \ForInStmtSyntax.body: + return "body" + case \ForInStmtSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \ForcedValueExprSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \ForcedValueExprSyntax.expression: + return "expression" + case \ForcedValueExprSyntax.unexpectedBetweenExpressionAndExclamationMark: + return "unexpectedBetweenExpressionAndExclamationMark" + case \ForcedValueExprSyntax.exclamationMark: + return "exclamationMark" + case \ForcedValueExprSyntax.unexpectedAfterExclamationMark: + return "unexpectedAfterExclamationMark" + case \ForgetStmtSyntax.unexpectedBeforeForgetKeyword: + return "unexpectedBeforeForgetKeyword" + case \ForgetStmtSyntax.forgetKeyword: + return "forgetKeyword" + case \ForgetStmtSyntax.unexpectedBetweenForgetKeywordAndExpression: + return "unexpectedBetweenForgetKeywordAndExpression" + case \ForgetStmtSyntax.expression: + return "expression" + case \ForgetStmtSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \FunctionCallExprSyntax.unexpectedBeforeCalledExpression: + return "unexpectedBeforeCalledExpression" + case \FunctionCallExprSyntax.calledExpression: + return "calledExpression" + case \FunctionCallExprSyntax.unexpectedBetweenCalledExpressionAndLeftParen: + return "unexpectedBetweenCalledExpressionAndLeftParen" + case \FunctionCallExprSyntax.leftParen: + return "leftParen" + case \FunctionCallExprSyntax.unexpectedBetweenLeftParenAndArgumentList: + return "unexpectedBetweenLeftParenAndArgumentList" + case \FunctionCallExprSyntax.argumentList: + return "argumentList" + case \FunctionCallExprSyntax.unexpectedBetweenArgumentListAndRightParen: + return "unexpectedBetweenArgumentListAndRightParen" + case \FunctionCallExprSyntax.rightParen: + return "rightParen" + case \FunctionCallExprSyntax.unexpectedBetweenRightParenAndTrailingClosure: + return "unexpectedBetweenRightParenAndTrailingClosure" + case \FunctionCallExprSyntax.trailingClosure: + return "trailingClosure" + case \FunctionCallExprSyntax.unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: + return "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures" + case \FunctionCallExprSyntax.additionalTrailingClosures: + return "additionalTrailingClosures" + case \FunctionCallExprSyntax.unexpectedAfterAdditionalTrailingClosures: + return "unexpectedAfterAdditionalTrailingClosures" + case \FunctionDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \FunctionDeclSyntax.attributes: + return "attributes" + case \FunctionDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \FunctionDeclSyntax.modifiers: + return "modifiers" + case \FunctionDeclSyntax.unexpectedBetweenModifiersAndFuncKeyword: + return "unexpectedBetweenModifiersAndFuncKeyword" + case \FunctionDeclSyntax.funcKeyword: + return "funcKeyword" + case \FunctionDeclSyntax.unexpectedBetweenFuncKeywordAndIdentifier: + return "unexpectedBetweenFuncKeywordAndIdentifier" + case \FunctionDeclSyntax.identifier: + return "identifier" + case \FunctionDeclSyntax.unexpectedBetweenIdentifierAndGenericParameterClause: + return "unexpectedBetweenIdentifierAndGenericParameterClause" + case \FunctionDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \FunctionDeclSyntax.unexpectedBetweenGenericParameterClauseAndSignature: + return "unexpectedBetweenGenericParameterClauseAndSignature" + case \FunctionDeclSyntax.signature: + return "signature" + case \FunctionDeclSyntax.unexpectedBetweenSignatureAndGenericWhereClause: + return "unexpectedBetweenSignatureAndGenericWhereClause" + case \FunctionDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \FunctionDeclSyntax.unexpectedBetweenGenericWhereClauseAndBody: + return "unexpectedBetweenGenericWhereClauseAndBody" + case \FunctionDeclSyntax.body: + return "body" + case \FunctionDeclSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \FunctionEffectSpecifiersSyntax.unexpectedBeforeAsyncSpecifier: + return "unexpectedBeforeAsyncSpecifier" + case \FunctionEffectSpecifiersSyntax.asyncSpecifier: + return "asyncSpecifier" + case \FunctionEffectSpecifiersSyntax.unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: + return "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier" + case \FunctionEffectSpecifiersSyntax.throwsSpecifier: + return "throwsSpecifier" + case \FunctionEffectSpecifiersSyntax.unexpectedAfterThrowsSpecifier: + return "unexpectedAfterThrowsSpecifier" + case \FunctionParameterSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \FunctionParameterSyntax.attributes: + return "attributes" + case \FunctionParameterSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \FunctionParameterSyntax.modifiers: + return "modifiers" + case \FunctionParameterSyntax.unexpectedBetweenModifiersAndFirstName: + return "unexpectedBetweenModifiersAndFirstName" + case \FunctionParameterSyntax.firstName: + return "firstName" + case \FunctionParameterSyntax.unexpectedBetweenFirstNameAndSecondName: + return "unexpectedBetweenFirstNameAndSecondName" + case \FunctionParameterSyntax.secondName: + return "secondName" + case \FunctionParameterSyntax.unexpectedBetweenSecondNameAndColon: + return "unexpectedBetweenSecondNameAndColon" + case \FunctionParameterSyntax.colon: + return "colon" + case \FunctionParameterSyntax.unexpectedBetweenColonAndType: + return "unexpectedBetweenColonAndType" + case \FunctionParameterSyntax.type: + return "type" + case \FunctionParameterSyntax.unexpectedBetweenTypeAndEllipsis: + return "unexpectedBetweenTypeAndEllipsis" + case \FunctionParameterSyntax.ellipsis: + return "ellipsis" + case \FunctionParameterSyntax.unexpectedBetweenEllipsisAndDefaultArgument: + return "unexpectedBetweenEllipsisAndDefaultArgument" + case \FunctionParameterSyntax.defaultArgument: + return "defaultArgument" + case \FunctionParameterSyntax.unexpectedBetweenDefaultArgumentAndTrailingComma: + return "unexpectedBetweenDefaultArgumentAndTrailingComma" + case \FunctionParameterSyntax.trailingComma: + return "trailingComma" + case \FunctionParameterSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \FunctionSignatureSyntax.unexpectedBeforeInput: + return "unexpectedBeforeInput" + case \FunctionSignatureSyntax.input: + return "input" + case \FunctionSignatureSyntax.unexpectedBetweenInputAndEffectSpecifiers: + return "unexpectedBetweenInputAndEffectSpecifiers" + case \FunctionSignatureSyntax.effectSpecifiers: + return "effectSpecifiers" + case \FunctionSignatureSyntax.unexpectedBetweenEffectSpecifiersAndOutput: + return "unexpectedBetweenEffectSpecifiersAndOutput" + case \FunctionSignatureSyntax.output: + return "output" + case \FunctionSignatureSyntax.unexpectedAfterOutput: + return "unexpectedAfterOutput" + case \FunctionTypeSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \FunctionTypeSyntax.leftParen: + return "leftParen" + case \FunctionTypeSyntax.unexpectedBetweenLeftParenAndArguments: + return "unexpectedBetweenLeftParenAndArguments" + case \FunctionTypeSyntax.arguments: + return "arguments" + case \FunctionTypeSyntax.unexpectedBetweenArgumentsAndRightParen: + return "unexpectedBetweenArgumentsAndRightParen" + case \FunctionTypeSyntax.rightParen: + return "rightParen" + case \FunctionTypeSyntax.unexpectedBetweenRightParenAndEffectSpecifiers: + return "unexpectedBetweenRightParenAndEffectSpecifiers" + case \FunctionTypeSyntax.effectSpecifiers: + return "effectSpecifiers" + case \FunctionTypeSyntax.unexpectedBetweenEffectSpecifiersAndOutput: + return "unexpectedBetweenEffectSpecifiersAndOutput" + case \FunctionTypeSyntax.output: + return "output" + case \FunctionTypeSyntax.unexpectedAfterOutput: + return "unexpectedAfterOutput" + case \GenericArgumentClauseSyntax.unexpectedBeforeLeftAngleBracket: + return "unexpectedBeforeLeftAngleBracket" + case \GenericArgumentClauseSyntax.leftAngleBracket: + return "leftAngleBracket" + case \GenericArgumentClauseSyntax.unexpectedBetweenLeftAngleBracketAndArguments: + return "unexpectedBetweenLeftAngleBracketAndArguments" + case \GenericArgumentClauseSyntax.arguments: + return "arguments" + case \GenericArgumentClauseSyntax.unexpectedBetweenArgumentsAndRightAngleBracket: + return "unexpectedBetweenArgumentsAndRightAngleBracket" + case \GenericArgumentClauseSyntax.rightAngleBracket: + return "rightAngleBracket" + case \GenericArgumentClauseSyntax.unexpectedAfterRightAngleBracket: + return "unexpectedAfterRightAngleBracket" + case \GenericArgumentSyntax.unexpectedBeforeArgumentType: + return "unexpectedBeforeArgumentType" + case \GenericArgumentSyntax.argumentType: + return "argumentType" + case \GenericArgumentSyntax.unexpectedBetweenArgumentTypeAndTrailingComma: + return "unexpectedBetweenArgumentTypeAndTrailingComma" + case \GenericArgumentSyntax.trailingComma: + return "trailingComma" + case \GenericArgumentSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \GenericParameterClauseSyntax.unexpectedBeforeLeftAngleBracket: + return "unexpectedBeforeLeftAngleBracket" + case \GenericParameterClauseSyntax.leftAngleBracket: + return "leftAngleBracket" + case \GenericParameterClauseSyntax.unexpectedBetweenLeftAngleBracketAndGenericParameterList: + return "unexpectedBetweenLeftAngleBracketAndGenericParameterList" + case \GenericParameterClauseSyntax.genericParameterList: + return "genericParameterList" + case \GenericParameterClauseSyntax.unexpectedBetweenGenericParameterListAndGenericWhereClause: + return "unexpectedBetweenGenericParameterListAndGenericWhereClause" + case \GenericParameterClauseSyntax.genericWhereClause: + return "genericWhereClause" + case \GenericParameterClauseSyntax.unexpectedBetweenGenericWhereClauseAndRightAngleBracket: + return "unexpectedBetweenGenericWhereClauseAndRightAngleBracket" + case \GenericParameterClauseSyntax.rightAngleBracket: + return "rightAngleBracket" + case \GenericParameterClauseSyntax.unexpectedAfterRightAngleBracket: + return "unexpectedAfterRightAngleBracket" + case \GenericParameterSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \GenericParameterSyntax.attributes: + return "attributes" + case \GenericParameterSyntax.unexpectedBetweenAttributesAndEach: + return "unexpectedBetweenAttributesAndEach" + case \GenericParameterSyntax.each: + return "each" + case \GenericParameterSyntax.unexpectedBetweenEachAndName: + return "unexpectedBetweenEachAndName" + case \GenericParameterSyntax.name: + return "name" + case \GenericParameterSyntax.unexpectedBetweenNameAndColon: + return "unexpectedBetweenNameAndColon" + case \GenericParameterSyntax.colon: + return "colon" + case \GenericParameterSyntax.unexpectedBetweenColonAndInheritedType: + return "unexpectedBetweenColonAndInheritedType" + case \GenericParameterSyntax.inheritedType: + return "inheritedType" + case \GenericParameterSyntax.unexpectedBetweenInheritedTypeAndTrailingComma: + return "unexpectedBetweenInheritedTypeAndTrailingComma" + case \GenericParameterSyntax.trailingComma: + return "trailingComma" + case \GenericParameterSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \GenericRequirementSyntax.unexpectedBeforeBody: + return "unexpectedBeforeBody" + case \GenericRequirementSyntax.body: + return "body" + case \GenericRequirementSyntax.unexpectedBetweenBodyAndTrailingComma: + return "unexpectedBetweenBodyAndTrailingComma" + case \GenericRequirementSyntax.trailingComma: + return "trailingComma" + case \GenericRequirementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \GenericWhereClauseSyntax.unexpectedBeforeWhereKeyword: + return "unexpectedBeforeWhereKeyword" + case \GenericWhereClauseSyntax.whereKeyword: + return "whereKeyword" + case \GenericWhereClauseSyntax.unexpectedBetweenWhereKeywordAndRequirementList: + return "unexpectedBetweenWhereKeywordAndRequirementList" + case \GenericWhereClauseSyntax.requirementList: + return "requirementList" + case \GenericWhereClauseSyntax.unexpectedAfterRequirementList: + return "unexpectedAfterRequirementList" + case \GuardStmtSyntax.unexpectedBeforeGuardKeyword: + return "unexpectedBeforeGuardKeyword" + case \GuardStmtSyntax.guardKeyword: + return "guardKeyword" + case \GuardStmtSyntax.unexpectedBetweenGuardKeywordAndConditions: + return "unexpectedBetweenGuardKeywordAndConditions" + case \GuardStmtSyntax.conditions: + return "conditions" + case \GuardStmtSyntax.unexpectedBetweenConditionsAndElseKeyword: + return "unexpectedBetweenConditionsAndElseKeyword" + case \GuardStmtSyntax.elseKeyword: + return "elseKeyword" + case \GuardStmtSyntax.unexpectedBetweenElseKeywordAndBody: + return "unexpectedBetweenElseKeywordAndBody" + case \GuardStmtSyntax.body: + return "body" + case \GuardStmtSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \IdentifierExprSyntax.unexpectedBeforeIdentifier: + return "unexpectedBeforeIdentifier" + case \IdentifierExprSyntax.identifier: + return "identifier" + case \IdentifierExprSyntax.unexpectedBetweenIdentifierAndDeclNameArguments: + return "unexpectedBetweenIdentifierAndDeclNameArguments" + case \IdentifierExprSyntax.declNameArguments: + return "declNameArguments" + case \IdentifierExprSyntax.unexpectedAfterDeclNameArguments: + return "unexpectedAfterDeclNameArguments" + case \IdentifierPatternSyntax.unexpectedBeforeIdentifier: + return "unexpectedBeforeIdentifier" + case \IdentifierPatternSyntax.identifier: + return "identifier" + case \IdentifierPatternSyntax.unexpectedAfterIdentifier: + return "unexpectedAfterIdentifier" + case \IfConfigClauseSyntax.unexpectedBeforePoundKeyword: + return "unexpectedBeforePoundKeyword" + case \IfConfigClauseSyntax.poundKeyword: + return "poundKeyword" + case \IfConfigClauseSyntax.unexpectedBetweenPoundKeywordAndCondition: + return "unexpectedBetweenPoundKeywordAndCondition" + case \IfConfigClauseSyntax.condition: + return "condition" + case \IfConfigClauseSyntax.unexpectedBetweenConditionAndElements: + return "unexpectedBetweenConditionAndElements" + case \IfConfigClauseSyntax.elements: + return "elements" + case \IfConfigClauseSyntax.unexpectedAfterElements: + return "unexpectedAfterElements" + case \IfConfigDeclSyntax.unexpectedBeforeClauses: + return "unexpectedBeforeClauses" + case \IfConfigDeclSyntax.clauses: + return "clauses" + case \IfConfigDeclSyntax.unexpectedBetweenClausesAndPoundEndif: + return "unexpectedBetweenClausesAndPoundEndif" + case \IfConfigDeclSyntax.poundEndif: + return "poundEndif" + case \IfConfigDeclSyntax.unexpectedAfterPoundEndif: + return "unexpectedAfterPoundEndif" + case \IfExprSyntax.unexpectedBeforeIfKeyword: + return "unexpectedBeforeIfKeyword" + case \IfExprSyntax.ifKeyword: + return "ifKeyword" + case \IfExprSyntax.unexpectedBetweenIfKeywordAndConditions: + return "unexpectedBetweenIfKeywordAndConditions" + case \IfExprSyntax.conditions: + return "conditions" + case \IfExprSyntax.unexpectedBetweenConditionsAndBody: + return "unexpectedBetweenConditionsAndBody" + case \IfExprSyntax.body: + return "body" + case \IfExprSyntax.unexpectedBetweenBodyAndElseKeyword: + return "unexpectedBetweenBodyAndElseKeyword" + case \IfExprSyntax.elseKeyword: + return "elseKeyword" + case \IfExprSyntax.unexpectedBetweenElseKeywordAndElseBody: + return "unexpectedBetweenElseKeywordAndElseBody" + case \IfExprSyntax.elseBody: + return "elseBody" + case \IfExprSyntax.unexpectedAfterElseBody: + return "unexpectedAfterElseBody" + case \ImplementsAttributeArgumentsSyntax.unexpectedBeforeType: + return "unexpectedBeforeType" + case \ImplementsAttributeArgumentsSyntax.type: + return "type" + case \ImplementsAttributeArgumentsSyntax.unexpectedBetweenTypeAndComma: + return "unexpectedBetweenTypeAndComma" + case \ImplementsAttributeArgumentsSyntax.comma: + return "comma" + case \ImplementsAttributeArgumentsSyntax.unexpectedBetweenCommaAndDeclBaseName: + return "unexpectedBetweenCommaAndDeclBaseName" + case \ImplementsAttributeArgumentsSyntax.declBaseName: + return "declBaseName" + case \ImplementsAttributeArgumentsSyntax.unexpectedBetweenDeclBaseNameAndDeclNameArguments: + return "unexpectedBetweenDeclBaseNameAndDeclNameArguments" + case \ImplementsAttributeArgumentsSyntax.declNameArguments: + return "declNameArguments" + case \ImplementsAttributeArgumentsSyntax.unexpectedAfterDeclNameArguments: + return "unexpectedAfterDeclNameArguments" + case \ImplicitlyUnwrappedOptionalTypeSyntax.unexpectedBeforeWrappedType: + return "unexpectedBeforeWrappedType" + case \ImplicitlyUnwrappedOptionalTypeSyntax.wrappedType: + return "wrappedType" + case \ImplicitlyUnwrappedOptionalTypeSyntax.unexpectedBetweenWrappedTypeAndExclamationMark: + return "unexpectedBetweenWrappedTypeAndExclamationMark" + case \ImplicitlyUnwrappedOptionalTypeSyntax.exclamationMark: + return "exclamationMark" + case \ImplicitlyUnwrappedOptionalTypeSyntax.unexpectedAfterExclamationMark: + return "unexpectedAfterExclamationMark" + case \ImportDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \ImportDeclSyntax.attributes: + return "attributes" + case \ImportDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \ImportDeclSyntax.modifiers: + return "modifiers" + case \ImportDeclSyntax.unexpectedBetweenModifiersAndImportTok: + return "unexpectedBetweenModifiersAndImportTok" + case \ImportDeclSyntax.importTok: + return "importTok" + case \ImportDeclSyntax.unexpectedBetweenImportTokAndImportKind: + return "unexpectedBetweenImportTokAndImportKind" + case \ImportDeclSyntax.importKind: + return "importKind" + case \ImportDeclSyntax.unexpectedBetweenImportKindAndPath: + return "unexpectedBetweenImportKindAndPath" + case \ImportDeclSyntax.path: + return "path" + case \ImportDeclSyntax.unexpectedAfterPath: + return "unexpectedAfterPath" + case \InOutExprSyntax.unexpectedBeforeAmpersand: + return "unexpectedBeforeAmpersand" + case \InOutExprSyntax.ampersand: + return "ampersand" + case \InOutExprSyntax.unexpectedBetweenAmpersandAndExpression: + return "unexpectedBetweenAmpersandAndExpression" + case \InOutExprSyntax.expression: + return "expression" + case \InOutExprSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \InfixOperatorExprSyntax.unexpectedBeforeLeftOperand: + return "unexpectedBeforeLeftOperand" + case \InfixOperatorExprSyntax.leftOperand: + return "leftOperand" + case \InfixOperatorExprSyntax.unexpectedBetweenLeftOperandAndOperatorOperand: + return "unexpectedBetweenLeftOperandAndOperatorOperand" + case \InfixOperatorExprSyntax.operatorOperand: + return "operatorOperand" + case \InfixOperatorExprSyntax.unexpectedBetweenOperatorOperandAndRightOperand: + return "unexpectedBetweenOperatorOperandAndRightOperand" + case \InfixOperatorExprSyntax.rightOperand: + return "rightOperand" + case \InfixOperatorExprSyntax.unexpectedAfterRightOperand: + return "unexpectedAfterRightOperand" + case \InheritedTypeSyntax.unexpectedBeforeHasWithout: + return "unexpectedBeforeHasWithout" + case \InheritedTypeSyntax.hasWithout: + return "hasWithout" + case \InheritedTypeSyntax.unexpectedBetweenHasWithoutAndTypeName: + return "unexpectedBetweenHasWithoutAndTypeName" + case \InheritedTypeSyntax.typeName: + return "typeName" + case \InheritedTypeSyntax.unexpectedBetweenTypeNameAndTrailingComma: + return "unexpectedBetweenTypeNameAndTrailingComma" + case \InheritedTypeSyntax.trailingComma: + return "trailingComma" + case \InheritedTypeSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \InitializerClauseSyntax.unexpectedBeforeEqual: + return "unexpectedBeforeEqual" + case \InitializerClauseSyntax.equal: + return "equal" + case \InitializerClauseSyntax.unexpectedBetweenEqualAndValue: + return "unexpectedBetweenEqualAndValue" + case \InitializerClauseSyntax.value: + return "value" + case \InitializerClauseSyntax.unexpectedAfterValue: + return "unexpectedAfterValue" + case \InitializerDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \InitializerDeclSyntax.attributes: + return "attributes" + case \InitializerDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \InitializerDeclSyntax.modifiers: + return "modifiers" + case \InitializerDeclSyntax.unexpectedBetweenModifiersAndInitKeyword: + return "unexpectedBetweenModifiersAndInitKeyword" + case \InitializerDeclSyntax.initKeyword: + return "initKeyword" + case \InitializerDeclSyntax.unexpectedBetweenInitKeywordAndOptionalMark: + return "unexpectedBetweenInitKeywordAndOptionalMark" + case \InitializerDeclSyntax.optionalMark: + return "optionalMark" + case \InitializerDeclSyntax.unexpectedBetweenOptionalMarkAndGenericParameterClause: + return "unexpectedBetweenOptionalMarkAndGenericParameterClause" + case \InitializerDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \InitializerDeclSyntax.unexpectedBetweenGenericParameterClauseAndSignature: + return "unexpectedBetweenGenericParameterClauseAndSignature" + case \InitializerDeclSyntax.signature: + return "signature" + case \InitializerDeclSyntax.unexpectedBetweenSignatureAndGenericWhereClause: + return "unexpectedBetweenSignatureAndGenericWhereClause" + case \InitializerDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \InitializerDeclSyntax.unexpectedBetweenGenericWhereClauseAndBody: + return "unexpectedBetweenGenericWhereClauseAndBody" + case \InitializerDeclSyntax.body: + return "body" + case \InitializerDeclSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \IntegerLiteralExprSyntax.unexpectedBeforeDigits: + return "unexpectedBeforeDigits" + case \IntegerLiteralExprSyntax.digits: + return "digits" + case \IntegerLiteralExprSyntax.unexpectedAfterDigits: + return "unexpectedAfterDigits" + case \IsExprSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \IsExprSyntax.expression: + return "expression" + case \IsExprSyntax.unexpectedBetweenExpressionAndIsTok: + return "unexpectedBetweenExpressionAndIsTok" + case \IsExprSyntax.isTok: + return "isTok" + case \IsExprSyntax.unexpectedBetweenIsTokAndTypeName: + return "unexpectedBetweenIsTokAndTypeName" + case \IsExprSyntax.typeName: + return "typeName" + case \IsExprSyntax.unexpectedAfterTypeName: + return "unexpectedAfterTypeName" + case \IsTypePatternSyntax.unexpectedBeforeIsKeyword: + return "unexpectedBeforeIsKeyword" + case \IsTypePatternSyntax.isKeyword: + return "isKeyword" + case \IsTypePatternSyntax.unexpectedBetweenIsKeywordAndType: + return "unexpectedBetweenIsKeywordAndType" + case \IsTypePatternSyntax.type: + return "type" + case \IsTypePatternSyntax.unexpectedAfterType: + return "unexpectedAfterType" + case \KeyPathComponentSyntax.unexpectedBeforePeriod: + return "unexpectedBeforePeriod" + case \KeyPathComponentSyntax.period: + return "period" + case \KeyPathComponentSyntax.unexpectedBetweenPeriodAndComponent: + return "unexpectedBetweenPeriodAndComponent" + case \KeyPathComponentSyntax.component: + return "component" + case \KeyPathComponentSyntax.unexpectedAfterComponent: + return "unexpectedAfterComponent" + case \KeyPathExprSyntax.unexpectedBeforeBackslash: + return "unexpectedBeforeBackslash" + case \KeyPathExprSyntax.backslash: + return "backslash" + case \KeyPathExprSyntax.unexpectedBetweenBackslashAndRoot: + return "unexpectedBetweenBackslashAndRoot" + case \KeyPathExprSyntax.root: + return "root" + case \KeyPathExprSyntax.unexpectedBetweenRootAndComponents: + return "unexpectedBetweenRootAndComponents" + case \KeyPathExprSyntax.components: + return "components" + case \KeyPathExprSyntax.unexpectedAfterComponents: + return "unexpectedAfterComponents" + case \KeyPathOptionalComponentSyntax.unexpectedBeforeQuestionOrExclamationMark: + return "unexpectedBeforeQuestionOrExclamationMark" + case \KeyPathOptionalComponentSyntax.questionOrExclamationMark: + return "questionOrExclamationMark" + case \KeyPathOptionalComponentSyntax.unexpectedAfterQuestionOrExclamationMark: + return "unexpectedAfterQuestionOrExclamationMark" + case \KeyPathPropertyComponentSyntax.unexpectedBeforeIdentifier: + return "unexpectedBeforeIdentifier" + case \KeyPathPropertyComponentSyntax.identifier: + return "identifier" + case \KeyPathPropertyComponentSyntax.unexpectedBetweenIdentifierAndDeclNameArguments: + return "unexpectedBetweenIdentifierAndDeclNameArguments" + case \KeyPathPropertyComponentSyntax.declNameArguments: + return "declNameArguments" + case \KeyPathPropertyComponentSyntax.unexpectedBetweenDeclNameArgumentsAndGenericArgumentClause: + return "unexpectedBetweenDeclNameArgumentsAndGenericArgumentClause" + case \KeyPathPropertyComponentSyntax.genericArgumentClause: + return "genericArgumentClause" + case \KeyPathPropertyComponentSyntax.unexpectedAfterGenericArgumentClause: + return "unexpectedAfterGenericArgumentClause" + case \KeyPathSubscriptComponentSyntax.unexpectedBeforeLeftBracket: + return "unexpectedBeforeLeftBracket" + case \KeyPathSubscriptComponentSyntax.leftBracket: + return "leftBracket" + case \KeyPathSubscriptComponentSyntax.unexpectedBetweenLeftBracketAndArgumentList: + return "unexpectedBetweenLeftBracketAndArgumentList" + case \KeyPathSubscriptComponentSyntax.argumentList: + return "argumentList" + case \KeyPathSubscriptComponentSyntax.unexpectedBetweenArgumentListAndRightBracket: + return "unexpectedBetweenArgumentListAndRightBracket" + case \KeyPathSubscriptComponentSyntax.rightBracket: + return "rightBracket" + case \KeyPathSubscriptComponentSyntax.unexpectedAfterRightBracket: + return "unexpectedAfterRightBracket" + case \LabeledSpecializeEntrySyntax.unexpectedBeforeLabel: + return "unexpectedBeforeLabel" + case \LabeledSpecializeEntrySyntax.label: + return "label" + case \LabeledSpecializeEntrySyntax.unexpectedBetweenLabelAndColon: + return "unexpectedBetweenLabelAndColon" + case \LabeledSpecializeEntrySyntax.colon: + return "colon" + case \LabeledSpecializeEntrySyntax.unexpectedBetweenColonAndValue: + return "unexpectedBetweenColonAndValue" + case \LabeledSpecializeEntrySyntax.value: + return "value" + case \LabeledSpecializeEntrySyntax.unexpectedBetweenValueAndTrailingComma: + return "unexpectedBetweenValueAndTrailingComma" + case \LabeledSpecializeEntrySyntax.trailingComma: + return "trailingComma" + case \LabeledSpecializeEntrySyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \LabeledStmtSyntax.unexpectedBeforeLabelName: + return "unexpectedBeforeLabelName" + case \LabeledStmtSyntax.labelName: + return "labelName" + case \LabeledStmtSyntax.unexpectedBetweenLabelNameAndLabelColon: + return "unexpectedBetweenLabelNameAndLabelColon" + case \LabeledStmtSyntax.labelColon: + return "labelColon" + case \LabeledStmtSyntax.unexpectedBetweenLabelColonAndStatement: + return "unexpectedBetweenLabelColonAndStatement" + case \LabeledStmtSyntax.statement: + return "statement" + case \LabeledStmtSyntax.unexpectedAfterStatement: + return "unexpectedAfterStatement" + case \LayoutRequirementSyntax.unexpectedBeforeTypeIdentifier: + return "unexpectedBeforeTypeIdentifier" + case \LayoutRequirementSyntax.typeIdentifier: + return "typeIdentifier" + case \LayoutRequirementSyntax.unexpectedBetweenTypeIdentifierAndColon: + return "unexpectedBetweenTypeIdentifierAndColon" + case \LayoutRequirementSyntax.colon: + return "colon" + case \LayoutRequirementSyntax.unexpectedBetweenColonAndLayoutConstraint: + return "unexpectedBetweenColonAndLayoutConstraint" + case \LayoutRequirementSyntax.layoutConstraint: + return "layoutConstraint" + case \LayoutRequirementSyntax.unexpectedBetweenLayoutConstraintAndLeftParen: + return "unexpectedBetweenLayoutConstraintAndLeftParen" + case \LayoutRequirementSyntax.leftParen: + return "leftParen" + case \LayoutRequirementSyntax.unexpectedBetweenLeftParenAndSize: + return "unexpectedBetweenLeftParenAndSize" + case \LayoutRequirementSyntax.size: + return "size" + case \LayoutRequirementSyntax.unexpectedBetweenSizeAndComma: + return "unexpectedBetweenSizeAndComma" + case \LayoutRequirementSyntax.comma: + return "comma" + case \LayoutRequirementSyntax.unexpectedBetweenCommaAndAlignment: + return "unexpectedBetweenCommaAndAlignment" + case \LayoutRequirementSyntax.alignment: + return "alignment" + case \LayoutRequirementSyntax.unexpectedBetweenAlignmentAndRightParen: + return "unexpectedBetweenAlignmentAndRightParen" + case \LayoutRequirementSyntax.rightParen: + return "rightParen" + case \LayoutRequirementSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \MacroDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \MacroDeclSyntax.attributes: + return "attributes" + case \MacroDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \MacroDeclSyntax.modifiers: + return "modifiers" + case \MacroDeclSyntax.unexpectedBetweenModifiersAndMacroKeyword: + return "unexpectedBetweenModifiersAndMacroKeyword" + case \MacroDeclSyntax.macroKeyword: + return "macroKeyword" + case \MacroDeclSyntax.unexpectedBetweenMacroKeywordAndIdentifier: + return "unexpectedBetweenMacroKeywordAndIdentifier" + case \MacroDeclSyntax.identifier: + return "identifier" + case \MacroDeclSyntax.unexpectedBetweenIdentifierAndGenericParameterClause: + return "unexpectedBetweenIdentifierAndGenericParameterClause" + case \MacroDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \MacroDeclSyntax.unexpectedBetweenGenericParameterClauseAndSignature: + return "unexpectedBetweenGenericParameterClauseAndSignature" + case \MacroDeclSyntax.signature: + return "signature" + case \MacroDeclSyntax.unexpectedBetweenSignatureAndDefinition: + return "unexpectedBetweenSignatureAndDefinition" + case \MacroDeclSyntax.definition: + return "definition" + case \MacroDeclSyntax.unexpectedBetweenDefinitionAndGenericWhereClause: + return "unexpectedBetweenDefinitionAndGenericWhereClause" + case \MacroDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \MacroDeclSyntax.unexpectedAfterGenericWhereClause: + return "unexpectedAfterGenericWhereClause" + case \MacroExpansionDeclSyntax.unexpectedBeforePoundToken: + return "unexpectedBeforePoundToken" + case \MacroExpansionDeclSyntax.poundToken: + return "poundToken" + case \MacroExpansionDeclSyntax.unexpectedBetweenPoundTokenAndMacro: + return "unexpectedBetweenPoundTokenAndMacro" + case \MacroExpansionDeclSyntax.macro: + return "macro" + case \MacroExpansionDeclSyntax.unexpectedBetweenMacroAndGenericArguments: + return "unexpectedBetweenMacroAndGenericArguments" + case \MacroExpansionDeclSyntax.genericArguments: + return "genericArguments" + case \MacroExpansionDeclSyntax.unexpectedBetweenGenericArgumentsAndLeftParen: + return "unexpectedBetweenGenericArgumentsAndLeftParen" + case \MacroExpansionDeclSyntax.leftParen: + return "leftParen" + case \MacroExpansionDeclSyntax.unexpectedBetweenLeftParenAndArgumentList: + return "unexpectedBetweenLeftParenAndArgumentList" + case \MacroExpansionDeclSyntax.argumentList: + return "argumentList" + case \MacroExpansionDeclSyntax.unexpectedBetweenArgumentListAndRightParen: + return "unexpectedBetweenArgumentListAndRightParen" + case \MacroExpansionDeclSyntax.rightParen: + return "rightParen" + case \MacroExpansionDeclSyntax.unexpectedBetweenRightParenAndTrailingClosure: + return "unexpectedBetweenRightParenAndTrailingClosure" + case \MacroExpansionDeclSyntax.trailingClosure: + return "trailingClosure" + case \MacroExpansionDeclSyntax.unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: + return "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures" + case \MacroExpansionDeclSyntax.additionalTrailingClosures: + return "additionalTrailingClosures" + case \MacroExpansionDeclSyntax.unexpectedAfterAdditionalTrailingClosures: + return "unexpectedAfterAdditionalTrailingClosures" + case \MacroExpansionExprSyntax.unexpectedBeforePoundToken: + return "unexpectedBeforePoundToken" + case \MacroExpansionExprSyntax.poundToken: + return "poundToken" + case \MacroExpansionExprSyntax.unexpectedBetweenPoundTokenAndMacro: + return "unexpectedBetweenPoundTokenAndMacro" + case \MacroExpansionExprSyntax.macro: + return "macro" + case \MacroExpansionExprSyntax.unexpectedBetweenMacroAndGenericArguments: + return "unexpectedBetweenMacroAndGenericArguments" + case \MacroExpansionExprSyntax.genericArguments: + return "genericArguments" + case \MacroExpansionExprSyntax.unexpectedBetweenGenericArgumentsAndLeftParen: + return "unexpectedBetweenGenericArgumentsAndLeftParen" + case \MacroExpansionExprSyntax.leftParen: + return "leftParen" + case \MacroExpansionExprSyntax.unexpectedBetweenLeftParenAndArgumentList: + return "unexpectedBetweenLeftParenAndArgumentList" + case \MacroExpansionExprSyntax.argumentList: + return "argumentList" + case \MacroExpansionExprSyntax.unexpectedBetweenArgumentListAndRightParen: + return "unexpectedBetweenArgumentListAndRightParen" + case \MacroExpansionExprSyntax.rightParen: + return "rightParen" + case \MacroExpansionExprSyntax.unexpectedBetweenRightParenAndTrailingClosure: + return "unexpectedBetweenRightParenAndTrailingClosure" + case \MacroExpansionExprSyntax.trailingClosure: + return "trailingClosure" + case \MacroExpansionExprSyntax.unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: + return "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures" + case \MacroExpansionExprSyntax.additionalTrailingClosures: + return "additionalTrailingClosures" + case \MacroExpansionExprSyntax.unexpectedAfterAdditionalTrailingClosures: + return "unexpectedAfterAdditionalTrailingClosures" + case \MatchingPatternConditionSyntax.unexpectedBeforeCaseKeyword: + return "unexpectedBeforeCaseKeyword" + case \MatchingPatternConditionSyntax.caseKeyword: + return "caseKeyword" + case \MatchingPatternConditionSyntax.unexpectedBetweenCaseKeywordAndPattern: + return "unexpectedBetweenCaseKeywordAndPattern" + case \MatchingPatternConditionSyntax.pattern: + return "pattern" + case \MatchingPatternConditionSyntax.unexpectedBetweenPatternAndTypeAnnotation: + return "unexpectedBetweenPatternAndTypeAnnotation" + case \MatchingPatternConditionSyntax.typeAnnotation: + return "typeAnnotation" + case \MatchingPatternConditionSyntax.unexpectedBetweenTypeAnnotationAndInitializer: + return "unexpectedBetweenTypeAnnotationAndInitializer" + case \MatchingPatternConditionSyntax.initializer: + return "initializer" + case \MatchingPatternConditionSyntax.unexpectedAfterInitializer: + return "unexpectedAfterInitializer" + case \MemberAccessExprSyntax.unexpectedBeforeBase: + return "unexpectedBeforeBase" + case \MemberAccessExprSyntax.base: + return "base" + case \MemberAccessExprSyntax.unexpectedBetweenBaseAndDot: + return "unexpectedBetweenBaseAndDot" + case \MemberAccessExprSyntax.dot: + return "dot" + case \MemberAccessExprSyntax.unexpectedBetweenDotAndName: + return "unexpectedBetweenDotAndName" + case \MemberAccessExprSyntax.name: + return "name" + case \MemberAccessExprSyntax.unexpectedBetweenNameAndDeclNameArguments: + return "unexpectedBetweenNameAndDeclNameArguments" + case \MemberAccessExprSyntax.declNameArguments: + return "declNameArguments" + case \MemberAccessExprSyntax.unexpectedAfterDeclNameArguments: + return "unexpectedAfterDeclNameArguments" + case \MemberDeclBlockSyntax.unexpectedBeforeLeftBrace: + return "unexpectedBeforeLeftBrace" + case \MemberDeclBlockSyntax.leftBrace: + return "leftBrace" + case \MemberDeclBlockSyntax.unexpectedBetweenLeftBraceAndMembers: + return "unexpectedBetweenLeftBraceAndMembers" + case \MemberDeclBlockSyntax.members: + return "members" + case \MemberDeclBlockSyntax.unexpectedBetweenMembersAndRightBrace: + return "unexpectedBetweenMembersAndRightBrace" + case \MemberDeclBlockSyntax.rightBrace: + return "rightBrace" + case \MemberDeclBlockSyntax.unexpectedAfterRightBrace: + return "unexpectedAfterRightBrace" + case \MemberDeclListItemSyntax.unexpectedBeforeDecl: + return "unexpectedBeforeDecl" + case \MemberDeclListItemSyntax.decl: + return "decl" + case \MemberDeclListItemSyntax.unexpectedBetweenDeclAndSemicolon: + return "unexpectedBetweenDeclAndSemicolon" + case \MemberDeclListItemSyntax.semicolon: + return "semicolon" + case \MemberDeclListItemSyntax.unexpectedAfterSemicolon: + return "unexpectedAfterSemicolon" + case \MemberTypeIdentifierSyntax.unexpectedBeforeBaseType: + return "unexpectedBeforeBaseType" + case \MemberTypeIdentifierSyntax.baseType: + return "baseType" + case \MemberTypeIdentifierSyntax.unexpectedBetweenBaseTypeAndPeriod: + return "unexpectedBetweenBaseTypeAndPeriod" + case \MemberTypeIdentifierSyntax.period: + return "period" + case \MemberTypeIdentifierSyntax.unexpectedBetweenPeriodAndName: + return "unexpectedBetweenPeriodAndName" + case \MemberTypeIdentifierSyntax.name: + return "name" + case \MemberTypeIdentifierSyntax.unexpectedBetweenNameAndGenericArgumentClause: + return "unexpectedBetweenNameAndGenericArgumentClause" + case \MemberTypeIdentifierSyntax.genericArgumentClause: + return "genericArgumentClause" + case \MemberTypeIdentifierSyntax.unexpectedAfterGenericArgumentClause: + return "unexpectedAfterGenericArgumentClause" + case \MetatypeTypeSyntax.unexpectedBeforeBaseType: + return "unexpectedBeforeBaseType" + case \MetatypeTypeSyntax.baseType: + return "baseType" + case \MetatypeTypeSyntax.unexpectedBetweenBaseTypeAndPeriod: + return "unexpectedBetweenBaseTypeAndPeriod" + case \MetatypeTypeSyntax.period: + return "period" + case \MetatypeTypeSyntax.unexpectedBetweenPeriodAndTypeOrProtocol: + return "unexpectedBetweenPeriodAndTypeOrProtocol" + case \MetatypeTypeSyntax.typeOrProtocol: + return "typeOrProtocol" + case \MetatypeTypeSyntax.unexpectedAfterTypeOrProtocol: + return "unexpectedAfterTypeOrProtocol" + case \MissingDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \MissingDeclSyntax.attributes: + return "attributes" + case \MissingDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \MissingDeclSyntax.modifiers: + return "modifiers" + case \MissingDeclSyntax.unexpectedAfterModifiers: + return "unexpectedAfterModifiers" + case \MissingExprSyntax.unexpected: + return "unexpected" + case \MissingPatternSyntax.unexpected: + return "unexpected" + case \MissingStmtSyntax.unexpected: + return "unexpected" + case \MissingSyntax.unexpected: + return "unexpected" + case \MissingTypeSyntax.unexpected: + return "unexpected" + case \MoveExprSyntax.unexpectedBeforeMoveKeyword: + return "unexpectedBeforeMoveKeyword" + case \MoveExprSyntax.moveKeyword: + return "moveKeyword" + case \MoveExprSyntax.unexpectedBetweenMoveKeywordAndExpression: + return "unexpectedBetweenMoveKeywordAndExpression" + case \MoveExprSyntax.expression: + return "expression" + case \MoveExprSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \MultipleTrailingClosureElementSyntax.unexpectedBeforeLabel: + return "unexpectedBeforeLabel" + case \MultipleTrailingClosureElementSyntax.label: + return "label" + case \MultipleTrailingClosureElementSyntax.unexpectedBetweenLabelAndColon: + return "unexpectedBetweenLabelAndColon" + case \MultipleTrailingClosureElementSyntax.colon: + return "colon" + case \MultipleTrailingClosureElementSyntax.unexpectedBetweenColonAndClosure: + return "unexpectedBetweenColonAndClosure" + case \MultipleTrailingClosureElementSyntax.closure: + return "closure" + case \MultipleTrailingClosureElementSyntax.unexpectedAfterClosure: + return "unexpectedAfterClosure" + case \NamedOpaqueReturnTypeSyntax.unexpectedBeforeGenericParameters: + return "unexpectedBeforeGenericParameters" + case \NamedOpaqueReturnTypeSyntax.genericParameters: + return "genericParameters" + case \NamedOpaqueReturnTypeSyntax.unexpectedBetweenGenericParametersAndBaseType: + return "unexpectedBetweenGenericParametersAndBaseType" + case \NamedOpaqueReturnTypeSyntax.baseType: + return "baseType" + case \NamedOpaqueReturnTypeSyntax.unexpectedAfterBaseType: + return "unexpectedAfterBaseType" + case \NilLiteralExprSyntax.unexpectedBeforeNilKeyword: + return "unexpectedBeforeNilKeyword" + case \NilLiteralExprSyntax.nilKeyword: + return "nilKeyword" + case \NilLiteralExprSyntax.unexpectedAfterNilKeyword: + return "unexpectedAfterNilKeyword" + case \ObjCSelectorPieceSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \ObjCSelectorPieceSyntax.name: + return "name" + case \ObjCSelectorPieceSyntax.unexpectedBetweenNameAndColon: + return "unexpectedBetweenNameAndColon" + case \ObjCSelectorPieceSyntax.colon: + return "colon" + case \ObjCSelectorPieceSyntax.unexpectedAfterColon: + return "unexpectedAfterColon" + case \OpaqueReturnTypeOfAttributeArgumentsSyntax.unexpectedBeforeMangledName: + return "unexpectedBeforeMangledName" + case \OpaqueReturnTypeOfAttributeArgumentsSyntax.mangledName: + return "mangledName" + case \OpaqueReturnTypeOfAttributeArgumentsSyntax.unexpectedBetweenMangledNameAndComma: + return "unexpectedBetweenMangledNameAndComma" + case \OpaqueReturnTypeOfAttributeArgumentsSyntax.comma: + return "comma" + case \OpaqueReturnTypeOfAttributeArgumentsSyntax.unexpectedBetweenCommaAndOrdinal: + return "unexpectedBetweenCommaAndOrdinal" + case \OpaqueReturnTypeOfAttributeArgumentsSyntax.ordinal: + return "ordinal" + case \OpaqueReturnTypeOfAttributeArgumentsSyntax.unexpectedAfterOrdinal: + return "unexpectedAfterOrdinal" + case \OperatorDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \OperatorDeclSyntax.attributes: + return "attributes" + case \OperatorDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \OperatorDeclSyntax.modifiers: + return "modifiers" + case \OperatorDeclSyntax.unexpectedBetweenModifiersAndOperatorKeyword: + return "unexpectedBetweenModifiersAndOperatorKeyword" + case \OperatorDeclSyntax.operatorKeyword: + return "operatorKeyword" + case \OperatorDeclSyntax.unexpectedBetweenOperatorKeywordAndIdentifier: + return "unexpectedBetweenOperatorKeywordAndIdentifier" + case \OperatorDeclSyntax.identifier: + return "identifier" + case \OperatorDeclSyntax.unexpectedBetweenIdentifierAndOperatorPrecedenceAndTypes: + return "unexpectedBetweenIdentifierAndOperatorPrecedenceAndTypes" + case \OperatorDeclSyntax.operatorPrecedenceAndTypes: + return "operatorPrecedenceAndTypes" + case \OperatorDeclSyntax.unexpectedAfterOperatorPrecedenceAndTypes: + return "unexpectedAfterOperatorPrecedenceAndTypes" + case \OperatorPrecedenceAndTypesSyntax.unexpectedBeforeColon: + return "unexpectedBeforeColon" + case \OperatorPrecedenceAndTypesSyntax.colon: + return "colon" + case \OperatorPrecedenceAndTypesSyntax.unexpectedBetweenColonAndPrecedenceGroup: + return "unexpectedBetweenColonAndPrecedenceGroup" + case \OperatorPrecedenceAndTypesSyntax.precedenceGroup: + return "precedenceGroup" + case \OperatorPrecedenceAndTypesSyntax.unexpectedBetweenPrecedenceGroupAndDesignatedTypes: + return "unexpectedBetweenPrecedenceGroupAndDesignatedTypes" + case \OperatorPrecedenceAndTypesSyntax.designatedTypes: + return "designatedTypes" + case \OperatorPrecedenceAndTypesSyntax.unexpectedAfterDesignatedTypes: + return "unexpectedAfterDesignatedTypes" + case \OptionalBindingConditionSyntax.unexpectedBeforeBindingKeyword: + return "unexpectedBeforeBindingKeyword" + case \OptionalBindingConditionSyntax.bindingKeyword: + return "bindingKeyword" + case \OptionalBindingConditionSyntax.unexpectedBetweenBindingKeywordAndPattern: + return "unexpectedBetweenBindingKeywordAndPattern" + case \OptionalBindingConditionSyntax.pattern: + return "pattern" + case \OptionalBindingConditionSyntax.unexpectedBetweenPatternAndTypeAnnotation: + return "unexpectedBetweenPatternAndTypeAnnotation" + case \OptionalBindingConditionSyntax.typeAnnotation: + return "typeAnnotation" + case \OptionalBindingConditionSyntax.unexpectedBetweenTypeAnnotationAndInitializer: + return "unexpectedBetweenTypeAnnotationAndInitializer" + case \OptionalBindingConditionSyntax.initializer: + return "initializer" + case \OptionalBindingConditionSyntax.unexpectedAfterInitializer: + return "unexpectedAfterInitializer" + case \OptionalChainingExprSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \OptionalChainingExprSyntax.expression: + return "expression" + case \OptionalChainingExprSyntax.unexpectedBetweenExpressionAndQuestionMark: + return "unexpectedBetweenExpressionAndQuestionMark" + case \OptionalChainingExprSyntax.questionMark: + return "questionMark" + case \OptionalChainingExprSyntax.unexpectedAfterQuestionMark: + return "unexpectedAfterQuestionMark" + case \OptionalTypeSyntax.unexpectedBeforeWrappedType: + return "unexpectedBeforeWrappedType" + case \OptionalTypeSyntax.wrappedType: + return "wrappedType" + case \OptionalTypeSyntax.unexpectedBetweenWrappedTypeAndQuestionMark: + return "unexpectedBetweenWrappedTypeAndQuestionMark" + case \OptionalTypeSyntax.questionMark: + return "questionMark" + case \OptionalTypeSyntax.unexpectedAfterQuestionMark: + return "unexpectedAfterQuestionMark" + case \OriginallyDefinedInArgumentsSyntax.unexpectedBeforeModuleLabel: + return "unexpectedBeforeModuleLabel" + case \OriginallyDefinedInArgumentsSyntax.moduleLabel: + return "moduleLabel" + case \OriginallyDefinedInArgumentsSyntax.unexpectedBetweenModuleLabelAndColon: + return "unexpectedBetweenModuleLabelAndColon" + case \OriginallyDefinedInArgumentsSyntax.colon: + return "colon" + case \OriginallyDefinedInArgumentsSyntax.unexpectedBetweenColonAndModuleName: + return "unexpectedBetweenColonAndModuleName" + case \OriginallyDefinedInArgumentsSyntax.moduleName: + return "moduleName" + case \OriginallyDefinedInArgumentsSyntax.unexpectedBetweenModuleNameAndComma: + return "unexpectedBetweenModuleNameAndComma" + case \OriginallyDefinedInArgumentsSyntax.comma: + return "comma" + case \OriginallyDefinedInArgumentsSyntax.unexpectedBetweenCommaAndPlatforms: + return "unexpectedBetweenCommaAndPlatforms" + case \OriginallyDefinedInArgumentsSyntax.platforms: + return "platforms" + case \OriginallyDefinedInArgumentsSyntax.unexpectedAfterPlatforms: + return "unexpectedAfterPlatforms" + case \PackElementExprSyntax.unexpectedBeforeEachKeyword: + return "unexpectedBeforeEachKeyword" + case \PackElementExprSyntax.eachKeyword: + return "eachKeyword" + case \PackElementExprSyntax.unexpectedBetweenEachKeywordAndPackRefExpr: + return "unexpectedBetweenEachKeywordAndPackRefExpr" + case \PackElementExprSyntax.packRefExpr: + return "packRefExpr" + case \PackElementExprSyntax.unexpectedAfterPackRefExpr: + return "unexpectedAfterPackRefExpr" + case \PackExpansionExprSyntax.unexpectedBeforeRepeatKeyword: + return "unexpectedBeforeRepeatKeyword" + case \PackExpansionExprSyntax.repeatKeyword: + return "repeatKeyword" + case \PackExpansionExprSyntax.unexpectedBetweenRepeatKeywordAndPatternExpr: + return "unexpectedBetweenRepeatKeywordAndPatternExpr" + case \PackExpansionExprSyntax.patternExpr: + return "patternExpr" + case \PackExpansionExprSyntax.unexpectedAfterPatternExpr: + return "unexpectedAfterPatternExpr" + case \PackExpansionTypeSyntax.unexpectedBeforeRepeatKeyword: + return "unexpectedBeforeRepeatKeyword" + case \PackExpansionTypeSyntax.repeatKeyword: + return "repeatKeyword" + case \PackExpansionTypeSyntax.unexpectedBetweenRepeatKeywordAndPatternType: + return "unexpectedBetweenRepeatKeywordAndPatternType" + case \PackExpansionTypeSyntax.patternType: + return "patternType" + case \PackExpansionTypeSyntax.unexpectedAfterPatternType: + return "unexpectedAfterPatternType" + case \PackReferenceTypeSyntax.unexpectedBeforeEachKeyword: + return "unexpectedBeforeEachKeyword" + case \PackReferenceTypeSyntax.eachKeyword: + return "eachKeyword" + case \PackReferenceTypeSyntax.unexpectedBetweenEachKeywordAndPackType: + return "unexpectedBetweenEachKeywordAndPackType" + case \PackReferenceTypeSyntax.packType: + return "packType" + case \PackReferenceTypeSyntax.unexpectedAfterPackType: + return "unexpectedAfterPackType" + case \ParameterClauseSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \ParameterClauseSyntax.leftParen: + return "leftParen" + case \ParameterClauseSyntax.unexpectedBetweenLeftParenAndParameterList: + return "unexpectedBetweenLeftParenAndParameterList" + case \ParameterClauseSyntax.parameterList: + return "parameterList" + case \ParameterClauseSyntax.unexpectedBetweenParameterListAndRightParen: + return "unexpectedBetweenParameterListAndRightParen" + case \ParameterClauseSyntax.rightParen: + return "rightParen" + case \ParameterClauseSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \PatternBindingSyntax.unexpectedBeforePattern: + return "unexpectedBeforePattern" + case \PatternBindingSyntax.pattern: + return "pattern" + case \PatternBindingSyntax.unexpectedBetweenPatternAndTypeAnnotation: + return "unexpectedBetweenPatternAndTypeAnnotation" + case \PatternBindingSyntax.typeAnnotation: + return "typeAnnotation" + case \PatternBindingSyntax.unexpectedBetweenTypeAnnotationAndInitializer: + return "unexpectedBetweenTypeAnnotationAndInitializer" + case \PatternBindingSyntax.initializer: + return "initializer" + case \PatternBindingSyntax.unexpectedBetweenInitializerAndAccessor: + return "unexpectedBetweenInitializerAndAccessor" + case \PatternBindingSyntax.accessor: + return "accessor" + case \PatternBindingSyntax.unexpectedBetweenAccessorAndTrailingComma: + return "unexpectedBetweenAccessorAndTrailingComma" + case \PatternBindingSyntax.trailingComma: + return "trailingComma" + case \PatternBindingSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \PostfixIfConfigExprSyntax.unexpectedBeforeBase: + return "unexpectedBeforeBase" + case \PostfixIfConfigExprSyntax.base: + return "base" + case \PostfixIfConfigExprSyntax.unexpectedBetweenBaseAndConfig: + return "unexpectedBetweenBaseAndConfig" + case \PostfixIfConfigExprSyntax.config: + return "config" + case \PostfixIfConfigExprSyntax.unexpectedAfterConfig: + return "unexpectedAfterConfig" + case \PostfixUnaryExprSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \PostfixUnaryExprSyntax.expression: + return "expression" + case \PostfixUnaryExprSyntax.unexpectedBetweenExpressionAndOperatorToken: + return "unexpectedBetweenExpressionAndOperatorToken" + case \PostfixUnaryExprSyntax.operatorToken: + return "operatorToken" + case \PostfixUnaryExprSyntax.unexpectedAfterOperatorToken: + return "unexpectedAfterOperatorToken" + case \PoundSourceLocationArgsSyntax.unexpectedBeforeFileArgLabel: + return "unexpectedBeforeFileArgLabel" + case \PoundSourceLocationArgsSyntax.fileArgLabel: + return "fileArgLabel" + case \PoundSourceLocationArgsSyntax.unexpectedBetweenFileArgLabelAndFileArgColon: + return "unexpectedBetweenFileArgLabelAndFileArgColon" + case \PoundSourceLocationArgsSyntax.fileArgColon: + return "fileArgColon" + case \PoundSourceLocationArgsSyntax.unexpectedBetweenFileArgColonAndFileName: + return "unexpectedBetweenFileArgColonAndFileName" + case \PoundSourceLocationArgsSyntax.fileName: + return "fileName" + case \PoundSourceLocationArgsSyntax.unexpectedBetweenFileNameAndComma: + return "unexpectedBetweenFileNameAndComma" + case \PoundSourceLocationArgsSyntax.comma: + return "comma" + case \PoundSourceLocationArgsSyntax.unexpectedBetweenCommaAndLineArgLabel: + return "unexpectedBetweenCommaAndLineArgLabel" + case \PoundSourceLocationArgsSyntax.lineArgLabel: + return "lineArgLabel" + case \PoundSourceLocationArgsSyntax.unexpectedBetweenLineArgLabelAndLineArgColon: + return "unexpectedBetweenLineArgLabelAndLineArgColon" + case \PoundSourceLocationArgsSyntax.lineArgColon: + return "lineArgColon" + case \PoundSourceLocationArgsSyntax.unexpectedBetweenLineArgColonAndLineNumber: + return "unexpectedBetweenLineArgColonAndLineNumber" + case \PoundSourceLocationArgsSyntax.lineNumber: + return "lineNumber" + case \PoundSourceLocationArgsSyntax.unexpectedAfterLineNumber: + return "unexpectedAfterLineNumber" + case \PoundSourceLocationSyntax.unexpectedBeforePoundSourceLocation: + return "unexpectedBeforePoundSourceLocation" + case \PoundSourceLocationSyntax.poundSourceLocation: + return "poundSourceLocation" + case \PoundSourceLocationSyntax.unexpectedBetweenPoundSourceLocationAndLeftParen: + return "unexpectedBetweenPoundSourceLocationAndLeftParen" + case \PoundSourceLocationSyntax.leftParen: + return "leftParen" + case \PoundSourceLocationSyntax.unexpectedBetweenLeftParenAndArgs: + return "unexpectedBetweenLeftParenAndArgs" + case \PoundSourceLocationSyntax.args: + return "args" + case \PoundSourceLocationSyntax.unexpectedBetweenArgsAndRightParen: + return "unexpectedBetweenArgsAndRightParen" + case \PoundSourceLocationSyntax.rightParen: + return "rightParen" + case \PoundSourceLocationSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \PrecedenceGroupAssignmentSyntax.unexpectedBeforeAssignmentKeyword: + return "unexpectedBeforeAssignmentKeyword" + case \PrecedenceGroupAssignmentSyntax.assignmentKeyword: + return "assignmentKeyword" + case \PrecedenceGroupAssignmentSyntax.unexpectedBetweenAssignmentKeywordAndColon: + return "unexpectedBetweenAssignmentKeywordAndColon" + case \PrecedenceGroupAssignmentSyntax.colon: + return "colon" + case \PrecedenceGroupAssignmentSyntax.unexpectedBetweenColonAndFlag: + return "unexpectedBetweenColonAndFlag" + case \PrecedenceGroupAssignmentSyntax.flag: + return "flag" + case \PrecedenceGroupAssignmentSyntax.unexpectedAfterFlag: + return "unexpectedAfterFlag" + case \PrecedenceGroupAssociativitySyntax.unexpectedBeforeAssociativityKeyword: + return "unexpectedBeforeAssociativityKeyword" + case \PrecedenceGroupAssociativitySyntax.associativityKeyword: + return "associativityKeyword" + case \PrecedenceGroupAssociativitySyntax.unexpectedBetweenAssociativityKeywordAndColon: + return "unexpectedBetweenAssociativityKeywordAndColon" + case \PrecedenceGroupAssociativitySyntax.colon: + return "colon" + case \PrecedenceGroupAssociativitySyntax.unexpectedBetweenColonAndValue: + return "unexpectedBetweenColonAndValue" + case \PrecedenceGroupAssociativitySyntax.value: + return "value" + case \PrecedenceGroupAssociativitySyntax.unexpectedAfterValue: + return "unexpectedAfterValue" + case \PrecedenceGroupDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \PrecedenceGroupDeclSyntax.attributes: + return "attributes" + case \PrecedenceGroupDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \PrecedenceGroupDeclSyntax.modifiers: + return "modifiers" + case \PrecedenceGroupDeclSyntax.unexpectedBetweenModifiersAndPrecedencegroupKeyword: + return "unexpectedBetweenModifiersAndPrecedencegroupKeyword" + case \PrecedenceGroupDeclSyntax.precedencegroupKeyword: + return "precedencegroupKeyword" + case \PrecedenceGroupDeclSyntax.unexpectedBetweenPrecedencegroupKeywordAndIdentifier: + return "unexpectedBetweenPrecedencegroupKeywordAndIdentifier" + case \PrecedenceGroupDeclSyntax.identifier: + return "identifier" + case \PrecedenceGroupDeclSyntax.unexpectedBetweenIdentifierAndLeftBrace: + return "unexpectedBetweenIdentifierAndLeftBrace" + case \PrecedenceGroupDeclSyntax.leftBrace: + return "leftBrace" + case \PrecedenceGroupDeclSyntax.unexpectedBetweenLeftBraceAndGroupAttributes: + return "unexpectedBetweenLeftBraceAndGroupAttributes" + case \PrecedenceGroupDeclSyntax.groupAttributes: + return "groupAttributes" + case \PrecedenceGroupDeclSyntax.unexpectedBetweenGroupAttributesAndRightBrace: + return "unexpectedBetweenGroupAttributesAndRightBrace" + case \PrecedenceGroupDeclSyntax.rightBrace: + return "rightBrace" + case \PrecedenceGroupDeclSyntax.unexpectedAfterRightBrace: + return "unexpectedAfterRightBrace" + case \PrecedenceGroupNameElementSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \PrecedenceGroupNameElementSyntax.name: + return "name" + case \PrecedenceGroupNameElementSyntax.unexpectedBetweenNameAndTrailingComma: + return "unexpectedBetweenNameAndTrailingComma" + case \PrecedenceGroupNameElementSyntax.trailingComma: + return "trailingComma" + case \PrecedenceGroupNameElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \PrecedenceGroupRelationSyntax.unexpectedBeforeHigherThanOrLowerThan: + return "unexpectedBeforeHigherThanOrLowerThan" + case \PrecedenceGroupRelationSyntax.higherThanOrLowerThan: + return "higherThanOrLowerThan" + case \PrecedenceGroupRelationSyntax.unexpectedBetweenHigherThanOrLowerThanAndColon: + return "unexpectedBetweenHigherThanOrLowerThanAndColon" + case \PrecedenceGroupRelationSyntax.colon: + return "colon" + case \PrecedenceGroupRelationSyntax.unexpectedBetweenColonAndOtherNames: + return "unexpectedBetweenColonAndOtherNames" + case \PrecedenceGroupRelationSyntax.otherNames: + return "otherNames" + case \PrecedenceGroupRelationSyntax.unexpectedAfterOtherNames: + return "unexpectedAfterOtherNames" + case \PrefixOperatorExprSyntax.unexpectedBeforeOperatorToken: + return "unexpectedBeforeOperatorToken" + case \PrefixOperatorExprSyntax.operatorToken: + return "operatorToken" + case \PrefixOperatorExprSyntax.unexpectedBetweenOperatorTokenAndPostfixExpression: + return "unexpectedBetweenOperatorTokenAndPostfixExpression" + case \PrefixOperatorExprSyntax.postfixExpression: + return "postfixExpression" + case \PrefixOperatorExprSyntax.unexpectedAfterPostfixExpression: + return "unexpectedAfterPostfixExpression" + case \PrimaryAssociatedTypeClauseSyntax.unexpectedBeforeLeftAngleBracket: + return "unexpectedBeforeLeftAngleBracket" + case \PrimaryAssociatedTypeClauseSyntax.leftAngleBracket: + return "leftAngleBracket" + case \PrimaryAssociatedTypeClauseSyntax.unexpectedBetweenLeftAngleBracketAndPrimaryAssociatedTypeList: + return "unexpectedBetweenLeftAngleBracketAndPrimaryAssociatedTypeList" + case \PrimaryAssociatedTypeClauseSyntax.primaryAssociatedTypeList: + return "primaryAssociatedTypeList" + case \PrimaryAssociatedTypeClauseSyntax.unexpectedBetweenPrimaryAssociatedTypeListAndRightAngleBracket: + return "unexpectedBetweenPrimaryAssociatedTypeListAndRightAngleBracket" + case \PrimaryAssociatedTypeClauseSyntax.rightAngleBracket: + return "rightAngleBracket" + case \PrimaryAssociatedTypeClauseSyntax.unexpectedAfterRightAngleBracket: + return "unexpectedAfterRightAngleBracket" + case \PrimaryAssociatedTypeSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \PrimaryAssociatedTypeSyntax.name: + return "name" + case \PrimaryAssociatedTypeSyntax.unexpectedBetweenNameAndTrailingComma: + return "unexpectedBetweenNameAndTrailingComma" + case \PrimaryAssociatedTypeSyntax.trailingComma: + return "trailingComma" + case \PrimaryAssociatedTypeSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \ProtocolDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \ProtocolDeclSyntax.attributes: + return "attributes" + case \ProtocolDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \ProtocolDeclSyntax.modifiers: + return "modifiers" + case \ProtocolDeclSyntax.unexpectedBetweenModifiersAndProtocolKeyword: + return "unexpectedBetweenModifiersAndProtocolKeyword" + case \ProtocolDeclSyntax.protocolKeyword: + return "protocolKeyword" + case \ProtocolDeclSyntax.unexpectedBetweenProtocolKeywordAndIdentifier: + return "unexpectedBetweenProtocolKeywordAndIdentifier" + case \ProtocolDeclSyntax.identifier: + return "identifier" + case \ProtocolDeclSyntax.unexpectedBetweenIdentifierAndPrimaryAssociatedTypeClause: + return "unexpectedBetweenIdentifierAndPrimaryAssociatedTypeClause" + case \ProtocolDeclSyntax.primaryAssociatedTypeClause: + return "primaryAssociatedTypeClause" + case \ProtocolDeclSyntax.unexpectedBetweenPrimaryAssociatedTypeClauseAndInheritanceClause: + return "unexpectedBetweenPrimaryAssociatedTypeClauseAndInheritanceClause" + case \ProtocolDeclSyntax.inheritanceClause: + return "inheritanceClause" + case \ProtocolDeclSyntax.unexpectedBetweenInheritanceClauseAndGenericWhereClause: + return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" + case \ProtocolDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \ProtocolDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: + return "unexpectedBetweenGenericWhereClauseAndMembers" + case \ProtocolDeclSyntax.members: + return "members" + case \ProtocolDeclSyntax.unexpectedAfterMembers: + return "unexpectedAfterMembers" + case \QualifiedDeclNameSyntax.unexpectedBeforeBaseType: + return "unexpectedBeforeBaseType" + case \QualifiedDeclNameSyntax.baseType: + return "baseType" + case \QualifiedDeclNameSyntax.unexpectedBetweenBaseTypeAndDot: + return "unexpectedBetweenBaseTypeAndDot" + case \QualifiedDeclNameSyntax.dot: + return "dot" + case \QualifiedDeclNameSyntax.unexpectedBetweenDotAndName: + return "unexpectedBetweenDotAndName" + case \QualifiedDeclNameSyntax.name: + return "name" + case \QualifiedDeclNameSyntax.unexpectedBetweenNameAndArguments: + return "unexpectedBetweenNameAndArguments" + case \QualifiedDeclNameSyntax.arguments: + return "arguments" + case \QualifiedDeclNameSyntax.unexpectedAfterArguments: + return "unexpectedAfterArguments" + case \RegexLiteralExprSyntax.unexpectedBeforeOpeningPounds: + return "unexpectedBeforeOpeningPounds" + case \RegexLiteralExprSyntax.openingPounds: + return "openingPounds" + case \RegexLiteralExprSyntax.unexpectedBetweenOpeningPoundsAndOpenSlash: + return "unexpectedBetweenOpeningPoundsAndOpenSlash" + case \RegexLiteralExprSyntax.openSlash: + return "openSlash" + case \RegexLiteralExprSyntax.unexpectedBetweenOpenSlashAndRegexPattern: + return "unexpectedBetweenOpenSlashAndRegexPattern" + case \RegexLiteralExprSyntax.regexPattern: + return "regexPattern" + case \RegexLiteralExprSyntax.unexpectedBetweenRegexPatternAndCloseSlash: + return "unexpectedBetweenRegexPatternAndCloseSlash" + case \RegexLiteralExprSyntax.closeSlash: + return "closeSlash" + case \RegexLiteralExprSyntax.unexpectedBetweenCloseSlashAndClosingPounds: + return "unexpectedBetweenCloseSlashAndClosingPounds" + case \RegexLiteralExprSyntax.closingPounds: + return "closingPounds" + case \RegexLiteralExprSyntax.unexpectedAfterClosingPounds: + return "unexpectedAfterClosingPounds" + case \RepeatWhileStmtSyntax.unexpectedBeforeRepeatKeyword: + return "unexpectedBeforeRepeatKeyword" + case \RepeatWhileStmtSyntax.repeatKeyword: + return "repeatKeyword" + case \RepeatWhileStmtSyntax.unexpectedBetweenRepeatKeywordAndBody: + return "unexpectedBetweenRepeatKeywordAndBody" + case \RepeatWhileStmtSyntax.body: + return "body" + case \RepeatWhileStmtSyntax.unexpectedBetweenBodyAndWhileKeyword: + return "unexpectedBetweenBodyAndWhileKeyword" + case \RepeatWhileStmtSyntax.whileKeyword: + return "whileKeyword" + case \RepeatWhileStmtSyntax.unexpectedBetweenWhileKeywordAndCondition: + return "unexpectedBetweenWhileKeywordAndCondition" + case \RepeatWhileStmtSyntax.condition: + return "condition" + case \RepeatWhileStmtSyntax.unexpectedAfterCondition: + return "unexpectedAfterCondition" + case \ReturnClauseSyntax.unexpectedBeforeArrow: + return "unexpectedBeforeArrow" + case \ReturnClauseSyntax.arrow: + return "arrow" + case \ReturnClauseSyntax.unexpectedBetweenArrowAndReturnType: + return "unexpectedBetweenArrowAndReturnType" + case \ReturnClauseSyntax.returnType: + return "returnType" + case \ReturnClauseSyntax.unexpectedAfterReturnType: + return "unexpectedAfterReturnType" + case \ReturnStmtSyntax.unexpectedBeforeReturnKeyword: + return "unexpectedBeforeReturnKeyword" + case \ReturnStmtSyntax.returnKeyword: + return "returnKeyword" + case \ReturnStmtSyntax.unexpectedBetweenReturnKeywordAndExpression: + return "unexpectedBetweenReturnKeywordAndExpression" + case \ReturnStmtSyntax.expression: + return "expression" + case \ReturnStmtSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \SameTypeRequirementSyntax.unexpectedBeforeLeftTypeIdentifier: + return "unexpectedBeforeLeftTypeIdentifier" + case \SameTypeRequirementSyntax.leftTypeIdentifier: + return "leftTypeIdentifier" + case \SameTypeRequirementSyntax.unexpectedBetweenLeftTypeIdentifierAndEqualityToken: + return "unexpectedBetweenLeftTypeIdentifierAndEqualityToken" + case \SameTypeRequirementSyntax.equalityToken: + return "equalityToken" + case \SameTypeRequirementSyntax.unexpectedBetweenEqualityTokenAndRightTypeIdentifier: + return "unexpectedBetweenEqualityTokenAndRightTypeIdentifier" + case \SameTypeRequirementSyntax.rightTypeIdentifier: + return "rightTypeIdentifier" + case \SameTypeRequirementSyntax.unexpectedAfterRightTypeIdentifier: + return "unexpectedAfterRightTypeIdentifier" + case \SequenceExprSyntax.unexpectedBeforeElements: + return "unexpectedBeforeElements" + case \SequenceExprSyntax.elements: + return "elements" + case \SequenceExprSyntax.unexpectedAfterElements: + return "unexpectedAfterElements" + case \SimpleTypeIdentifierSyntax.unexpectedBeforeName: + return "unexpectedBeforeName" + case \SimpleTypeIdentifierSyntax.name: + return "name" + case \SimpleTypeIdentifierSyntax.unexpectedBetweenNameAndGenericArgumentClause: + return "unexpectedBetweenNameAndGenericArgumentClause" + case \SimpleTypeIdentifierSyntax.genericArgumentClause: + return "genericArgumentClause" + case \SimpleTypeIdentifierSyntax.unexpectedAfterGenericArgumentClause: + return "unexpectedAfterGenericArgumentClause" + case \SourceFileSyntax.unexpectedBeforeStatements: + return "unexpectedBeforeStatements" + case \SourceFileSyntax.statements: + return "statements" + case \SourceFileSyntax.unexpectedBetweenStatementsAndEOFToken: + return "unexpectedBetweenStatementsAndEOFToken" + case \SourceFileSyntax.eofToken: + return "eofToken" + case \SourceFileSyntax.unexpectedAfterEOFToken: + return "unexpectedAfterEOFToken" + case \SpecializeExprSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \SpecializeExprSyntax.expression: + return "expression" + case \SpecializeExprSyntax.unexpectedBetweenExpressionAndGenericArgumentClause: + return "unexpectedBetweenExpressionAndGenericArgumentClause" + case \SpecializeExprSyntax.genericArgumentClause: + return "genericArgumentClause" + case \SpecializeExprSyntax.unexpectedAfterGenericArgumentClause: + return "unexpectedAfterGenericArgumentClause" + case \StringLiteralExprSyntax.unexpectedBeforeOpenDelimiter: + return "unexpectedBeforeOpenDelimiter" + case \StringLiteralExprSyntax.openDelimiter: + return "openDelimiter" + case \StringLiteralExprSyntax.unexpectedBetweenOpenDelimiterAndOpenQuote: + return "unexpectedBetweenOpenDelimiterAndOpenQuote" + case \StringLiteralExprSyntax.openQuote: + return "openQuote" + case \StringLiteralExprSyntax.unexpectedBetweenOpenQuoteAndSegments: + return "unexpectedBetweenOpenQuoteAndSegments" + case \StringLiteralExprSyntax.segments: + return "segments" + case \StringLiteralExprSyntax.unexpectedBetweenSegmentsAndCloseQuote: + return "unexpectedBetweenSegmentsAndCloseQuote" + case \StringLiteralExprSyntax.closeQuote: + return "closeQuote" + case \StringLiteralExprSyntax.unexpectedBetweenCloseQuoteAndCloseDelimiter: + return "unexpectedBetweenCloseQuoteAndCloseDelimiter" + case \StringLiteralExprSyntax.closeDelimiter: + return "closeDelimiter" + case \StringLiteralExprSyntax.unexpectedAfterCloseDelimiter: + return "unexpectedAfterCloseDelimiter" + case \StringSegmentSyntax.unexpectedBeforeContent: + return "unexpectedBeforeContent" + case \StringSegmentSyntax.content: + return "content" + case \StringSegmentSyntax.unexpectedAfterContent: + return "unexpectedAfterContent" + case \StructDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \StructDeclSyntax.attributes: + return "attributes" + case \StructDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \StructDeclSyntax.modifiers: + return "modifiers" + case \StructDeclSyntax.unexpectedBetweenModifiersAndStructKeyword: + return "unexpectedBetweenModifiersAndStructKeyword" + case \StructDeclSyntax.structKeyword: + return "structKeyword" + case \StructDeclSyntax.unexpectedBetweenStructKeywordAndIdentifier: + return "unexpectedBetweenStructKeywordAndIdentifier" + case \StructDeclSyntax.identifier: + return "identifier" + case \StructDeclSyntax.unexpectedBetweenIdentifierAndGenericParameterClause: + return "unexpectedBetweenIdentifierAndGenericParameterClause" + case \StructDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \StructDeclSyntax.unexpectedBetweenGenericParameterClauseAndInheritanceClause: + return "unexpectedBetweenGenericParameterClauseAndInheritanceClause" + case \StructDeclSyntax.inheritanceClause: + return "inheritanceClause" + case \StructDeclSyntax.unexpectedBetweenInheritanceClauseAndGenericWhereClause: + return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" + case \StructDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \StructDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: + return "unexpectedBetweenGenericWhereClauseAndMembers" + case \StructDeclSyntax.members: + return "members" + case \StructDeclSyntax.unexpectedAfterMembers: + return "unexpectedAfterMembers" + case \SubscriptDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \SubscriptDeclSyntax.attributes: + return "attributes" + case \SubscriptDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \SubscriptDeclSyntax.modifiers: + return "modifiers" + case \SubscriptDeclSyntax.unexpectedBetweenModifiersAndSubscriptKeyword: + return "unexpectedBetweenModifiersAndSubscriptKeyword" + case \SubscriptDeclSyntax.subscriptKeyword: + return "subscriptKeyword" + case \SubscriptDeclSyntax.unexpectedBetweenSubscriptKeywordAndGenericParameterClause: + return "unexpectedBetweenSubscriptKeywordAndGenericParameterClause" + case \SubscriptDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \SubscriptDeclSyntax.unexpectedBetweenGenericParameterClauseAndIndices: + return "unexpectedBetweenGenericParameterClauseAndIndices" + case \SubscriptDeclSyntax.indices: + return "indices" + case \SubscriptDeclSyntax.unexpectedBetweenIndicesAndResult: + return "unexpectedBetweenIndicesAndResult" + case \SubscriptDeclSyntax.result: + return "result" + case \SubscriptDeclSyntax.unexpectedBetweenResultAndGenericWhereClause: + return "unexpectedBetweenResultAndGenericWhereClause" + case \SubscriptDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \SubscriptDeclSyntax.unexpectedBetweenGenericWhereClauseAndAccessor: + return "unexpectedBetweenGenericWhereClauseAndAccessor" + case \SubscriptDeclSyntax.accessor: + return "accessor" + case \SubscriptDeclSyntax.unexpectedAfterAccessor: + return "unexpectedAfterAccessor" + case \SubscriptExprSyntax.unexpectedBeforeCalledExpression: + return "unexpectedBeforeCalledExpression" + case \SubscriptExprSyntax.calledExpression: + return "calledExpression" + case \SubscriptExprSyntax.unexpectedBetweenCalledExpressionAndLeftBracket: + return "unexpectedBetweenCalledExpressionAndLeftBracket" + case \SubscriptExprSyntax.leftBracket: + return "leftBracket" + case \SubscriptExprSyntax.unexpectedBetweenLeftBracketAndArgumentList: + return "unexpectedBetweenLeftBracketAndArgumentList" + case \SubscriptExprSyntax.argumentList: + return "argumentList" + case \SubscriptExprSyntax.unexpectedBetweenArgumentListAndRightBracket: + return "unexpectedBetweenArgumentListAndRightBracket" + case \SubscriptExprSyntax.rightBracket: + return "rightBracket" + case \SubscriptExprSyntax.unexpectedBetweenRightBracketAndTrailingClosure: + return "unexpectedBetweenRightBracketAndTrailingClosure" + case \SubscriptExprSyntax.trailingClosure: + return "trailingClosure" + case \SubscriptExprSyntax.unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: + return "unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures" + case \SubscriptExprSyntax.additionalTrailingClosures: + return "additionalTrailingClosures" + case \SubscriptExprSyntax.unexpectedAfterAdditionalTrailingClosures: + return "unexpectedAfterAdditionalTrailingClosures" + case \SuperRefExprSyntax.unexpectedBeforeSuperKeyword: + return "unexpectedBeforeSuperKeyword" + case \SuperRefExprSyntax.superKeyword: + return "superKeyword" + case \SuperRefExprSyntax.unexpectedAfterSuperKeyword: + return "unexpectedAfterSuperKeyword" + case \SwitchCaseLabelSyntax.unexpectedBeforeCaseKeyword: + return "unexpectedBeforeCaseKeyword" + case \SwitchCaseLabelSyntax.caseKeyword: + return "caseKeyword" + case \SwitchCaseLabelSyntax.unexpectedBetweenCaseKeywordAndCaseItems: + return "unexpectedBetweenCaseKeywordAndCaseItems" + case \SwitchCaseLabelSyntax.caseItems: + return "caseItems" + case \SwitchCaseLabelSyntax.unexpectedBetweenCaseItemsAndColon: + return "unexpectedBetweenCaseItemsAndColon" + case \SwitchCaseLabelSyntax.colon: + return "colon" + case \SwitchCaseLabelSyntax.unexpectedAfterColon: + return "unexpectedAfterColon" + case \SwitchCaseSyntax.unexpectedBeforeUnknownAttr: + return "unexpectedBeforeUnknownAttr" + case \SwitchCaseSyntax.unknownAttr: + return "unknownAttr" + case \SwitchCaseSyntax.unexpectedBetweenUnknownAttrAndLabel: + return "unexpectedBetweenUnknownAttrAndLabel" + case \SwitchCaseSyntax.label: + return "label" + case \SwitchCaseSyntax.unexpectedBetweenLabelAndStatements: + return "unexpectedBetweenLabelAndStatements" + case \SwitchCaseSyntax.statements: + return "statements" + case \SwitchCaseSyntax.unexpectedAfterStatements: + return "unexpectedAfterStatements" + case \SwitchDefaultLabelSyntax.unexpectedBeforeDefaultKeyword: + return "unexpectedBeforeDefaultKeyword" + case \SwitchDefaultLabelSyntax.defaultKeyword: + return "defaultKeyword" + case \SwitchDefaultLabelSyntax.unexpectedBetweenDefaultKeywordAndColon: + return "unexpectedBetweenDefaultKeywordAndColon" + case \SwitchDefaultLabelSyntax.colon: + return "colon" + case \SwitchDefaultLabelSyntax.unexpectedAfterColon: + return "unexpectedAfterColon" + case \SwitchExprSyntax.unexpectedBeforeSwitchKeyword: + return "unexpectedBeforeSwitchKeyword" + case \SwitchExprSyntax.switchKeyword: + return "switchKeyword" + case \SwitchExprSyntax.unexpectedBetweenSwitchKeywordAndExpression: + return "unexpectedBetweenSwitchKeywordAndExpression" + case \SwitchExprSyntax.expression: + return "expression" + case \SwitchExprSyntax.unexpectedBetweenExpressionAndLeftBrace: + return "unexpectedBetweenExpressionAndLeftBrace" + case \SwitchExprSyntax.leftBrace: + return "leftBrace" + case \SwitchExprSyntax.unexpectedBetweenLeftBraceAndCases: + return "unexpectedBetweenLeftBraceAndCases" + case \SwitchExprSyntax.cases: + return "cases" + case \SwitchExprSyntax.unexpectedBetweenCasesAndRightBrace: + return "unexpectedBetweenCasesAndRightBrace" + case \SwitchExprSyntax.rightBrace: + return "rightBrace" + case \SwitchExprSyntax.unexpectedAfterRightBrace: + return "unexpectedAfterRightBrace" + case \TargetFunctionEntrySyntax.unexpectedBeforeLabel: + return "unexpectedBeforeLabel" + case \TargetFunctionEntrySyntax.label: + return "label" + case \TargetFunctionEntrySyntax.unexpectedBetweenLabelAndColon: + return "unexpectedBetweenLabelAndColon" + case \TargetFunctionEntrySyntax.colon: + return "colon" + case \TargetFunctionEntrySyntax.unexpectedBetweenColonAndDeclname: + return "unexpectedBetweenColonAndDeclname" + case \TargetFunctionEntrySyntax.declname: + return "declname" + case \TargetFunctionEntrySyntax.unexpectedBetweenDeclnameAndTrailingComma: + return "unexpectedBetweenDeclnameAndTrailingComma" + case \TargetFunctionEntrySyntax.trailingComma: + return "trailingComma" + case \TargetFunctionEntrySyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \TernaryExprSyntax.unexpectedBeforeConditionExpression: + return "unexpectedBeforeConditionExpression" + case \TernaryExprSyntax.conditionExpression: + return "conditionExpression" + case \TernaryExprSyntax.unexpectedBetweenConditionExpressionAndQuestionMark: + return "unexpectedBetweenConditionExpressionAndQuestionMark" + case \TernaryExprSyntax.questionMark: + return "questionMark" + case \TernaryExprSyntax.unexpectedBetweenQuestionMarkAndFirstChoice: + return "unexpectedBetweenQuestionMarkAndFirstChoice" + case \TernaryExprSyntax.firstChoice: + return "firstChoice" + case \TernaryExprSyntax.unexpectedBetweenFirstChoiceAndColonMark: + return "unexpectedBetweenFirstChoiceAndColonMark" + case \TernaryExprSyntax.colonMark: + return "colonMark" + case \TernaryExprSyntax.unexpectedBetweenColonMarkAndSecondChoice: + return "unexpectedBetweenColonMarkAndSecondChoice" + case \TernaryExprSyntax.secondChoice: + return "secondChoice" + case \TernaryExprSyntax.unexpectedAfterSecondChoice: + return "unexpectedAfterSecondChoice" + case \ThrowStmtSyntax.unexpectedBeforeThrowKeyword: + return "unexpectedBeforeThrowKeyword" + case \ThrowStmtSyntax.throwKeyword: + return "throwKeyword" + case \ThrowStmtSyntax.unexpectedBetweenThrowKeywordAndExpression: + return "unexpectedBetweenThrowKeywordAndExpression" + case \ThrowStmtSyntax.expression: + return "expression" + case \ThrowStmtSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \TryExprSyntax.unexpectedBeforeTryKeyword: + return "unexpectedBeforeTryKeyword" + case \TryExprSyntax.tryKeyword: + return "tryKeyword" + case \TryExprSyntax.unexpectedBetweenTryKeywordAndQuestionOrExclamationMark: + return "unexpectedBetweenTryKeywordAndQuestionOrExclamationMark" + case \TryExprSyntax.questionOrExclamationMark: + return "questionOrExclamationMark" + case \TryExprSyntax.unexpectedBetweenQuestionOrExclamationMarkAndExpression: + return "unexpectedBetweenQuestionOrExclamationMarkAndExpression" + case \TryExprSyntax.expression: + return "expression" + case \TryExprSyntax.unexpectedAfterExpression: + return "unexpectedAfterExpression" + case \TupleExprElementSyntax.unexpectedBeforeLabel: + return "unexpectedBeforeLabel" + case \TupleExprElementSyntax.label: + return "label" + case \TupleExprElementSyntax.unexpectedBetweenLabelAndColon: + return "unexpectedBetweenLabelAndColon" + case \TupleExprElementSyntax.colon: + return "colon" + case \TupleExprElementSyntax.unexpectedBetweenColonAndExpression: + return "unexpectedBetweenColonAndExpression" + case \TupleExprElementSyntax.expression: + return "expression" + case \TupleExprElementSyntax.unexpectedBetweenExpressionAndTrailingComma: + return "unexpectedBetweenExpressionAndTrailingComma" + case \TupleExprElementSyntax.trailingComma: + return "trailingComma" + case \TupleExprElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \TupleExprSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \TupleExprSyntax.leftParen: + return "leftParen" + case \TupleExprSyntax.unexpectedBetweenLeftParenAndElementList: + return "unexpectedBetweenLeftParenAndElementList" + case \TupleExprSyntax.elementList: + return "elementList" + case \TupleExprSyntax.unexpectedBetweenElementListAndRightParen: + return "unexpectedBetweenElementListAndRightParen" + case \TupleExprSyntax.rightParen: + return "rightParen" + case \TupleExprSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \TuplePatternElementSyntax.unexpectedBeforeLabelName: + return "unexpectedBeforeLabelName" + case \TuplePatternElementSyntax.labelName: + return "labelName" + case \TuplePatternElementSyntax.unexpectedBetweenLabelNameAndLabelColon: + return "unexpectedBetweenLabelNameAndLabelColon" + case \TuplePatternElementSyntax.labelColon: + return "labelColon" + case \TuplePatternElementSyntax.unexpectedBetweenLabelColonAndPattern: + return "unexpectedBetweenLabelColonAndPattern" + case \TuplePatternElementSyntax.pattern: + return "pattern" + case \TuplePatternElementSyntax.unexpectedBetweenPatternAndTrailingComma: + return "unexpectedBetweenPatternAndTrailingComma" + case \TuplePatternElementSyntax.trailingComma: + return "trailingComma" + case \TuplePatternElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \TuplePatternSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \TuplePatternSyntax.leftParen: + return "leftParen" + case \TuplePatternSyntax.unexpectedBetweenLeftParenAndElements: + return "unexpectedBetweenLeftParenAndElements" + case \TuplePatternSyntax.elements: + return "elements" + case \TuplePatternSyntax.unexpectedBetweenElementsAndRightParen: + return "unexpectedBetweenElementsAndRightParen" + case \TuplePatternSyntax.rightParen: + return "rightParen" + case \TuplePatternSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \TupleTypeElementSyntax.unexpectedBeforeInOut: + return "unexpectedBeforeInOut" + case \TupleTypeElementSyntax.inOut: + return "inOut" + case \TupleTypeElementSyntax.unexpectedBetweenInOutAndName: + return "unexpectedBetweenInOutAndName" + case \TupleTypeElementSyntax.name: + return "name" + case \TupleTypeElementSyntax.unexpectedBetweenNameAndSecondName: + return "unexpectedBetweenNameAndSecondName" + case \TupleTypeElementSyntax.secondName: + return "secondName" + case \TupleTypeElementSyntax.unexpectedBetweenSecondNameAndColon: + return "unexpectedBetweenSecondNameAndColon" + case \TupleTypeElementSyntax.colon: + return "colon" + case \TupleTypeElementSyntax.unexpectedBetweenColonAndType: + return "unexpectedBetweenColonAndType" + case \TupleTypeElementSyntax.type: + return "type" + case \TupleTypeElementSyntax.unexpectedBetweenTypeAndEllipsis: + return "unexpectedBetweenTypeAndEllipsis" + case \TupleTypeElementSyntax.ellipsis: + return "ellipsis" + case \TupleTypeElementSyntax.unexpectedBetweenEllipsisAndInitializer: + return "unexpectedBetweenEllipsisAndInitializer" + case \TupleTypeElementSyntax.initializer: + return "initializer" + case \TupleTypeElementSyntax.unexpectedBetweenInitializerAndTrailingComma: + return "unexpectedBetweenInitializerAndTrailingComma" + case \TupleTypeElementSyntax.trailingComma: + return "trailingComma" + case \TupleTypeElementSyntax.unexpectedAfterTrailingComma: + return "unexpectedAfterTrailingComma" + case \TupleTypeSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \TupleTypeSyntax.leftParen: + return "leftParen" + case \TupleTypeSyntax.unexpectedBetweenLeftParenAndElements: + return "unexpectedBetweenLeftParenAndElements" + case \TupleTypeSyntax.elements: + return "elements" + case \TupleTypeSyntax.unexpectedBetweenElementsAndRightParen: + return "unexpectedBetweenElementsAndRightParen" + case \TupleTypeSyntax.rightParen: + return "rightParen" + case \TupleTypeSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \TypeAnnotationSyntax.unexpectedBeforeColon: + return "unexpectedBeforeColon" + case \TypeAnnotationSyntax.colon: + return "colon" + case \TypeAnnotationSyntax.unexpectedBetweenColonAndType: + return "unexpectedBetweenColonAndType" + case \TypeAnnotationSyntax.type: + return "type" + case \TypeAnnotationSyntax.unexpectedAfterType: + return "unexpectedAfterType" + case \TypeEffectSpecifiersSyntax.unexpectedBeforeAsyncSpecifier: + return "unexpectedBeforeAsyncSpecifier" + case \TypeEffectSpecifiersSyntax.asyncSpecifier: + return "asyncSpecifier" + case \TypeEffectSpecifiersSyntax.unexpectedBetweenAsyncSpecifierAndThrowsSpecifier: + return "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier" + case \TypeEffectSpecifiersSyntax.throwsSpecifier: + return "throwsSpecifier" + case \TypeEffectSpecifiersSyntax.unexpectedAfterThrowsSpecifier: + return "unexpectedAfterThrowsSpecifier" + case \TypeExprSyntax.unexpectedBeforeType: + return "unexpectedBeforeType" + case \TypeExprSyntax.type: + return "type" + case \TypeExprSyntax.unexpectedAfterType: + return "unexpectedAfterType" + case \TypeInheritanceClauseSyntax.unexpectedBeforeColon: + return "unexpectedBeforeColon" + case \TypeInheritanceClauseSyntax.colon: + return "colon" + case \TypeInheritanceClauseSyntax.unexpectedBetweenColonAndInheritedTypeCollection: + return "unexpectedBetweenColonAndInheritedTypeCollection" + case \TypeInheritanceClauseSyntax.inheritedTypeCollection: + return "inheritedTypeCollection" + case \TypeInheritanceClauseSyntax.unexpectedAfterInheritedTypeCollection: + return "unexpectedAfterInheritedTypeCollection" + case \TypeInitializerClauseSyntax.unexpectedBeforeEqual: + return "unexpectedBeforeEqual" + case \TypeInitializerClauseSyntax.equal: + return "equal" + case \TypeInitializerClauseSyntax.unexpectedBetweenEqualAndValue: + return "unexpectedBetweenEqualAndValue" + case \TypeInitializerClauseSyntax.value: + return "value" + case \TypeInitializerClauseSyntax.unexpectedAfterValue: + return "unexpectedAfterValue" + case \TypealiasDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \TypealiasDeclSyntax.attributes: + return "attributes" + case \TypealiasDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \TypealiasDeclSyntax.modifiers: + return "modifiers" + case \TypealiasDeclSyntax.unexpectedBetweenModifiersAndTypealiasKeyword: + return "unexpectedBetweenModifiersAndTypealiasKeyword" + case \TypealiasDeclSyntax.typealiasKeyword: + return "typealiasKeyword" + case \TypealiasDeclSyntax.unexpectedBetweenTypealiasKeywordAndIdentifier: + return "unexpectedBetweenTypealiasKeywordAndIdentifier" + case \TypealiasDeclSyntax.identifier: + return "identifier" + case \TypealiasDeclSyntax.unexpectedBetweenIdentifierAndGenericParameterClause: + return "unexpectedBetweenIdentifierAndGenericParameterClause" + case \TypealiasDeclSyntax.genericParameterClause: + return "genericParameterClause" + case \TypealiasDeclSyntax.unexpectedBetweenGenericParameterClauseAndInitializer: + return "unexpectedBetweenGenericParameterClauseAndInitializer" + case \TypealiasDeclSyntax.initializer: + return "initializer" + case \TypealiasDeclSyntax.unexpectedBetweenInitializerAndGenericWhereClause: + return "unexpectedBetweenInitializerAndGenericWhereClause" + case \TypealiasDeclSyntax.genericWhereClause: + return "genericWhereClause" + case \TypealiasDeclSyntax.unexpectedAfterGenericWhereClause: + return "unexpectedAfterGenericWhereClause" + case \UnavailableFromAsyncArgumentsSyntax.unexpectedBeforeMessageLabel: + return "unexpectedBeforeMessageLabel" + case \UnavailableFromAsyncArgumentsSyntax.messageLabel: + return "messageLabel" + case \UnavailableFromAsyncArgumentsSyntax.unexpectedBetweenMessageLabelAndColon: + return "unexpectedBetweenMessageLabelAndColon" + case \UnavailableFromAsyncArgumentsSyntax.colon: + return "colon" + case \UnavailableFromAsyncArgumentsSyntax.unexpectedBetweenColonAndMessage: + return "unexpectedBetweenColonAndMessage" + case \UnavailableFromAsyncArgumentsSyntax.message: + return "message" + case \UnavailableFromAsyncArgumentsSyntax.unexpectedAfterMessage: + return "unexpectedAfterMessage" + case \UnderscorePrivateAttributeArgumentsSyntax.unexpectedBeforeSourceFileLabel: + return "unexpectedBeforeSourceFileLabel" + case \UnderscorePrivateAttributeArgumentsSyntax.sourceFileLabel: + return "sourceFileLabel" + case \UnderscorePrivateAttributeArgumentsSyntax.unexpectedBetweenSourceFileLabelAndColon: + return "unexpectedBetweenSourceFileLabelAndColon" + case \UnderscorePrivateAttributeArgumentsSyntax.colon: + return "colon" + case \UnderscorePrivateAttributeArgumentsSyntax.unexpectedBetweenColonAndFilename: + return "unexpectedBetweenColonAndFilename" + case \UnderscorePrivateAttributeArgumentsSyntax.filename: + return "filename" + case \UnderscorePrivateAttributeArgumentsSyntax.unexpectedAfterFilename: + return "unexpectedAfterFilename" + case \UnresolvedAsExprSyntax.unexpectedBeforeAsTok: + return "unexpectedBeforeAsTok" + case \UnresolvedAsExprSyntax.asTok: + return "asTok" + case \UnresolvedAsExprSyntax.unexpectedBetweenAsTokAndQuestionOrExclamationMark: + return "unexpectedBetweenAsTokAndQuestionOrExclamationMark" + case \UnresolvedAsExprSyntax.questionOrExclamationMark: + return "questionOrExclamationMark" + case \UnresolvedAsExprSyntax.unexpectedAfterQuestionOrExclamationMark: + return "unexpectedAfterQuestionOrExclamationMark" + case \UnresolvedIsExprSyntax.unexpectedBeforeIsTok: + return "unexpectedBeforeIsTok" + case \UnresolvedIsExprSyntax.isTok: + return "isTok" + case \UnresolvedIsExprSyntax.unexpectedAfterIsTok: + return "unexpectedAfterIsTok" + case \UnresolvedPatternExprSyntax.unexpectedBeforePattern: + return "unexpectedBeforePattern" + case \UnresolvedPatternExprSyntax.pattern: + return "pattern" + case \UnresolvedPatternExprSyntax.unexpectedAfterPattern: + return "unexpectedAfterPattern" + case \UnresolvedTernaryExprSyntax.unexpectedBeforeQuestionMark: + return "unexpectedBeforeQuestionMark" + case \UnresolvedTernaryExprSyntax.questionMark: + return "questionMark" + case \UnresolvedTernaryExprSyntax.unexpectedBetweenQuestionMarkAndFirstChoice: + return "unexpectedBetweenQuestionMarkAndFirstChoice" + case \UnresolvedTernaryExprSyntax.firstChoice: + return "firstChoice" + case \UnresolvedTernaryExprSyntax.unexpectedBetweenFirstChoiceAndColonMark: + return "unexpectedBetweenFirstChoiceAndColonMark" + case \UnresolvedTernaryExprSyntax.colonMark: + return "colonMark" + case \UnresolvedTernaryExprSyntax.unexpectedAfterColonMark: + return "unexpectedAfterColonMark" + case \ValueBindingPatternSyntax.unexpectedBeforeBindingKeyword: + return "unexpectedBeforeBindingKeyword" + case \ValueBindingPatternSyntax.bindingKeyword: + return "bindingKeyword" + case \ValueBindingPatternSyntax.unexpectedBetweenBindingKeywordAndValuePattern: + return "unexpectedBetweenBindingKeywordAndValuePattern" + case \ValueBindingPatternSyntax.valuePattern: + return "valuePattern" + case \ValueBindingPatternSyntax.unexpectedAfterValuePattern: + return "unexpectedAfterValuePattern" + case \VariableDeclSyntax.unexpectedBeforeAttributes: + return "unexpectedBeforeAttributes" + case \VariableDeclSyntax.attributes: + return "attributes" + case \VariableDeclSyntax.unexpectedBetweenAttributesAndModifiers: + return "unexpectedBetweenAttributesAndModifiers" + case \VariableDeclSyntax.modifiers: + return "modifiers" + case \VariableDeclSyntax.unexpectedBetweenModifiersAndBindingKeyword: + return "unexpectedBetweenModifiersAndBindingKeyword" + case \VariableDeclSyntax.bindingKeyword: + return "bindingKeyword" + case \VariableDeclSyntax.unexpectedBetweenBindingKeywordAndBindings: + return "unexpectedBetweenBindingKeywordAndBindings" + case \VariableDeclSyntax.bindings: + return "bindings" + case \VariableDeclSyntax.unexpectedAfterBindings: + return "unexpectedAfterBindings" + case \VersionTupleSyntax.unexpectedBeforeMajor: + return "unexpectedBeforeMajor" + case \VersionTupleSyntax.major: + return "major" + case \VersionTupleSyntax.unexpectedBetweenMajorAndMinorPeriod: + return "unexpectedBetweenMajorAndMinorPeriod" + case \VersionTupleSyntax.minorPeriod: + return "minorPeriod" + case \VersionTupleSyntax.unexpectedBetweenMinorPeriodAndMinor: + return "unexpectedBetweenMinorPeriodAndMinor" + case \VersionTupleSyntax.minor: + return "minor" + case \VersionTupleSyntax.unexpectedBetweenMinorAndPatchPeriod: + return "unexpectedBetweenMinorAndPatchPeriod" + case \VersionTupleSyntax.patchPeriod: + return "patchPeriod" + case \VersionTupleSyntax.unexpectedBetweenPatchPeriodAndPatch: + return "unexpectedBetweenPatchPeriodAndPatch" + case \VersionTupleSyntax.patch: + return "patch" + case \VersionTupleSyntax.unexpectedAfterPatch: + return "unexpectedAfterPatch" + case \WhereClauseSyntax.unexpectedBeforeWhereKeyword: + return "unexpectedBeforeWhereKeyword" + case \WhereClauseSyntax.whereKeyword: + return "whereKeyword" + case \WhereClauseSyntax.unexpectedBetweenWhereKeywordAndGuardResult: + return "unexpectedBetweenWhereKeywordAndGuardResult" + case \WhereClauseSyntax.guardResult: + return "guardResult" + case \WhereClauseSyntax.unexpectedAfterGuardResult: + return "unexpectedAfterGuardResult" + case \WhileStmtSyntax.unexpectedBeforeWhileKeyword: + return "unexpectedBeforeWhileKeyword" + case \WhileStmtSyntax.whileKeyword: + return "whileKeyword" + case \WhileStmtSyntax.unexpectedBetweenWhileKeywordAndConditions: + return "unexpectedBetweenWhileKeywordAndConditions" + case \WhileStmtSyntax.conditions: + return "conditions" + case \WhileStmtSyntax.unexpectedBetweenConditionsAndBody: + return "unexpectedBetweenConditionsAndBody" + case \WhileStmtSyntax.body: + return "body" + case \WhileStmtSyntax.unexpectedAfterBody: + return "unexpectedAfterBody" + case \WildcardPatternSyntax.unexpectedBeforeWildcard: + return "unexpectedBeforeWildcard" + case \WildcardPatternSyntax.wildcard: + return "wildcard" + case \WildcardPatternSyntax.unexpectedBetweenWildcardAndTypeAnnotation: + return "unexpectedBetweenWildcardAndTypeAnnotation" + case \WildcardPatternSyntax.typeAnnotation: + return "typeAnnotation" + case \WildcardPatternSyntax.unexpectedAfterTypeAnnotation: + return "unexpectedAfterTypeAnnotation" + case \YieldExprListElementSyntax.unexpectedBeforeExpression: + return "unexpectedBeforeExpression" + case \YieldExprListElementSyntax.expression: + return "expression" + case \YieldExprListElementSyntax.unexpectedBetweenExpressionAndComma: + return "unexpectedBetweenExpressionAndComma" + case \YieldExprListElementSyntax.comma: + return "comma" + case \YieldExprListElementSyntax.unexpectedAfterComma: + return "unexpectedAfterComma" + case \YieldListSyntax.unexpectedBeforeLeftParen: + return "unexpectedBeforeLeftParen" + case \YieldListSyntax.leftParen: + return "leftParen" + case \YieldListSyntax.unexpectedBetweenLeftParenAndElementList: + return "unexpectedBetweenLeftParenAndElementList" + case \YieldListSyntax.elementList: + return "elementList" + case \YieldListSyntax.unexpectedBetweenElementListAndRightParen: + return "unexpectedBetweenElementListAndRightParen" + case \YieldListSyntax.rightParen: + return "rightParen" + case \YieldListSyntax.unexpectedAfterRightParen: + return "unexpectedAfterRightParen" + case \YieldStmtSyntax.unexpectedBeforeYieldKeyword: + return "unexpectedBeforeYieldKeyword" + case \YieldStmtSyntax.yieldKeyword: + return "yieldKeyword" + case \YieldStmtSyntax.unexpectedBetweenYieldKeywordAndYields: + return "unexpectedBetweenYieldKeywordAndYields" + case \YieldStmtSyntax.yields: + return "yields" + case \YieldStmtSyntax.unexpectedAfterYields: + return "unexpectedAfterYields" + default: + return nil + } +} diff --git a/Tests/SwiftSyntaxTest/CustomReflectableTests.swift b/Tests/SwiftSyntaxTest/DebugDescriptionTests.swift similarity index 86% rename from Tests/SwiftSyntaxTest/CustomReflectableTests.swift rename to Tests/SwiftSyntaxTest/DebugDescriptionTests.swift index 660ea06d923..7a83ab142c4 100644 --- a/Tests/SwiftSyntaxTest/CustomReflectableTests.swift +++ b/Tests/SwiftSyntaxTest/DebugDescriptionTests.swift @@ -21,8 +21,7 @@ private extension String { } } -public class CustomReflectableTests: XCTestCase { - +public class DebugDescriptionTests: XCTestCase { public func testDump() { struct TestCase { let syntax: Any @@ -120,12 +119,12 @@ public class CustomReflectableTests: XCTestCase { syntax: tuples, expectedDumped: """ - TupleExprElementListSyntax - ├─TupleExprElementSyntax - │ ╰─IntegerLiteralExprSyntax - │ ╰─integerLiteral("1") - ╰─TupleExprElementSyntax - ╰─IntegerLiteralExprSyntax - ╰─integerLiteral("2") + ├─[0]: TupleExprElementSyntax + │ ╰─expression: IntegerLiteralExprSyntax + │ ╰─digits: integerLiteral("1") + ╰─[1]: TupleExprElementSyntax + ╰─expression: IntegerLiteralExprSyntax + ╰─digits: integerLiteral("2") """ ) @@ -145,12 +144,12 @@ public class CustomReflectableTests: XCTestCase { expectedDumped: """ ▿ Swift.ReversedCollection - _base: TupleExprElementListSyntax - ├─TupleExprElementSyntax - │ ╰─IntegerLiteralExprSyntax - │ ╰─integerLiteral("1") - ╰─TupleExprElementSyntax - ╰─IntegerLiteralExprSyntax - ╰─integerLiteral("2") + ├─[0]: TupleExprElementSyntax + │ ╰─expression: IntegerLiteralExprSyntax + │ ╰─digits: integerLiteral("1") + ╰─[1]: TupleExprElementSyntax + ╰─expression: IntegerLiteralExprSyntax + ╰─digits: integerLiteral("2") """ ) @@ -160,7 +159,11 @@ public class CustomReflectableTests: XCTestCase { testCases.forEach { keyAndValue in let (key:line, value:testCase) = keyAndValue let actualDumped = dumped(testCase.syntax) - XCTAssertEqual(testCase.expectedDumped.trimmingTrailingWhitespace(), actualDumped.trimmingTrailingWhitespace(), line: line) + assertStringsEqualWithDiff( + actualDumped.trimmingTrailingWhitespace(), + testCase.expectedDumped.trimmingTrailingWhitespace(), + line: line + ) } } diff --git a/utils/group.json b/utils/group.json index 7a989792a9b..8873f1dec56 100644 --- a/utils/group.json +++ b/utils/group.json @@ -8,6 +8,7 @@ "RawSyntaxValidation.swift", ], "Syntax": [ + "ChildNameForKeyPath.swift", "Keyword.swift", "SyntaxChildren.swift", "SyntaxData.swift", From 73f754acb694f7de61d6143291068f018bb711b1 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Sat, 15 Apr 2023 13:10:08 -0700 Subject: [PATCH 19/22] Merge pull request #1552 from ahoppen/ahoppen/regen Re-generate code-generated files --- Sources/SwiftParser/Modifiers.swift | 4 +- .../generated/ChildNameForKeyPath.swift | 72 +++++++++---------- .../generated/raw/RawSyntaxValidation.swift | 2 +- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Sources/SwiftParser/Modifiers.swift b/Sources/SwiftParser/Modifiers.swift index 27e13862a72..e9de8fb27a6 100644 --- a/Sources/SwiftParser/Modifiers.swift +++ b/Sources/SwiftParser/Modifiers.swift @@ -199,11 +199,11 @@ extension Parser { let unexpectedBeforeDetail: RawUnexpectedNodesSyntax? let detail: RawTokenSyntax - if let setHandle = canRecoverTo(TokenSpec(.set, recoveryPrecedence: .weakBracketClose)) { + if let setHandle = canRecoverTo(TokenSpec(.set, remapping: .identifier, recoveryPrecedence: .weakBracketClose)) { (unexpectedBeforeDetail, detail) = eat(setHandle) } else { unexpectedBeforeDetail = nil - detail = missingToken(.set) + detail = missingToken(.identifier, text: "set") } let (unexpectedBeforeRightParen, rightParen) = expect(.rightParen) diff --git a/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift b/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift index 18cb0682971..53d80138d05 100644 --- a/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift +++ b/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift @@ -118,12 +118,12 @@ internal func childName(_ keyPath: AnyKeyPath) -> String? { return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" case \ActorDeclSyntax.genericWhereClause: return "genericWhereClause" - case \ActorDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: - return "unexpectedBetweenGenericWhereClauseAndMembers" - case \ActorDeclSyntax.members: - return "members" - case \ActorDeclSyntax.unexpectedAfterMembers: - return "unexpectedAfterMembers" + case \ActorDeclSyntax.unexpectedBetweenGenericWhereClauseAndMemberBlock: + return "unexpectedBetweenGenericWhereClauseAndMemberBlock" + case \ActorDeclSyntax.memberBlock: + return "memberBlock" + case \ActorDeclSyntax.unexpectedAfterMemberBlock: + return "unexpectedAfterMemberBlock" case \ArrayElementSyntax.unexpectedBeforeExpression: return "unexpectedBeforeExpression" case \ArrayElementSyntax.expression: @@ -468,12 +468,12 @@ internal func childName(_ keyPath: AnyKeyPath) -> String? { return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" case \ClassDeclSyntax.genericWhereClause: return "genericWhereClause" - case \ClassDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: - return "unexpectedBetweenGenericWhereClauseAndMembers" - case \ClassDeclSyntax.members: - return "members" - case \ClassDeclSyntax.unexpectedAfterMembers: - return "unexpectedAfterMembers" + case \ClassDeclSyntax.unexpectedBetweenGenericWhereClauseAndMemberBlock: + return "unexpectedBetweenGenericWhereClauseAndMemberBlock" + case \ClassDeclSyntax.memberBlock: + return "memberBlock" + case \ClassDeclSyntax.unexpectedAfterMemberBlock: + return "unexpectedAfterMemberBlock" case \ClassRestrictionTypeSyntax.unexpectedBeforeClassKeyword: return "unexpectedBeforeClassKeyword" case \ClassRestrictionTypeSyntax.classKeyword: @@ -1168,12 +1168,12 @@ internal func childName(_ keyPath: AnyKeyPath) -> String? { return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" case \EnumDeclSyntax.genericWhereClause: return "genericWhereClause" - case \EnumDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: - return "unexpectedBetweenGenericWhereClauseAndMembers" - case \EnumDeclSyntax.members: - return "members" - case \EnumDeclSyntax.unexpectedAfterMembers: - return "unexpectedAfterMembers" + case \EnumDeclSyntax.unexpectedBetweenGenericWhereClauseAndMemberBlock: + return "unexpectedBetweenGenericWhereClauseAndMemberBlock" + case \EnumDeclSyntax.memberBlock: + return "memberBlock" + case \EnumDeclSyntax.unexpectedAfterMemberBlock: + return "unexpectedAfterMemberBlock" case \ExposeAttributeArgumentsSyntax.unexpectedBeforeLanguage: return "unexpectedBeforeLanguage" case \ExposeAttributeArgumentsSyntax.language: @@ -1246,12 +1246,12 @@ internal func childName(_ keyPath: AnyKeyPath) -> String? { return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" case \ExtensionDeclSyntax.genericWhereClause: return "genericWhereClause" - case \ExtensionDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: - return "unexpectedBetweenGenericWhereClauseAndMembers" - case \ExtensionDeclSyntax.members: - return "members" - case \ExtensionDeclSyntax.unexpectedAfterMembers: - return "unexpectedAfterMembers" + case \ExtensionDeclSyntax.unexpectedBetweenGenericWhereClauseAndMemberBlock: + return "unexpectedBetweenGenericWhereClauseAndMemberBlock" + case \ExtensionDeclSyntax.memberBlock: + return "memberBlock" + case \ExtensionDeclSyntax.unexpectedAfterMemberBlock: + return "unexpectedAfterMemberBlock" case \FallthroughStmtSyntax.unexpectedBeforeFallthroughKeyword: return "unexpectedBeforeFallthroughKeyword" case \FallthroughStmtSyntax.fallthroughKeyword: @@ -2586,12 +2586,12 @@ internal func childName(_ keyPath: AnyKeyPath) -> String? { return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" case \ProtocolDeclSyntax.genericWhereClause: return "genericWhereClause" - case \ProtocolDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: - return "unexpectedBetweenGenericWhereClauseAndMembers" - case \ProtocolDeclSyntax.members: - return "members" - case \ProtocolDeclSyntax.unexpectedAfterMembers: - return "unexpectedAfterMembers" + case \ProtocolDeclSyntax.unexpectedBetweenGenericWhereClauseAndMemberBlock: + return "unexpectedBetweenGenericWhereClauseAndMemberBlock" + case \ProtocolDeclSyntax.memberBlock: + return "memberBlock" + case \ProtocolDeclSyntax.unexpectedAfterMemberBlock: + return "unexpectedAfterMemberBlock" case \QualifiedDeclNameSyntax.unexpectedBeforeBaseType: return "unexpectedBeforeBaseType" case \QualifiedDeclNameSyntax.baseType: @@ -2776,12 +2776,12 @@ internal func childName(_ keyPath: AnyKeyPath) -> String? { return "unexpectedBetweenInheritanceClauseAndGenericWhereClause" case \StructDeclSyntax.genericWhereClause: return "genericWhereClause" - case \StructDeclSyntax.unexpectedBetweenGenericWhereClauseAndMembers: - return "unexpectedBetweenGenericWhereClauseAndMembers" - case \StructDeclSyntax.members: - return "members" - case \StructDeclSyntax.unexpectedAfterMembers: - return "unexpectedAfterMembers" + case \StructDeclSyntax.unexpectedBetweenGenericWhereClauseAndMemberBlock: + return "unexpectedBetweenGenericWhereClauseAndMemberBlock" + case \StructDeclSyntax.memberBlock: + return "memberBlock" + case \StructDeclSyntax.unexpectedAfterMemberBlock: + return "unexpectedAfterMemberBlock" case \SubscriptDeclSyntax.unexpectedBeforeAttributes: return "unexpectedBeforeAttributes" case \SubscriptDeclSyntax.attributes: diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index 2239903f941..821ffb2db6d 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -799,7 +799,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.leftParen)])) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.identifier), .keyword("set")])) + assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.identifier)])) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.rightParen)])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) From 23c09ed98d5143183ed10c2bc76759c5881b9b72 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Sat, 15 Apr 2023 19:05:46 -0700 Subject: [PATCH 20/22] Merge pull request #1340 from ahoppen/ahoppen/source-alteration Enable a mode in the parser in which it inspects alternative token choices to mutate test cases --- Package.swift | 14 ++- .../SwiftParser/Lexer/LexemeSequence.swift | 14 +++ Sources/SwiftParser/Lookahead.swift | 6 + Sources/SwiftParser/Parser.swift | 28 +++++ Sources/SwiftParser/Recovery.swift | 10 ++ Sources/SwiftParser/TokenConsumer.swift | 38 +++++- Sources/SwiftParser/TokenSpec.swift | 26 +++- Tests/SwiftParserTest/Assertions.swift | 111 ++++++++++++------ Tests/SwiftParserTest/Parser+EntryTests.swift | 20 ++-- build-script.py | 46 ++++++-- 10 files changed, 258 insertions(+), 55 deletions(-) diff --git a/Package.swift b/Package.swift index a1570007ae7..c4d895fb947 100644 --- a/Package.swift +++ b/Package.swift @@ -28,6 +28,13 @@ if ProcessInfo.processInfo.environment["SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION" ] } +var swiftParserSwiftSettings: [SwiftSetting] = [] +if ProcessInfo.processInfo.environment["SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION"] != nil { + swiftParserSwiftSettings += [ + .define("SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION") + ] +} + let package = Package( name: "SwiftSyntax", platforms: [ @@ -170,12 +177,15 @@ let package = Package( .target( name: "SwiftParser", dependencies: ["SwiftSyntax"], - exclude: ["CMakeLists.txt", "README.md"] + exclude: ["CMakeLists.txt", "README.md"], + swiftSettings: swiftParserSwiftSettings + ), .testTarget( name: "SwiftParserTest", - dependencies: ["_SwiftSyntaxTestSupport", "SwiftDiagnostics", "SwiftOperators", "SwiftParser", "SwiftSyntaxBuilder"] + dependencies: ["_SwiftSyntaxTestSupport", "SwiftDiagnostics", "SwiftOperators", "SwiftParser", "SwiftSyntaxBuilder"], + swiftSettings: swiftParserSwiftSettings ), // MARK: SwiftParserDiagnostics diff --git a/Sources/SwiftParser/Lexer/LexemeSequence.swift b/Sources/SwiftParser/Lexer/LexemeSequence.swift index 266cbe4db9c..1c961853a77 100644 --- a/Sources/SwiftParser/Lexer/LexemeSequence.swift +++ b/Sources/SwiftParser/Lexer/LexemeSequence.swift @@ -81,6 +81,20 @@ extension Lexer { return remainingText } } + + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + /// If `pointer` is in the source buffer of this `LexemeSequence`, return + /// its offset, otherwise `nil`. Should only be used for the parser's + /// alternate token introspection + func offset(of pointer: UnsafePointer) -> Int? { + let offset = pointer - self.sourceBufferStart.input.baseAddress! + if offset <= self.sourceBufferStart.input.count { + return offset + } else { + return nil + } + } + #endif } @_spi(RawSyntax) diff --git a/Sources/SwiftParser/Lookahead.swift b/Sources/SwiftParser/Lookahead.swift index 94d687afe1f..94a8f8d5b62 100644 --- a/Sources/SwiftParser/Lookahead.swift +++ b/Sources/SwiftParser/Lookahead.swift @@ -70,6 +70,12 @@ extension Parser.Lookahead: TokenConsumer { mutating func eat(_ spec: TokenSpec) -> Token { return self.consume(if: spec)! } + + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + var shouldRecordAlternativeTokenChoices: Bool { false } + + mutating public func recordAlternativeTokenChoice(for lexeme: Lexer.Lexeme, choices: [TokenSpec]) {} + #endif } extension Parser.Lookahead { diff --git a/Sources/SwiftParser/Parser.swift b/Sources/SwiftParser/Parser.swift index c692c6dbe98..dc743d7af70 100644 --- a/Sources/SwiftParser/Parser.swift +++ b/Sources/SwiftParser/Parser.swift @@ -207,6 +207,34 @@ public struct Parser { break } } + + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + var shouldRecordAlternativeTokenChoices: Bool = false + + public mutating func enableAlternativeTokenChoices() { + shouldRecordAlternativeTokenChoices = true + } + + /// When compiled with `SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION`, and + /// `shouldRecordAlternativeTokenChoices` is `true` the parser records which + /// `TokenSpec`s it checked for a token at a specific offset in the source + /// file. The offsets are the location of the token text's start (excluding + /// leading trivia). + /// + /// This information allows testing techniques to replace tokens by these + /// alternate token choices to generate new, interesting test cases + @_spi(RawSyntax) + public var alternativeTokenChoices: [Int: [TokenSpec]] = [:] + + mutating func recordAlternativeTokenChoice(for lexeme: Lexer.Lexeme, choices: [TokenSpec]) { + guard let lexemeBaseAddress = lexeme.tokenText.baseAddress, + let offset = lexemes.offset(of: lexemeBaseAddress) + else { + return + } + alternativeTokenChoices[offset, default: []].append(contentsOf: choices) + } + #endif } // MARK: Inspecting Tokens diff --git a/Sources/SwiftParser/Recovery.swift b/Sources/SwiftParser/Recovery.swift index c999fddf636..08ee33bf046 100644 --- a/Sources/SwiftParser/Recovery.swift +++ b/Sources/SwiftParser/Recovery.swift @@ -67,6 +67,11 @@ extension Parser.Lookahead { _ spec2: TokenSpec, _ spec3: TokenSpec ) -> RecoveryConsumptionHandle? { + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + if shouldRecordAlternativeTokenChoices { + recordAlternativeTokenChoice(for: self.currentToken, choices: [spec1, spec2, spec3]) + } + #endif let initialTokensConsumed = self.tokensConsumed let recoveryPrecedence = min(spec1.recoveryPrecedence, spec2.recoveryPrecedence, spec3.recoveryPrecedence) @@ -119,6 +124,11 @@ extension Parser.Lookahead { anyIn specSet: SpecSet.Type, overrideRecoveryPrecedence: TokenPrecedence? = nil ) -> (match: SpecSet, handle: RecoveryConsumptionHandle)? { + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + if shouldRecordAlternativeTokenChoices { + recordAlternativeTokenChoice(for: self.currentToken, choices: specSet.allCases.map(\.spec)) + } + #endif let initialTokensConsumed = self.tokensConsumed precondition(!specSet.allCases.isEmpty, "SpecSet must have at least one case") diff --git a/Sources/SwiftParser/TokenConsumer.swift b/Sources/SwiftParser/TokenConsumer.swift index 824675c11e4..b7c8bb5d2a6 100644 --- a/Sources/SwiftParser/TokenConsumer.swift +++ b/Sources/SwiftParser/TokenConsumer.swift @@ -13,8 +13,7 @@ @_spi(RawSyntax) import SwiftSyntax /// A type that consumes instances of `TokenSyntax`. -@_spi(RawSyntax) -public protocol TokenConsumer { +protocol TokenConsumer { associatedtype Token /// The current token syntax being examined by the consumer var currentToken: Lexer.Lexeme { get } @@ -32,6 +31,21 @@ public protocol TokenConsumer { func peek() -> Lexer.Lexeme func lookahead() -> Parser.Lookahead + + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + var shouldRecordAlternativeTokenChoices: Bool { get } + + /// When compiled with `SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION`, + /// record alternative tokens that the parser was looking for at the offset of + /// `lexeme`. + /// + /// E.g. if at offset 33, we issue an `at(.leftParen)` call, this will record + /// that `.leftParen` is an interesting token at offset 33. This allows the + /// test case mutators to prefer replacing the current token at offset 33 by a + /// left paren, because apparently this would be a code path that the parser + /// is interested in. + mutating func recordAlternativeTokenChoice(for lexeme: Lexer.Lexeme, choices: [TokenSpec]) + #endif } // MARK: Checking if we are at one specific token (`at`) @@ -51,6 +65,11 @@ extension TokenConsumer { /// Returns whether the the current token matches `spec` @inline(__always) mutating func at(_ spec: TokenSpec) -> Bool { + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + if shouldRecordAlternativeTokenChoices { + recordAlternativeTokenChoice(for: self.currentToken, choices: [spec]) + } + #endif return spec ~= self.currentToken } @@ -60,6 +79,11 @@ extension TokenConsumer { _ spec1: TokenSpec, _ spec2: TokenSpec ) -> Bool { + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + if shouldRecordAlternativeTokenChoices { + recordAlternativeTokenChoice(for: self.currentToken, choices: [spec1, spec2]) + } + #endif switch self.currentToken { case spec1: return true case spec2: return true @@ -74,6 +98,11 @@ extension TokenConsumer { _ spec2: TokenSpec, _ spec3: TokenSpec ) -> Bool { + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + if shouldRecordAlternativeTokenChoices { + recordAlternativeTokenChoice(for: self.currentToken, choices: [spec1, spec2, spec3]) + } + #endif switch self.currentToken { case spec1: return true case spec2: return true @@ -93,6 +122,11 @@ extension TokenConsumer { /// as well as a handle to consume that token. @inline(__always) mutating func at(anyIn specSet: SpecSet.Type) -> (SpecSet, TokenConsumptionHandle)? { + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + if shouldRecordAlternativeTokenChoices { + recordAlternativeTokenChoice(for: self.currentToken, choices: specSet.allCases.map(\.spec)) + } + #endif if let matchedKind = SpecSet(lexeme: self.currentToken) { precondition(matchedKind.spec ~= self.currentToken) return ( diff --git a/Sources/SwiftParser/TokenSpec.swift b/Sources/SwiftParser/TokenSpec.swift index 642a92daa1d..79f76a8b619 100644 --- a/Sources/SwiftParser/TokenSpec.swift +++ b/Sources/SwiftParser/TokenSpec.swift @@ -44,7 +44,8 @@ struct PrepareForKeywordMatch { /// marked `@inline(__always)` so the compiler inlines the `RawTokenKind` we are /// matching against and is thus able to rule out one of the branches in /// `matches(rawTokenKind:text:)` based on the matched kind. -struct TokenSpec { +@_spi(RawSyntax) +public struct TokenSpec { /// The kind we expect the token that we want to consume to have. /// This can be a keyword, in which case the `TokenSpec` will also match an /// identifier with the same text as the keyword and remap it to that keyword @@ -160,6 +161,29 @@ struct TokenSpec { atStartOfLine: lexeme.isAtStartOfLine ) } + + /// Returns a `TokenKind` that will most likely be parsed as a token that + /// matches this `TokenSpec`. + /// + /// IMPORTANT: Should only be used when generating tokens during the + /// modification of test cases. This should never be used in the parser itself. + public var synthesizedTokenKind: TokenKind { + switch rawTokenKind { + case .binaryOperator: return .binaryOperator("+") + case .dollarIdentifier: return .dollarIdentifier("$0") + case .extendedRegexDelimiter: return .extendedRegexDelimiter("#") + case .floatingLiteral: return .floatingLiteral("1.0") + case .identifier: return .identifier("myIdent") + case .integerLiteral: return .integerLiteral("1") + case .keyword: return .keyword(keyword!) + case .postfixOperator: return .postfixOperator("++") + case .prefixOperator: return .prefixOperator("!") + case .rawStringDelimiter: return .rawStringDelimiter("#") + case .regexLiteralPattern: return .regexLiteralPattern(".*") + case .stringSegment: return .stringSegment("abc") + default: return TokenKind.fromRaw(kind: rawTokenKind, text: "") + } + } } extension TokenConsumer { diff --git a/Tests/SwiftParserTest/Assertions.swift b/Tests/SwiftParserTest/Assertions.swift index 8ea8c54558a..3eadf00c5e0 100644 --- a/Tests/SwiftParserTest/Assertions.swift +++ b/Tests/SwiftParserTest/Assertions.swift @@ -446,6 +446,39 @@ func assertDiagnostic( } } +class MutatedTreePrinter: SyntaxVisitor { + private var mutations: [Int: TokenSpec] = [:] + private var printedSource: [UInt8] = [] + + /// Prints `tree` by replacing the tokens whose offset is in `mutations` by + /// a token that matches the corresponding `TokenSpec`. + static func print(tree: Syntax, mutations: [Int: TokenSpec]) -> [UInt8] { + let printer = MutatedTreePrinter(mutations: mutations) + printer.walk(tree) + return printer.printedSource + } + + private init(mutations: [Int: TokenSpec]) { + self.mutations = mutations + super.init(viewMode: .sourceAccurate) + } + + override func visit(_ node: TokenSyntax) -> SyntaxVisitorContinueKind { + if let mutation = mutations[node.positionAfterSkippingLeadingTrivia.utf8Offset] { + let token = TokenSyntax( + mutation.synthesizedTokenKind, + leadingTrivia: node.leadingTrivia, + trailingTrivia: node.trailingTrivia, + presence: .present + ) + printedSource.append(contentsOf: token.syntaxTextBytes) + return .skipChildren + } + printedSource.append(contentsOf: node.syntaxTextBytes) + return .skipChildren + } +} + public struct AssertParseOptions: OptionSet { public var rawValue: UInt8 @@ -489,38 +522,6 @@ func assertParse( ) } -/// Same as `assertParse` overload with a `(String) -> S` `parse`, -/// constructing a `Parser` from the given `String` and passing that to -/// `parse` instead. -func assertParse( - _ markedSource: String, - _ parse: (inout Parser) -> S, - substructure expectedSubstructure: Syntax? = nil, - substructureAfterMarker: String = "START", - diagnostics expectedDiagnostics: [DiagnosticSpec] = [], - applyFixIts: [String]? = nil, - fixedSource expectedFixedSource: String? = nil, - options: AssertParseOptions = [], - file: StaticString = #file, - line: UInt = #line -) { - assertParse( - markedSource, - { (source: String) -> S in - var parser = Parser(source) - return parse(&parser) - }, - substructure: expectedSubstructure, - substructureAfterMarker: substructureAfterMarker, - diagnostics: expectedDiagnostics, - applyFixIts: applyFixIts, - fixedSource: expectedFixedSource, - options: options, - file: file, - line: line - ) -} - /// Removes any test markers from `markedSource` (1) and parses the result /// using `parse`. By default it only checks if the parsed syntax tree is /// printable back to the origin source, ie. it round trips. @@ -541,7 +542,7 @@ func assertParse( /// this string. func assertParse( _ markedSource: String, - _ parse: (String) -> S, + _ parse: (inout Parser) -> S, substructure expectedSubstructure: Syntax? = nil, substructureAfterMarker: String = "START", diagnostics expectedDiagnostics: [DiagnosticSpec] = [], @@ -555,7 +556,15 @@ func assertParse( var (markerLocations, source) = extractMarkers(markedSource) markerLocations["START"] = 0 - let tree: S = parse(source) + var parser = Parser(source) + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + let enableTestCaseMutation = ProcessInfo.processInfo.environment["SKIP_LONG_TESTS"] != "1" + + if enableTestCaseMutation { + parser.enableAlternativeTokenChoices() + } + #endif + let tree: S = parse(&parser) // Round-trip assertStringsEqualWithDiff( @@ -615,4 +624,38 @@ func assertParse( line: line ) } + + #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION + if enableTestCaseMutation { + let mutations: [(offset: Int, replacement: TokenSpec)] = parser.alternativeTokenChoices.flatMap { offset, replacements in + return replacements.map { (offset, $0) } + } + DispatchQueue.concurrentPerform(iterations: mutations.count) { index in + let mutation = mutations[index] + let alternateSource = MutatedTreePrinter.print(tree: Syntax(tree), mutations: [mutation.offset: mutation.replacement]) + alternateSource.withUnsafeBufferPointer { buf in + let mutatedSource = String(decoding: buf, as: UTF8.self) + // Check that we don't hit any assertions in the parser while parsing + // the mutated source and that it round-trips + var mutatedParser = Parser(buf) + let mutatedTree = parse(&mutatedParser) + assertStringsEqualWithDiff( + "\(mutatedTree)", + mutatedSource, + additionalInfo: """ + Mutated source failed to round-trip. + + Mutated source: + \(mutatedSource) + + Actual syntax tree: + \(mutatedTree.debugDescription) + """, + file: file, + line: line + ) + } + } + } + #endif } diff --git a/Tests/SwiftParserTest/Parser+EntryTests.swift b/Tests/SwiftParserTest/Parser+EntryTests.swift index 0fbceed5a61..72ed32ba42b 100644 --- a/Tests/SwiftParserTest/Parser+EntryTests.swift +++ b/Tests/SwiftParserTest/Parser+EntryTests.swift @@ -16,18 +16,20 @@ import XCTest public class EntryTests: XCTestCase { func testTopLevelStringParse() throws { - assertParse("func test() {}", { Parser.parse(source: $0) }) + let source = "func test() {}" + let tree = Parser.parse(source: source) + XCTAssert(tree.is(SourceFileSyntax.self)) + XCTAssert(!tree.hasError) + XCTAssertEqual(tree.description, source) } func testTopLevelBufferParse() throws { - assertParse( - "func test() {}", - { (source: String) -> SourceFileSyntax in - var source = source - source.makeContiguousUTF8() - return source.withUTF8 { Parser.parse(source: $0) } - } - ) + 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) } func testSyntaxParse() throws { diff --git a/build-script.py b/build-script.py index 7e8daa5549d..017311297e9 100755 --- a/build-script.py +++ b/build-script.py @@ -175,6 +175,7 @@ class Builder(object): multiroot_data_file: Optional[str] release: bool enable_rawsyntax_validation: bool + enable_test_fuzzing: bool disable_sandbox: bool def __init__( @@ -184,6 +185,7 @@ def __init__( multiroot_data_file: Optional[str], release: bool, enable_rawsyntax_validation: bool, + enable_test_fuzzing: bool, verbose: bool, disable_sandbox: bool = False, ) -> None: @@ -191,6 +193,7 @@ def __init__( self.multiroot_data_file = multiroot_data_file self.release = release self.enable_rawsyntax_validation = enable_rawsyntax_validation + self.enable_test_fuzzing = enable_test_fuzzing self.disable_sandbox = disable_sandbox self.verbose = verbose self.toolchain = toolchain @@ -226,6 +229,8 @@ def __build(self, package_dir: str, product_name: str) -> None: env["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] = "1" if self.enable_rawsyntax_validation: env["SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"] = "1" + if self.enable_test_fuzzing: + env["SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION"] = "1" # Tell other projects in the unified build to use local dependencies env["SWIFTCI_USE_LOCAL_DEPS"] = "1" env["SWIFT_SYNTAX_PARSER_LIB_SEARCH_PATH"] = \ @@ -278,9 +283,15 @@ def check_generated_files_match(self_generated_dir: str, def run_tests( - toolchain: str, build_dir: Optional[str], multiroot_data_file: Optional[str], - release: bool, enable_rawsyntax_validation: bool, filecheck_exec: Optional[str], - skip_lit_tests: bool, verbose: bool + toolchain: str, + build_dir: Optional[str], + multiroot_data_file: Optional[str], + release: bool, + enable_rawsyntax_validation: bool, + enable_test_fuzzing: bool, + filecheck_exec: Optional[str], + skip_lit_tests: bool, + verbose: bool ) -> None: print("** Running SwiftSyntax Tests **") @@ -299,6 +310,7 @@ def run_tests( multiroot_data_file=multiroot_data_file, release=release, enable_rawsyntax_validation=enable_rawsyntax_validation, + enable_test_fuzzing=enable_test_fuzzing, verbose=verbose, ) @@ -401,10 +413,15 @@ def run_lit_tests(toolchain: str, build_dir: Optional[str], release: bool, # XCTest Tests -def run_xctests(toolchain: str, build_dir: Optional[str], - multiroot_data_file: Optional[str], release: bool, - enable_rawsyntax_validation: bool, - verbose: bool) -> None: +def run_xctests( + toolchain: str, + build_dir: Optional[str], + multiroot_data_file: Optional[str], + release: bool, + enable_rawsyntax_validation: bool, + enable_test_fuzzing: bool, + verbose: bool +) -> None: print("** Running XCTests **") swiftpm_call = get_swiftpm_invocation( toolchain=toolchain, @@ -424,6 +441,8 @@ def run_xctests(toolchain: str, build_dir: Optional[str], env["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] = "1" if enable_rawsyntax_validation: env["SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"] = "1" + if enable_test_fuzzing: + env["SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION"] = "1" # Tell other projects in the unified build to use local dependencies env["SWIFTCI_USE_LOCAL_DEPS"] = "1" env["SWIFT_SYNTAX_PARSER_LIB_SEARCH_PATH"] = \ @@ -476,6 +495,7 @@ def build_command(args: argparse.Namespace) -> None: multiroot_data_file=args.multiroot_data_file, release=args.release, enable_rawsyntax_validation=args.enable_rawsyntax_validation, + enable_test_fuzzing=args.enable_test_fuzzing, verbose=args.verbose, disable_sandbox=args.disable_sandbox, ) @@ -500,6 +520,7 @@ def test_command(args: argparse.Namespace) -> None: multiroot_data_file=args.multiroot_data_file, release=args.release, enable_rawsyntax_validation=args.enable_rawsyntax_validation, + enable_test_fuzzing=args.enable_test_fuzzing, verbose=args.verbose, disable_sandbox=args.disable_sandbox, ) @@ -513,6 +534,7 @@ def test_command(args: argparse.Namespace) -> None: multiroot_data_file=args.multiroot_data_file, release=args.release, enable_rawsyntax_validation=args.enable_rawsyntax_validation, + enable_test_fuzzing=args.enable_test_fuzzing, filecheck_exec=realpath(args.filecheck_exec), skip_lit_tests=args.skip_lit_tests, verbose=args.verbose, @@ -575,6 +597,16 @@ def add_default_build_arguments(parser: argparse.ArgumentParser) -> None: """ ) + parser.add_argument( + "--enable-test-fuzzing", + action="store_true", + help=""" + For each `assertParse` test, perform mutations of the test case based on + alternate token choices that the parser checks, validating that there are + no round-trip or assertion failures. + """ + ) + parser.add_argument( "--toolchain", required=True, From a577f1902248f3c91d6a904d6fb60f617df4443e Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Mon, 17 Apr 2023 16:47:44 -0700 Subject: [PATCH 21/22] Merge pull request #1544 from ahoppen/ahoppen/remove-swiftsyntaxparser Remove SwiftSyntaxParser module --- BUILD.bazel | 8 - CONTRIBUTING.md | 8 +- Package.swift | 24 +- Sources/SwiftParser/README.md | 3 +- .../SwiftParser.docc/SwiftParser.md | 3 +- Sources/SwiftSyntaxParser/Diagnostic.swift | 310 ------------------ .../Documentation.docc/Index.md | 3 - Sources/SwiftSyntaxParser/SyntaxParser.swift | 132 -------- Sources/lit-test-helper/main.swift | 94 +----- .../ParsingPerformanceTests.swift | 14 +- .../SyntaxClassifierPerformanceTests.swift | 5 +- .../VisitorPerformanceTests.swift | 8 +- .../IncrementalParsingTests.swift | 10 +- Tests/SwiftParserTest/LexerTests.swift | 16 + .../Inputs/closure.swift | 3 - .../Inputs/diagnostics.swift | 11 - .../Inputs/near-empty.swift | 1 - .../Inputs/nested-blocks.swift | 8 - .../Inputs/visitor.swift | 7 - .../ParseFileTests.swift | 70 ---- Tests/SwiftSyntaxParserTest/SyntaxTests.swift | 186 ----------- .../SyntaxVisitorTests.swift | 138 -------- Tests/SwiftSyntaxParserTest/TokenTest.swift | 66 ---- .../AbsolutePositionTests.swift | 71 +--- Tests/SwiftSyntaxTest/SyntaxTests.swift | 77 +++++ .../SwiftSyntaxTest/SyntaxVisitorTests.swift | 240 ++++++++++++++ .../SyntaxComparisonTests.swift | 24 +- build-script.py | 1 - 28 files changed, 385 insertions(+), 1156 deletions(-) delete mode 100644 Sources/SwiftSyntaxParser/Diagnostic.swift delete mode 100644 Sources/SwiftSyntaxParser/Documentation.docc/Index.md delete mode 100644 Sources/SwiftSyntaxParser/SyntaxParser.swift rename Tests/{SwiftSyntaxParserTest => SwiftParserTest}/IncrementalParsingTests.swift (89%) delete mode 100644 Tests/SwiftSyntaxParserTest/Inputs/closure.swift delete mode 100644 Tests/SwiftSyntaxParserTest/Inputs/diagnostics.swift delete mode 100644 Tests/SwiftSyntaxParserTest/Inputs/near-empty.swift delete mode 100644 Tests/SwiftSyntaxParserTest/Inputs/nested-blocks.swift delete mode 100644 Tests/SwiftSyntaxParserTest/Inputs/visitor.swift delete mode 100644 Tests/SwiftSyntaxParserTest/ParseFileTests.swift delete mode 100644 Tests/SwiftSyntaxParserTest/SyntaxTests.swift delete mode 100644 Tests/SwiftSyntaxParserTest/SyntaxVisitorTests.swift delete mode 100644 Tests/SwiftSyntaxParserTest/TokenTest.swift rename Tests/{SwiftSyntaxParserTest => SwiftSyntaxTest}/AbsolutePositionTests.swift (77%) create mode 100644 Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift rename Tests/{SwiftSyntaxParserTest => SwiftSyntaxTestSupportTest}/SyntaxComparisonTests.swift (92%) diff --git a/BUILD.bazel b/BUILD.bazel index 279de9ba822..fad2dd3cd37 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -95,14 +95,6 @@ swift_syntax_library( ], ) -swift_syntax_library( - name = "SwiftSyntaxParser", - deps = [ - ":SwiftParser", - ":SwiftSyntax", - ], -) - swift_syntax_library( name = "SwiftRefactor", deps = [ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec61c1202f1..81cb3a5b7d3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,11 +43,7 @@ If you can’t find it in your Schemes, you need to manually add it using Produc ### XCTests -The `SwiftSyntaxParser` module (the legacy parser) of this repository depends on the C++ parser library (`_InternalSwiftSyntaxParser.dylib`) to parse source code. -The syntax node definitions of that parser library need to match those used by your SwiftSyntax checkout. -Most of the time, the parser library included in the latest Swift Development Snapshot will fulfill this requirement. - -To run the tests in Xcode, select the latest Swift Development Snapshot in Xcode -> Toolchains, select the SwiftSyntax-Package scheme and hit Product -> Test. +To run the tests in Xcode, select the SwiftSyntax-Package scheme and hit Product -> Test. You can also run the tests from the command line using ```bash @@ -68,7 +64,7 @@ Tip: Running SwiftSyntax’s self-parse tests takes the majority of testing time ### `lit`-based tests -A few tests of the `SwiftSyntaxParser` module (the legacy parser), which test the interaction between SwiftSyntax and the C++ parser library (`_InternalSwiftSyntaxParser.dylib`) are based LLVM’s `lit` and `FileCheck` tools. +A few tests are based LLVM’s `lit` and `FileCheck` tools. To run these, build `FileCheck`, e.g. by building the Swift compiler and run the tests using the following command: ```bash ./build-script.py test --toolchain /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-.xctoolchain/usr --skip-lit-tests --filecheck-exec /path/to/build/Release+Asserts/llvm-macosx-x86_64/bin/FileCheck diff --git a/Package.swift b/Package.swift index c4d895fb947..4ce71bb89f3 100644 --- a/Package.swift +++ b/Package.swift @@ -56,7 +56,6 @@ let package = Package( .library(name: "SwiftSyntax", type: .static, targets: ["SwiftSyntax"]), .library(name: "SwiftSyntaxBuilder", type: .static, targets: ["SwiftSyntaxBuilder"]), .library(name: "SwiftSyntaxMacros", type: .static, targets: ["SwiftSyntaxMacros"]), - .library(name: "SwiftSyntaxParser", type: .static, targets: ["SwiftSyntaxParser"]), ], targets: [ // MARK: - Internal helper targets @@ -70,6 +69,11 @@ let package = Package( dependencies: ["SwiftBasicFormat", "SwiftSyntax", "SwiftSyntaxBuilder"] ), + .testTarget( + name: "SwiftSyntaxTestSupportTest", + dependencies: ["_SwiftSyntaxTestSupport", "SwiftParser"] + ), + // MARK: - Library targets // Formatting style: // - One section for each target and its test target @@ -246,7 +250,7 @@ let package = Package( .executableTarget( name: "lit-test-helper", - dependencies: ["IDEUtils", "SwiftSyntax", "SwiftSyntaxParser"] + dependencies: ["IDEUtils", "SwiftSyntax", "SwiftParser"] ), // MARK: PerformanceTest @@ -254,21 +258,7 @@ let package = Package( .testTarget( name: "PerformanceTest", - dependencies: ["IDEUtils", "SwiftParser", "SwiftSyntax", "SwiftSyntaxParser"], - exclude: ["Inputs"] - ), - - // MARK: SwiftSyntaxParser - // TODO: All clients should use SwiftParser instead - - .target( - name: "SwiftSyntaxParser", - dependencies: ["SwiftSyntax", "SwiftParser"] - ), - - .testTarget( - name: "SwiftSyntaxParserTest", - dependencies: ["_SwiftSyntaxTestSupport", "SwiftSyntaxParser"], + dependencies: ["IDEUtils", "SwiftParser", "SwiftSyntax"], exclude: ["Inputs"] ), ] diff --git a/Sources/SwiftParser/README.md b/Sources/SwiftParser/README.md index c9fdfbb746a..2818fc65fdf 100644 --- a/Sources/SwiftParser/README.md +++ b/Sources/SwiftParser/README.md @@ -1,7 +1,6 @@ ## Overview -The `SwiftParser` framework implements a parser that accepts Swift source text -as input and produces a SwiftSyntax syntax tree. This module is under active development and is not yet ready to completely replace `SwiftSyntaxParser`. For more information about the design of this module, please see [the module documentation](SwiftParser.docc/SwiftParser.md). +The `SwiftParser` framework implements a parser that accepts Swift source text as input and produces a SwiftSyntax syntax tree. ## Quickstart diff --git a/Sources/SwiftParser/SwiftParser.docc/SwiftParser.md b/Sources/SwiftParser/SwiftParser.docc/SwiftParser.md index 2f837fcf5fc..0fd444a234e 100644 --- a/Sources/SwiftParser/SwiftParser.docc/SwiftParser.md +++ b/Sources/SwiftParser/SwiftParser.docc/SwiftParser.md @@ -4,8 +4,7 @@ A parser for the Swift programming language. ## Overview -The `SwiftParser` framework implements a parser that accepts Swift source text -as input and produces a SwiftSyntax syntax tree. This module is under active development and is not yet ready to completely replace `SwiftSyntaxParser`. +The `SwiftParser` framework implements a parser that accepts Swift source text as input and produces a SwiftSyntax syntax tree. ## Quickstart diff --git a/Sources/SwiftSyntaxParser/Diagnostic.swift b/Sources/SwiftSyntaxParser/Diagnostic.swift deleted file mode 100644 index f8abb3d685f..00000000000 --- a/Sources/SwiftSyntaxParser/Diagnostic.swift +++ /dev/null @@ -1,310 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// -// This file provides the Diagnostic, Note, and FixIt types. -//===----------------------------------------------------------------------===// - -import SwiftSyntax - -/// A FixIt represents a change to source code in order to "correct" a -/// diagnostic. -public enum FixIt: Codable, CustomDebugStringConvertible { - - /// Remove the characters from the source file over the provided source range. - case remove(SourceRange) - - /// Insert, at the provided source location, the provided string. - case insert(SourceLocation, String) - - /// Replace the characters at the provided source range with the provided - /// string. - case replace(SourceRange, String) - - enum CodingKeys: String, CodingKey { - case type - case range - case location - case string - } - - public var debugDescription: String { - return "Fixit: \(range.debugDescription) Text: \"\(text)\"" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - let type = try container.decode(String.self, forKey: .type) - switch type { - case "remove": - let range = try container.decode(SourceRange.self, forKey: .range) - self = .remove(range) - case "insert": - let string = try container.decode(String.self, forKey: .string) - let loc = try container.decode(SourceLocation.self, forKey: .location) - self = .insert(loc, string) - case "replace": - let string = try container.decode(String.self, forKey: .string) - let range = try container.decode(SourceRange.self, forKey: .range) - self = .replace(range, string) - default: - fatalError("unknown FixIt type \(type)") - } - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - switch self { - case let .remove(range): - try container.encode(range, forKey: .range) - case let .insert(location, string): - try container.encode(location, forKey: .location) - try container.encode(string, forKey: .string) - case let .replace(range, string): - try container.encode(range, forKey: .range) - try container.encode(string, forKey: .string) - } - } - - /// The source range associated with a FixIt. If this is an insertion, - /// it is a range with the same start and end location. - public var range: SourceRange { - switch self { - case .remove(let range), .replace(let range, _): return range - case .insert(let loc, _): return SourceRange(start: loc, end: loc) - } - } - - /// The text associated with this FixIt. If this is a removal, the text is - /// the empty string. - public var text: String { - switch self { - case .remove(_): return "" - case .insert(_, let text), .replace(_, let text): return text - } - } -} - -/// A Note attached to a Diagnostic. This provides more context for a specific -/// error, and optionally allows for FixIts. -public struct Note: Codable { - /// The note's message. - public let message: Diagnostic.Message - - /// The source location where the note should point. - public let location: SourceLocation? - - /// An array of source ranges that should be highlighted. - public let highlights: [SourceRange] - - /// An array of FixIts that apply to this note. - public let fixIts: [FixIt] - - /// Constructs a new Note from the constituent parts. - public init( - message: Diagnostic.Message, - location: SourceLocation?, - highlights: [SourceRange], - fixIts: [FixIt] - ) { - precondition( - message.severity == .note, - "notes can only have the `note` severity" - ) - self.message = message - self.location = location - self.highlights = highlights - self.fixIts = fixIts - } - - /// Converts this Note to a Diagnostic for serialization. - public func asDiagnostic() -> Diagnostic { - return Diagnostic( - message: message, - location: location, - notes: [], - highlights: highlights, - fixIts: fixIts - ) - } -} - -/// A Diagnostic message that can be emitted regarding some piece of code. -public struct Diagnostic: Codable, CustomDebugStringConvertible { - - public struct Message: Codable, CustomDebugStringConvertible { - - public var debugDescription: String { - return "\(severity): \(text)" - } - - /// The severity of diagnostic. This can be note, error, or warning. - public let severity: Severity - - /// A string containing the contents of the diagnostic. - public let text: String - - /// Creates a diagnostic message with the provided severity and text. - public init(_ severity: Severity, _ text: String) { - self.severity = severity - self.text = text - } - } - - // These values must match clang/Frontend/SerializedDiagnostics.h - /// The severity of the diagnostic. - public enum Severity: UInt8, Codable { - case note = 1 - case warning = 2 - case error = 3 - } - - /// The diagnostic's message. - public let message: Message - - /// The location the diagnostic should point. - public let location: SourceLocation? - - /// An array of notes providing more context for this diagnostic. - public let notes: [Note] - - /// An array of source ranges to highlight. - public let highlights: [SourceRange] - - /// An array of possible FixIts to apply to this diagnostic. - public let fixIts: [FixIt] - - public var debugDescription: String { - var lines: [String] = [] - let loc = location == nil ? "" : "\(location!) " - lines.append("\(loc)\(message.debugDescription)") - fixIts.forEach { lines.append("\($0.debugDescription)") } - highlights.forEach { lines.append("Highlight: \($0.debugDescription)") } - lines.append(contentsOf: notes.map({ loc + $0.asDiagnostic().debugDescription })) - return lines.joined(separator: "\n") - } - - /// A diagnostic builder that exposes mutating operations for notes, - /// highlights, and FixIts. When a Diagnostic is created, a builder - /// will be provided in a closure where the user can conditionally - /// add notes, highlights, and FixIts, that will then be wrapped - /// into the immutable Diagnostic object. - public struct Builder { - /// An in-flight array of notes. - internal var notes = [Note]() - - /// An in-flight array of highlighted source ranges. - internal var highlights = [SourceRange]() - - /// An in-flight array of FixIts. - internal var fixIts = [FixIt]() - - internal init() {} - - /// Adds a Note to the diagnostic builder. - /// - parameters: - /// - message: The message associated with the note. This must have the - /// `.note` severity. - /// - location: The source location to which this note is attached. - /// - highlights: Any source ranges that should be highlighted by this - /// note. - /// - fixIts: Any FixIts that should be attached to this note. - public mutating func note( - _ message: Message, - location: SourceLocation? = nil, - highlights: [SourceRange] = [], - fixIts: [FixIt] = [] - ) { - self.notes.append( - Note( - message: message, - location: location, - highlights: highlights, - fixIts: fixIts - ) - ) - } - - /// Adds the provided source ranges as highlights of this diagnostic. - public mutating func highlight(_ ranges: SourceRange...) { - self.highlights += ranges - } - - /// Adds a FixIt to remove the contents of the provided SourceRange. - /// When applied, this FixIt will delete the characters corresponding to - /// this range in the original source file. - public mutating func fixItRemove(_ sourceRange: SourceRange) { - fixIts.append(.remove(sourceRange)) - } - - /// Adds a FixIt to insert the provided text at the provided SourceLocation - /// in the file where the location resides. - public mutating - func fixItInsert(_ text: String, at sourceLocation: SourceLocation) - { - fixIts.append(.insert(sourceLocation, text)) - } - - /// Adds a FixIt to replace the contents of the source file corresponding - /// to the provided SourceRange with the provided text. - public mutating - func fixItReplace(_ sourceRange: SourceRange, with text: String) - { - fixIts.append(.replace(sourceRange, text)) - } - } - - /// Creates a new Diagnostic with the provided message, pointing to the - /// provided location (if any). - /// This initializer also takes a closure that will be passed a Diagnostic - /// Builder as an inout parameter. Use this closure to add notes, highlights, - /// and FixIts to the diagnostic through the Builder's API. - /// - parameters: - /// - message: The diagnostic's message. - /// - location: The location the diagnostic is attached to. - /// - actions: A closure that's used to attach notes and highlights to - /// diagnostics. - public init( - message: Message, - location: SourceLocation?, - actions: ((inout Builder) -> Void)? - ) { - var builder = Builder() - actions?(&builder) - self.init( - message: message, - location: location, - notes: builder.notes, - highlights: builder.highlights, - fixIts: builder.fixIts - ) - } - - /// Creates a new Diagnostic with the provided message, pointing to the - /// provided location (if any). - /// - parameters: - /// - message: The diagnostic's message. - /// - location: The location the diagnostic is attached to. - /// - highlights: An array of SourceRanges which will be highlighted when - /// the diagnostic is presented. - public init( - message: Message, - location: SourceLocation?, - notes: [Note], - highlights: [SourceRange], - fixIts: [FixIt] - ) { - self.message = message - self.location = location - self.notes = notes - self.highlights = highlights - self.fixIts = fixIts - } -} diff --git a/Sources/SwiftSyntaxParser/Documentation.docc/Index.md b/Sources/SwiftSyntaxParser/Documentation.docc/Index.md deleted file mode 100644 index 20a769aee35..00000000000 --- a/Sources/SwiftSyntaxParser/Documentation.docc/Index.md +++ /dev/null @@ -1,3 +0,0 @@ -# ``SwiftSyntaxParser`` - -SwiftSyntaxParser allows parsing Swift source code into a SwiftSyntax tree. \ No newline at end of file diff --git a/Sources/SwiftSyntaxParser/SyntaxParser.swift b/Sources/SwiftSyntaxParser/SyntaxParser.swift deleted file mode 100644 index 37f9c64d0b2..00000000000 --- a/Sources/SwiftSyntaxParser/SyntaxParser.swift +++ /dev/null @@ -1,132 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// -// -// Uses the C API for syntax parsing that is part of the Swift toolchain. -// -//===----------------------------------------------------------------------===// - -import Foundation -@_spi(RawSyntax) import SwiftSyntax -@_implementationOnly import SwiftParser - -/// Namespace for functions to parse swift source and retrieve a syntax tree. -public enum SyntaxParser { - /// Parses the string into a full-fidelity Syntax tree. - /// - /// - Parameters: - /// - source: The source string to parse. - /// - parseTransition: Optional mechanism for incremental re-parsing. - /// - filenameForDiagnostics: Optional file name used for SourceLocation. - /// - languageVersion: Interpret input according to a specific Swift - /// language version number. If `nil`, this inherits the default from - /// the syntax parser library. - /// - enableBareSlashRegexLiteral: Enable or disable the use of forward - /// slash regular-expression literal syntax. If `nil`, this inherits the - /// default from the syntax parser library. - /// - diagnosticHandler: Optional callback that will be called for all - /// diagnostics the parser emits - /// - Returns: A top-level Syntax node representing the contents of the tree, - /// if the parse was successful. - /// - Throws: `ParserError` - public static func parse( - source: String, - parseTransition: IncrementalParseTransition? = nil, - filenameForDiagnostics: String = "", - languageVersion: String? = nil, - enableBareSlashRegexLiteral: Bool? = nil, - diagnosticHandler: ((Diagnostic) -> Void)? = nil - ) throws -> SourceFileSyntax { - // Get a native UTF8 string for efficient indexing with UTF8 byte offsets. - // If the string is backed by an NSString then such indexing will become - // extremely slow. - var utf8Source = source - utf8Source.makeContiguousUTF8() - - return try parseImpl( - source: utf8Source, - parseTransition: parseTransition, - filenameForDiagnostics: filenameForDiagnostics, - languageVersion: languageVersion, - enableBareSlashRegexLiteral: enableBareSlashRegexLiteral, - diagnosticHandler: diagnosticHandler - ) - } - - /// Parses the file `URL` into a full-fidelity Syntax tree. - /// - /// - Parameters: - /// - url: The file URL to parse. - /// - languageVersion: Interpret input according to a specific Swift - /// language version number. If `nil`, this inherits the default from - /// the syntax parser library. - /// - enableBareSlashRegexLiteral: Enable or disable the use of forward - /// slash regular-expression literal syntax. If `nil`, this inherits the - /// default from the syntax parser library. - /// - diagnosticHandler: Optional callback that will be called for all - /// diagnostics the parser emits - /// - Returns: A top-level Syntax node representing the contents of the tree, - /// if the parse was successful. - /// - Throws: `ParserError` - public static func parse( - _ url: URL, - languageVersion: String? = nil, - enableBareSlashRegexLiteral: Bool? = nil, - diagnosticHandler: ((Diagnostic) -> Void)? = nil - ) throws -> SourceFileSyntax { - // Avoid using `String(contentsOf:)` because it creates a wrapped NSString. - let fileData = try Data(contentsOf: url) - let source = fileData.withUnsafeBytes { buf in - return String(decoding: buf.bindMemory(to: UInt8.self), as: UTF8.self) - } - return try parse( - source: source, - filenameForDiagnostics: url.path, - languageVersion: languageVersion, - enableBareSlashRegexLiteral: enableBareSlashRegexLiteral, - diagnosticHandler: diagnosticHandler - ) - } - - private static func parseImpl( - source: String, - parseTransition: IncrementalParseTransition?, - filenameForDiagnostics: String, - languageVersion: String?, - enableBareSlashRegexLiteral: Bool?, - diagnosticHandler: ((Diagnostic) -> Void)? - ) throws -> SourceFileSyntax { - return Parser.parse(source: source, parseTransition: parseTransition) - } -} - -extension Note { - init(_ diag: Diagnostic) { - self.init( - message: diag.message, - location: diag.location, - highlights: diag.highlights, - fixIts: diag.fixIts - ) - } -} - -extension Diagnostic { - init(_ diag: Diagnostic, _ notes: [Note]) { - self.init( - message: diag.message, - location: diag.location, - notes: notes, - highlights: diag.highlights, - fixIts: diag.fixIts - ) - } -} diff --git a/Sources/lit-test-helper/main.swift b/Sources/lit-test-helper/main.swift index 58b7a057a7b..582def6f580 100644 --- a/Sources/lit-test-helper/main.swift +++ b/Sources/lit-test-helper/main.swift @@ -11,9 +11,16 @@ //===----------------------------------------------------------------------===// import SwiftSyntax -import SwiftSyntaxParser +import SwiftParser import Foundation +extension Parser { + public static func parse(_ url: URL) throws -> SourceFileSyntax { + let source = try String(contentsOf: url) + return Self.parse(source: source) + } +} + /// Print the given message to stderr func printerr(_ message: String, terminator: String = "\n") { FileHandle.standardError.write((message + terminator).data(using: .utf8)!) @@ -230,13 +237,6 @@ struct IncrementalEdit { let replacement: String } -func getSwiftLanguageVersionInfo(args: CommandLineArguments) -> (languageVersion: String?, enableBareSlashRegexLiteral: Bool?) { - return ( - args["-swift-version"], - args["-enable-bare-slash-regex"].map({ $0 == "1" }) - ) -} - /// Rewrites a parsed tree with all constructed nodes. class TreeReconstructor: SyntaxRewriter { override func visit(_ token: TokenSyntax) -> TokenSyntax { @@ -252,9 +252,8 @@ class TreeReconstructor: SyntaxRewriter { func performClassifySyntax(args: CommandLineArguments) throws { let treeURL = URL(fileURLWithPath: try args.getRequired("-source-file")) - let versionInfo = getSwiftLanguageVersionInfo(args: args) - let tree = try SyntaxParser.parse(treeURL, languageVersion: versionInfo.languageVersion, enableBareSlashRegexLiteral: versionInfo.enableBareSlashRegexLiteral) + let tree = try Parser.parse(treeURL) let result = ClassifiedSyntaxTreePrinter.print(Syntax(tree)) do { // Sanity check that we get the same result if the tree has constructed nodes. @@ -337,9 +336,8 @@ func performParseIncremental(args: CommandLineArguments) throws { URL(fileURLWithPath: try args.getRequired("-old-source-file")) let postEditURL = URL(fileURLWithPath: try args.getRequired("-source-file")) let expectedReparseRegions = try args.getReparseRegions() - let versionInfo = getSwiftLanguageVersionInfo(args: args) - let preEditTree = try SyntaxParser.parse(preEditURL, languageVersion: versionInfo.languageVersion, enableBareSlashRegexLiteral: versionInfo.enableBareSlashRegexLiteral) + let preEditTree = try Parser.parse(preEditURL) let edits = try parseIncrementalEditArguments(args: args) let regionCollector = IncrementalParseReusedNodeCollector() let editTransition = IncrementalParseTransition( @@ -349,8 +347,7 @@ func performParseIncremental(args: CommandLineArguments) throws { ) let postEditText = try String(contentsOf: postEditURL) - let postEditTree = - try SyntaxParser.parse(source: postEditText, parseTransition: editTransition) + let postEditTree = Parser.parse(source: postEditText, parseTransition: editTransition) let postTreeDump = postEditTree.description @@ -455,8 +452,7 @@ func verifyReusedRegions( func performRoundtrip(args: CommandLineArguments) throws { let sourceURL = URL(fileURLWithPath: try args.getRequired("-source-file")) - let versionInfo = getSwiftLanguageVersionInfo(args: args) - let tree = try SyntaxParser.parse(sourceURL, languageVersion: versionInfo.languageVersion, enableBareSlashRegexLiteral: versionInfo.enableBareSlashRegexLiteral) + let tree = try Parser.parse(sourceURL) let treeText = tree.description if let outURL = args["-out"].map(URL.init(fileURLWithPath:)) { @@ -471,9 +467,8 @@ func performVerifyRoundtrip(args: CommandLineArguments) throws { guard let source = try String(data: Data(contentsOf: sourceURL), encoding: .utf8) else { throw TestingError.readingSourceFileFailed(sourceURL) } - let versionInfo = getSwiftLanguageVersionInfo(args: args) - let tree = try SyntaxParser.parse(source: source, languageVersion: versionInfo.languageVersion, enableBareSlashRegexLiteral: versionInfo.enableBareSlashRegexLiteral) + let tree = Parser.parse(source: source) if tree.description != source { throw TestingError.roundTripFailed } @@ -500,73 +495,16 @@ class NodePrinter: SyntaxAnyVisitor { func printSyntaxTree(args: CommandLineArguments) throws { let treeURL = URL(fileURLWithPath: try args.getRequired("-source-file")) - let versionInfo = getSwiftLanguageVersionInfo(args: args) - let tree = try SyntaxParser.parse(treeURL, languageVersion: versionInfo.languageVersion, enableBareSlashRegexLiteral: versionInfo.enableBareSlashRegexLiteral) + let tree = try Parser.parse(treeURL) let printer = NodePrinter() printer.walk(tree) } -func printParserDiags(args: CommandLineArguments) throws { - let treeURL = URL(fileURLWithPath: try args.getRequired("-source-file")) - let versionInfo = getSwiftLanguageVersionInfo(args: args) - - var diagCounter: (error: Int, warning: Int, note: Int) = (0, 0, 0) - - func handleDiagnostic(diagnostic: Diagnostic) { - switch diagnostic.message.severity { - case .error: - diagCounter.error += 1 - diagCounter.note += diagnostic.notes.count - case .warning: - diagCounter.warning += 1 - diagCounter.note += diagnostic.notes.count - case .note: - diagCounter.note += 1 - } - print(diagnostic.debugDescription) - } - - _ = try SyntaxParser.parse(treeURL, languageVersion: versionInfo.languageVersion, enableBareSlashRegexLiteral: versionInfo.enableBareSlashRegexLiteral, diagnosticHandler: handleDiagnostic) - - print("\(diagCounter.error) error(s) \(diagCounter.warning) warnings(s) \(diagCounter.note) note(s)") -} - /// Write the given string to stderr **without** appending a newline character. func writeToStderr(_ msg: String) { FileHandle.standardError.write(msg.data(using: .utf8)!) } -func diagnose(args: CommandLineArguments) throws { - func printDiagnostic(diagnostic: Diagnostic) { - if let loc = diagnostic.location { - writeToStderr("\(loc.file!):\(loc.line!):\(loc.column!): ") - } else { - writeToStderr(":0:0: ") - } - switch diagnostic.message.severity { - case .note: writeToStderr("note: ") - case .warning: writeToStderr("warning: ") - case .error: writeToStderr("error: ") - } - writeToStderr(diagnostic.message.text) - writeToStderr("\n") - - for note in diagnostic.notes { - printDiagnostic(diagnostic: note.asDiagnostic()) - } - } - - let treeURL = URL(fileURLWithPath: try args.getRequired("-source-file")) - let versionInfo = getSwiftLanguageVersionInfo(args: args) - - _ = try SyntaxParser.parse( - treeURL, - languageVersion: versionInfo.languageVersion, - enableBareSlashRegexLiteral: versionInfo.enableBareSlashRegexLiteral, - diagnosticHandler: printDiagnostic - ) -} - do { let args = try CommandLineArguments.parse(CommandLine.arguments.dropFirst()) @@ -580,10 +518,6 @@ do { try performVerifyRoundtrip(args: args) } else if args.has("-print-tree") { try printSyntaxTree(args: args) - } else if args.has("-dump-diags") { - try printParserDiags(args: args) - } else if args.has("-diagnose") { - try diagnose(args: args) } else if args.has("-help") { printHelp() } else { diff --git a/Tests/PerformanceTest/ParsingPerformanceTests.swift b/Tests/PerformanceTest/ParsingPerformanceTests.swift index f45dd0a4208..817ce93470e 100644 --- a/Tests/PerformanceTest/ParsingPerformanceTests.swift +++ b/Tests/PerformanceTest/ParsingPerformanceTests.swift @@ -12,7 +12,6 @@ import XCTest import SwiftSyntax -import SwiftSyntaxParser import SwiftParser public class ParsingPerformanceTests: XCTestCase { @@ -24,23 +23,12 @@ public class ParsingPerformanceTests: XCTestCase { .appendingPathComponent("MinimalCollections.swift.input") } - func testParsingPerformance() throws { - try XCTSkipIf(ProcessInfo.processInfo.environment["SKIP_LONG_TESTS"] == "1") - measure { - do { - _ = try SyntaxParser.parse(inputFile) - } catch { - XCTFail(error.localizedDescription) - } - } - } - func testNativeParsingPerformance() throws { try XCTSkipIf(ProcessInfo.processInfo.environment["SKIP_LONG_TESTS"] == "1") measure { do { let source = try String(contentsOf: inputFile) - _ = SwiftParser.Parser.parse(source: source) + _ = Parser.parse(source: source) } catch { XCTFail(error.localizedDescription) } diff --git a/Tests/PerformanceTest/SyntaxClassifierPerformanceTests.swift b/Tests/PerformanceTest/SyntaxClassifierPerformanceTests.swift index e17d3d54e6d..3b5dbd13c5b 100644 --- a/Tests/PerformanceTest/SyntaxClassifierPerformanceTests.swift +++ b/Tests/PerformanceTest/SyntaxClassifierPerformanceTests.swift @@ -13,7 +13,7 @@ import XCTest import IDEUtils import SwiftSyntax -import SwiftSyntaxParser +import SwiftParser public class SyntaxClassifierPerformanceTests: XCTestCase { @@ -28,7 +28,8 @@ public class SyntaxClassifierPerformanceTests: XCTestCase { try XCTSkipIf(ProcessInfo.processInfo.environment["SKIP_LONG_TESTS"] == "1") XCTAssertNoThrow( try { - let parsed = try SyntaxParser.parse(inputFile) + let source = try String(contentsOf: inputFile) + let parsed = Parser.parse(source: source) measure { for _ in 0..<10 { diff --git a/Tests/PerformanceTest/VisitorPerformanceTests.swift b/Tests/PerformanceTest/VisitorPerformanceTests.swift index d39c8918f2d..6ec95aadce8 100644 --- a/Tests/PerformanceTest/VisitorPerformanceTests.swift +++ b/Tests/PerformanceTest/VisitorPerformanceTests.swift @@ -12,7 +12,7 @@ import XCTest import SwiftSyntax -import SwiftSyntaxParser +import SwiftParser public class VisitorPerformanceTests: XCTestCase { @@ -29,7 +29,7 @@ public class VisitorPerformanceTests: XCTestCase { XCTAssertNoThrow( try { - let parsed = try SyntaxParser.parse(inputFile) + let parsed = Parser.parse(source: try String(contentsOf: inputFile)) let emptyVisitor = EmptyVisitor(viewMode: .sourceAccurate) @@ -46,7 +46,7 @@ public class VisitorPerformanceTests: XCTestCase { XCTAssertNoThrow( try { - let parsed = try SyntaxParser.parse(inputFile) + let parsed = Parser.parse(source: try String(contentsOf: inputFile)) let emptyRewriter = EmptyRewriter() @@ -63,7 +63,7 @@ public class VisitorPerformanceTests: XCTestCase { XCTAssertNoThrow( try { - let parsed = try SyntaxParser.parse(inputFile) + let parsed = Parser.parse(source: try String(contentsOf: inputFile)) let emptyVisitor = EmptyAnyVisitor(viewMode: .sourceAccurate) diff --git a/Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift b/Tests/SwiftParserTest/IncrementalParsingTests.swift similarity index 89% rename from Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift rename to Tests/SwiftParserTest/IncrementalParsingTests.swift index fdbbee31f3b..e4d1cc1bdaf 100644 --- a/Tests/SwiftSyntaxParserTest/IncrementalParsingTests.swift +++ b/Tests/SwiftParserTest/IncrementalParsingTests.swift @@ -12,7 +12,7 @@ import XCTest import SwiftSyntax -import SwiftSyntaxParser +import SwiftParser public class IncrementalParsingTests: XCTestCase { @@ -21,10 +21,10 @@ public class IncrementalParsingTests: XCTestCase { let step: (String, (Int, Int, String)) = ("struct AA { func f() {", (8, 0, "A")) - var tree = try! SyntaxParser.parse(source: original) + var tree = Parser.parse(source: original) let sourceEdit = SourceEdit(range: ByteSourceRange(offset: step.1.0, length: step.1.1), replacementLength: step.1.2.utf8.count) let lookup = IncrementalParseTransition(previousTree: tree, edits: ConcurrentEdits(sourceEdit)) - tree = try! SyntaxParser.parse(source: step.0, parseTransition: lookup) + tree = Parser.parse(source: step.0, parseTransition: lookup) XCTAssertEqual("\(tree)", step.0) } @@ -35,11 +35,11 @@ public class IncrementalParsingTests: XCTestCase { let step: (String, (Int, Int, String)) = ("struct AA {}\nstruct B {}\n", (8, 0, "A")) - let origTree = try! SyntaxParser.parse(source: original) + let origTree = Parser.parse(source: original) let sourceEdit = SourceEdit(range: ByteSourceRange(offset: step.1.0, length: step.1.1), replacementLength: step.1.2.utf8.count) let reusedNodeCollector = IncrementalParseReusedNodeCollector() let transition = IncrementalParseTransition(previousTree: origTree, edits: ConcurrentEdits(sourceEdit), reusedNodeDelegate: reusedNodeCollector) - let newTree = try! SyntaxParser.parse(source: step.0, parseTransition: transition) + let newTree = Parser.parse(source: step.0, parseTransition: transition) XCTAssertEqual("\(newTree)", step.0) let origStructB = origTree.statements[1] diff --git a/Tests/SwiftParserTest/LexerTests.swift b/Tests/SwiftParserTest/LexerTests.swift index 047b7f9fb9e..8ea04a80eb3 100644 --- a/Tests/SwiftParserTest/LexerTests.swift +++ b/Tests/SwiftParserTest/LexerTests.swift @@ -1240,6 +1240,22 @@ public class LexerTests: XCTestCase { ) } + func testNullCharacterInSourceFile() { + assertLexemes( + "var x = 11️⃣\0\nvar y = 2", + lexemes: [ + LexemeSpec(.keyword, text: "var", trailing: " "), + LexemeSpec(.identifier, text: "x", trailing: " "), + LexemeSpec(.equal, text: "=", trailing: " "), + LexemeSpec(.integerLiteral, text: "1", trailing: "\0", diagnostic: "nul character embedded in middle of file"), + LexemeSpec(.keyword, leading: "\n", text: "var", trailing: " ", flags: .isAtStartOfLine), + LexemeSpec(.identifier, text: "y", trailing: " "), + LexemeSpec(.equal, text: "=", trailing: " "), + LexemeSpec(.integerLiteral, text: "2", trailing: ""), + ] + ) + } + func testNullCharacterInStringLiteral() { assertLexemes( """ diff --git a/Tests/SwiftSyntaxParserTest/Inputs/closure.swift b/Tests/SwiftSyntaxParserTest/Inputs/closure.swift deleted file mode 100644 index 64b2c2aa20b..00000000000 --- a/Tests/SwiftSyntaxParserTest/Inputs/closure.swift +++ /dev/null @@ -1,3 +0,0 @@ -// A closure without a signature. The test will ensure it stays the same after -// applying a rewriting pass. -let x: () -> Void = {} \ No newline at end of file diff --git a/Tests/SwiftSyntaxParserTest/Inputs/diagnostics.swift b/Tests/SwiftSyntaxParserTest/Inputs/diagnostics.swift deleted file mode 100644 index e9a6f8ce4d9..00000000000 --- a/Tests/SwiftSyntaxParserTest/Inputs/diagnostics.swift +++ /dev/null @@ -1,11 +0,0 @@ -func foo() { - -} - -func bar() { - -} - -func baz() { - -} \ No newline at end of file diff --git a/Tests/SwiftSyntaxParserTest/Inputs/near-empty.swift b/Tests/SwiftSyntaxParserTest/Inputs/near-empty.swift deleted file mode 100644 index 8ba3a16384a..00000000000 --- a/Tests/SwiftSyntaxParserTest/Inputs/near-empty.swift +++ /dev/null @@ -1 +0,0 @@ -n diff --git a/Tests/SwiftSyntaxParserTest/Inputs/nested-blocks.swift b/Tests/SwiftSyntaxParserTest/Inputs/nested-blocks.swift deleted file mode 100644 index 9993ae44877..00000000000 --- a/Tests/SwiftSyntaxParserTest/Inputs/nested-blocks.swift +++ /dev/null @@ -1,8 +0,0 @@ -struct Foo { - func foo() { - print("hello") - func bar() { - print("goodbye") - } - } -} diff --git a/Tests/SwiftSyntaxParserTest/Inputs/visitor.swift b/Tests/SwiftSyntaxParserTest/Inputs/visitor.swift deleted file mode 100644 index b2b527f8f78..00000000000 --- a/Tests/SwiftSyntaxParserTest/Inputs/visitor.swift +++ /dev/null @@ -1,7 +0,0 @@ -func foo() { - public func foo() { - func foo() { - /*Unknown token */0xG - } - } -} diff --git a/Tests/SwiftSyntaxParserTest/ParseFileTests.swift b/Tests/SwiftSyntaxParserTest/ParseFileTests.swift deleted file mode 100644 index 5f40f4f4b3e..00000000000 --- a/Tests/SwiftSyntaxParserTest/ParseFileTests.swift +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -import XCTest -import SwiftSyntax -import SwiftSyntaxParser - -fileprivate struct Foo { - public let x: Int - private(set) var y: [Bool] -} - -#if os(macOS) -fileprivate class Test: NSObject { - @objc var bar: Int = 0 - func test() { - print(#selector(function)) - print(#keyPath(bar)) - } - @objc func function() { - } -} -#endif - -enum Animal { - case cat - case dog -} - -public class ParseFileTests: XCTestCase { - - public func testParseSingleFile() { - let currentFile = URL(fileURLWithPath: #file) - XCTAssertNoThrow( - try { - let fileContents = try String(contentsOf: currentFile) - let parsed = try SyntaxParser.parse(currentFile) - XCTAssertEqual("\(parsed)", fileContents) - }() - ) - } - - public func testEnumCaseStructure() { - class Visitor: SyntaxVisitor { - var cases: [EnumCaseDeclSyntax] = [] - override func visit(_ node: EnumDeclSyntax) -> SyntaxVisitorContinueKind { - cases.append( - contentsOf: node.memberBlock.members.compactMap { - $0.decl.as(EnumCaseDeclSyntax.self) - } - ) - return .skipChildren - } - } - let v = Visitor(viewMode: .fixedUp) - let currentFile = URL(fileURLWithPath: #file) - let parsed = try! SyntaxParser.parse(currentFile) - v.walk(parsed) - XCTAssertEqual(v.cases.count, 2) - } -} diff --git a/Tests/SwiftSyntaxParserTest/SyntaxTests.swift b/Tests/SwiftSyntaxParserTest/SyntaxTests.swift deleted file mode 100644 index 97ed0b6abaf..00000000000 --- a/Tests/SwiftSyntaxParserTest/SyntaxTests.swift +++ /dev/null @@ -1,186 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -import XCTest -import SwiftSyntax -import SwiftSyntaxParser - -fileprivate extension SyntaxProtocol { - func token(at index: Int, viewMode: SyntaxTreeViewMode) -> TokenSyntax? { - var token = self.firstToken(viewMode: viewMode) - for _ in 0.. SyntaxVisitorContinueKind { - funcCount += 1 - return .visitChildren - } - } - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(getTestInput("visitor.swift")) - let counter = FuncCounter(viewMode: .fixedUp) - let hashBefore = parsed.hashValue - counter.walk(parsed) - XCTAssertEqual(counter.funcCount, 3) - XCTAssertEqual(hashBefore, parsed.hashValue) - }() - ) - } - - public func testRewritingNodeWithEmptyChild() { - class ClosureRewriter: SyntaxRewriter { - override func visit(_ node: ClosureExprSyntax) -> ExprSyntax { - // Perform a no-op transform that requires rebuilding the node. - return ExprSyntax(node.with(\.signature, node.signature)) - } - } - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(getTestInput("closure.swift")) - let rewriter = ClosureRewriter() - let rewritten = rewriter.visit(parsed) - XCTAssertEqual(parsed.description, rewritten.description) - }() - ) - } - - public func testSyntaxRewriterVisitAny() { - class VisitAnyRewriter: SyntaxRewriter { - let transform: (TokenSyntax) -> TokenSyntax - init(transform: @escaping (TokenSyntax) -> TokenSyntax) { - self.transform = transform - } - override func visitAny(_ node: Syntax) -> Syntax? { - if let tok = node.as(TokenSyntax.self) { - return Syntax(transform(tok)) - } - return nil - } - } - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(getTestInput("near-empty.swift")) - let rewriter = VisitAnyRewriter(transform: { _ in - return TokenSyntax.identifier("") - }) - let rewritten = rewriter.visit(parsed) - XCTAssertEqual(rewritten.description, "") - }() - ) - } - - public func testSyntaxRewriterVisitCollection() { - class VisitCollections: SyntaxVisitor { - var numberOfCodeBlockItems = 0 - - override func visit(_ items: CodeBlockItemListSyntax) -> SyntaxVisitorContinueKind { - numberOfCodeBlockItems += items.count - return .visitChildren - } - } - - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(getTestInput("nested-blocks.swift")) - let visitor = VisitCollections(viewMode: .fixedUp) - visitor.walk(parsed) - XCTAssertEqual(4, visitor.numberOfCodeBlockItems) - }() - ) - } - - public func testVisitorClass() { - class FuncCounter: SyntaxVisitor { - var funcCount = 0 - override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { - funcCount += 1 - return super.visit(node) - } - } - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(getTestInput("visitor.swift")) - let counter = FuncCounter(viewMode: .fixedUp) - let hashBefore = parsed.hashValue - counter.walk(parsed) - XCTAssertEqual(counter.funcCount, 3) - XCTAssertEqual(hashBefore, parsed.hashValue) - }() - ) - } - - public func testRewriteTrivia() { - class TriviaRemover: SyntaxRewriter { - override func visit(_ token: TokenSyntax) -> TokenSyntax { - return token.with(\.trailingTrivia, []) - } - } - - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(source: "let a = 5") - let visitor = TriviaRemover() - let rewritten = visitor.visit(parsed) - XCTAssertEqual(rewritten.description, "leta=5") - }() - ) - } -} diff --git a/Tests/SwiftSyntaxParserTest/TokenTest.swift b/Tests/SwiftSyntaxParserTest/TokenTest.swift deleted file mode 100644 index 5cd71f57f57..00000000000 --- a/Tests/SwiftSyntaxParserTest/TokenTest.swift +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -import XCTest -@_spi(Testing) import SwiftSyntax -import SwiftSyntaxParser - -public class TokenTests: XCTestCase { - - public func testKeywordKinds() { - XCTAssertTrue(TokenKind.keyword(.operator).isLexerClassifiedKeyword) - XCTAssertTrue(TokenKind.keyword(.func).isLexerClassifiedKeyword) - XCTAssertFalse(TokenKind.leftAngle.isLexerClassifiedKeyword) - XCTAssertFalse(TokenKind.rightAngle.isLexerClassifiedKeyword) - } - - public func testPunctuators() { - XCTAssertTrue(TokenKind.leftParen.isPunctuation) - XCTAssertTrue(TokenKind.rightParen.isPunctuation) - XCTAssertTrue(TokenKind.leftBrace.isPunctuation) - XCTAssertTrue(TokenKind.rightBrace.isPunctuation) - XCTAssertTrue(TokenKind.leftSquareBracket.isPunctuation) - XCTAssertTrue(TokenKind.rightSquareBracket.isPunctuation) - XCTAssertTrue(TokenKind.leftAngle.isPunctuation) - XCTAssertTrue(TokenKind.rightAngle.isPunctuation) - XCTAssertTrue(TokenKind.period.isPunctuation) - XCTAssertTrue(TokenKind.comma.isPunctuation) - XCTAssertTrue(TokenKind.ellipsis.isPunctuation) - XCTAssertTrue(TokenKind.colon.isPunctuation) - XCTAssertTrue(TokenKind.semicolon.isPunctuation) - XCTAssertTrue(TokenKind.equal.isPunctuation) - XCTAssertTrue(TokenKind.atSign.isPunctuation) - XCTAssertTrue(TokenKind.pound.isPunctuation) - XCTAssertTrue(TokenKind.prefixAmpersand.isPunctuation) - XCTAssertTrue(TokenKind.arrow.isPunctuation) - XCTAssertTrue(TokenKind.backtick.isPunctuation) - XCTAssertTrue(TokenKind.backslash.isPunctuation) - XCTAssertTrue(TokenKind.exclamationMark.isPunctuation) - XCTAssertTrue(TokenKind.postfixQuestionMark.isPunctuation) - XCTAssertTrue(TokenKind.infixQuestionMark.isPunctuation) - XCTAssertTrue(TokenKind.stringQuote.isPunctuation) - XCTAssertTrue(TokenKind.singleQuote.isPunctuation) - XCTAssertTrue(TokenKind.multilineStringQuote.isPunctuation) - } - - public func testTokenLgnth() { - let source = "\"\"\"\n\\(a)\n\"\"\"" - let tree = try! SyntaxParser.parse(source: source) - let tok = tree.firstToken(viewMode: .sourceAccurate)! - XCTAssertTrue(tok.tokenKind == .multilineStringQuote) - XCTAssertEqual(tok.contentLength.utf8Length, 3) - - let tok2 = TokenSyntax.multilineStringQuoteToken() - XCTAssertTrue(tok2.tokenKind == .multilineStringQuote) - XCTAssertEqual(tok2.contentLength.utf8Length, 3) - } -} diff --git a/Tests/SwiftSyntaxParserTest/AbsolutePositionTests.swift b/Tests/SwiftSyntaxTest/AbsolutePositionTests.swift similarity index 77% rename from Tests/SwiftSyntaxParserTest/AbsolutePositionTests.swift rename to Tests/SwiftSyntaxTest/AbsolutePositionTests.swift index f6b8ab181ef..518012d11b2 100644 --- a/Tests/SwiftSyntaxParserTest/AbsolutePositionTests.swift +++ b/Tests/SwiftSyntaxTest/AbsolutePositionTests.swift @@ -10,10 +10,9 @@ // //===----------------------------------------------------------------------===// -import XCTest -import SwiftSyntax -import SwiftSyntaxParser import _SwiftSyntaxTestSupport +import SwiftSyntax +import XCTest fileprivate class FuncRenamer: SyntaxRewriter { override func visit(_ node: FunctionDeclSyntax) -> DeclSyntax { @@ -24,72 +23,6 @@ fileprivate class FuncRenamer: SyntaxRewriter { } public class AbsolutePositionTests: XCTestCase { - - public func testVisitor() { - XCTAssertNoThrow( - try { - let source = try String(contentsOf: getTestInput("visitor.swift")) - let parsed = try SyntaxParser.parse(getTestInput("visitor.swift")) - XCTAssertEqual(0, parsed.position.utf8Offset) - XCTAssertEqual( - source.count, - parsed.eofToken.positionAfterSkippingLeadingTrivia.utf8Offset - ) - XCTAssertEqual(0, parsed.position.utf8Offset) - XCTAssertEqual(source.count, parsed.byteSize) - }() - ) - } - - public func testClosure() { - XCTAssertNoThrow( - try { - let source = try String(contentsOf: getTestInput("closure.swift")) - let parsed = try SyntaxParser.parse(getTestInput("closure.swift")) - XCTAssertEqual( - source.count, - parsed.eofToken.positionAfterSkippingLeadingTrivia.utf8Offset - ) - XCTAssertEqual(0, parsed.position.utf8Offset) - XCTAssertEqual(source.count, parsed.byteSize) - }() - ) - } - - public func testRename() { - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(getTestInput("visitor.swift")) - let renamed = FuncRenamer().visit(parsed) - let renamedSource = renamed.description - XCTAssertEqual( - renamedSource.count, - renamed.eofToken.positionAfterSkippingLeadingTrivia.utf8Offset - ) - XCTAssertEqual(renamedSource.count, renamed.byteSize) - }() - ) - } - - public func testCurrentFile() { - XCTAssertNoThrow( - try { - let parsed = try SyntaxParser.parse(URL(fileURLWithPath: #file)) - class Visitor: SyntaxVisitor { - override func visit(_ node: TokenSyntax) -> SyntaxVisitorContinueKind { - XCTAssertEqual( - node.positionAfterSkippingLeadingTrivia.utf8Offset, - node.position.utf8Offset + node.leadingTrivia.byteSize - ) - return .skipChildren - } - } - let visitor = Visitor(viewMode: .sourceAccurate) - visitor.walk(parsed) - }() - ) - } - public func testRecursion() { var l = [CodeBlockItemSyntax]() let idx = 2000 diff --git a/Tests/SwiftSyntaxTest/SyntaxTests.swift b/Tests/SwiftSyntaxTest/SyntaxTests.swift index e37902dade1..f1ab22e4b02 100644 --- a/Tests/SwiftSyntaxTest/SyntaxTests.swift +++ b/Tests/SwiftSyntaxTest/SyntaxTests.swift @@ -48,4 +48,81 @@ public class SyntaxTests: XCTestCase { XCTAssertEqual(Syntax(s), s.memberBlock.parent) XCTAssertNil(s.memberBlock.detach().parent) } + + public func testCasting() { + let integerExpr = IntegerLiteralExprSyntax( + digits: .integerLiteral("1", trailingTrivia: .space) + ) + + let expr = ExprSyntax(integerExpr) + let node = Syntax(expr) + XCTAssertTrue(expr.is(IntegerLiteralExprSyntax.self)) + XCTAssertTrue(node.is(IntegerLiteralExprSyntax.self)) + XCTAssertTrue(node.as(ExprSyntax.self)!.is(IntegerLiteralExprSyntax.self)) + + XCTAssertTrue(node.isProtocol(ExprSyntaxProtocol.self)) + XCTAssertTrue(node.asProtocol(ExprSyntaxProtocol.self) is IntegerLiteralExprSyntax) + XCTAssertTrue(expr.asProtocol(ExprSyntaxProtocol.self) is IntegerLiteralExprSyntax) + XCTAssertTrue(expr.asProtocol(ExprSyntaxProtocol.self) as? IntegerLiteralExprSyntax == integerExpr) + + XCTAssertFalse(node.isProtocol(BracedSyntax.self)) + XCTAssertNil(node.asProtocol(BracedSyntax.self)) + XCTAssertFalse(expr.isProtocol(BracedSyntax.self)) + XCTAssertNil(expr.asProtocol(BracedSyntax.self)) + + let classDecl = CodeBlockSyntax( + leftBrace: TokenSyntax.leftBraceToken(), + statements: CodeBlockItemListSyntax([]), + rightBrace: TokenSyntax.rightBraceToken() + ) + + XCTAssertTrue(classDecl.isProtocol(BracedSyntax.self)) + XCTAssertNotNil(classDecl.asProtocol(BracedSyntax.self)) + + let optNode: Syntax? = node + switch optNode?.as(SyntaxEnum.self) { + case .integerLiteralExpr: break + default: XCTFail("failed to convert to SyntaxEnum") + } + + XCTAssertNil(ExprSyntax(nil as IntegerLiteralExprSyntax?)) + XCTAssertEqual(ExprSyntax(integerExpr).as(IntegerLiteralExprSyntax.self)!, integerExpr) + } + + public func testNodeType() { + let integerExpr = IntegerLiteralExprSyntax( + digits: TokenSyntax.integerLiteral("1", trailingTrivia: .space) + ) + let expr = ExprSyntax(integerExpr) + let node = Syntax(expr) + + XCTAssertTrue(integerExpr.syntaxNodeType == expr.syntaxNodeType) + XCTAssertTrue(integerExpr.syntaxNodeType == node.syntaxNodeType) + XCTAssertEqual("\(integerExpr.syntaxNodeType)", "IntegerLiteralExprSyntax") + } + + public func testConstructFromSyntaxProtocol() { + let integerExpr = IntegerLiteralExprSyntax( + digits: .integerLiteral("1", trailingTrivia: .space) + ) + + XCTAssertEqual(Syntax(integerExpr), Syntax(fromProtocol: integerExpr as SyntaxProtocol)) + XCTAssertEqual(Syntax(integerExpr), Syntax(fromProtocol: integerExpr as ExprSyntaxProtocol)) + } + + public func testPositions() { + let leading = Trivia(pieces: [.spaces(2)]) + let trailing = Trivia(pieces: [.spaces(1)]) + let funcKW = TokenSyntax.keyword( + .func, + leadingTrivia: leading, + trailingTrivia: trailing + ) + XCTAssertEqual("\(funcKW)", " func ") + XCTAssertEqual(funcKW.position, AbsolutePosition(utf8Offset: 0)) + XCTAssertEqual(funcKW.positionAfterSkippingLeadingTrivia, AbsolutePosition(utf8Offset: 2)) + XCTAssertEqual(funcKW.endPositionBeforeTrailingTrivia, AbsolutePosition(utf8Offset: 6)) + XCTAssertEqual(funcKW.endPosition, AbsolutePosition(utf8Offset: 7)) + XCTAssertEqual(funcKW.contentLength, SourceLength(utf8Length: 4)) + } } diff --git a/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift b/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift new file mode 100644 index 00000000000..b408b1aa073 --- /dev/null +++ b/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift @@ -0,0 +1,240 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import XCTest +import SwiftSyntax +import SwiftSyntaxBuilder +import _SwiftSyntaxTestSupport + +public class SyntaxVisitorTests: XCTestCase { + /// The syntax tree of the following source file + /// ```swift + /// func foo() { + /// public func foo() { + /// func foo() { + /// /*Unknown token */0xG + /// } + /// } + /// } + /// ``` + /// + /// The source file is hard-coded so this test case doesn't need to depend on the parser. + static var nestedFunctionsFile: SourceFileSyntax { + let source = SourceFileSyntax( + statements: CodeBlockItemListSyntax([ + CodeBlockItemSyntax( + item: CodeBlockItemSyntax.Item( + FunctionDeclSyntax( + funcKeyword: .keyword(.func, trailingTrivia: .space), + identifier: .identifier("foo"), + signature: FunctionSignatureSyntax( + input: ParameterClauseSyntax( + leftParen: .leftParenToken(), + parameterList: FunctionParameterListSyntax([]), + rightParen: .rightParenToken(trailingTrivia: .space) + ) + ), + body: CodeBlockSyntax( + leftBrace: .leftBraceToken(), + statements: CodeBlockItemListSyntax([ + CodeBlockItemSyntax( + item: CodeBlockItemSyntax.Item( + FunctionDeclSyntax( + modifiers: ModifierListSyntax([ + DeclModifierSyntax(name: .keyword(.public, leadingTrivia: [.newlines(1), .spaces(2)], trailingTrivia: .space)) + ]), + funcKeyword: .keyword(.func, trailingTrivia: .space), + identifier: .identifier("foo"), + signature: FunctionSignatureSyntax( + input: ParameterClauseSyntax( + leftParen: .leftParenToken(), + parameterList: FunctionParameterListSyntax([]), + rightParen: .rightParenToken(trailingTrivia: .space) + ) + ), + body: CodeBlockSyntax( + leftBrace: .leftBraceToken(), + statements: CodeBlockItemListSyntax([ + CodeBlockItemSyntax( + item: CodeBlockItemSyntax.Item( + FunctionDeclSyntax( + funcKeyword: .keyword(.func, leadingTrivia: [.newlines(1), .spaces(4)], trailingTrivia: .space), + identifier: .identifier("foo"), + signature: FunctionSignatureSyntax( + input: ParameterClauseSyntax( + leftParen: .leftParenToken(), + parameterList: FunctionParameterListSyntax([]), + rightParen: .rightParenToken(trailingTrivia: .space) + ) + ), + body: CodeBlockSyntax( + leftBrace: .leftBraceToken(), + statements: CodeBlockItemListSyntax([ + CodeBlockItemSyntax( + item: CodeBlockItemSyntax.Item( + IntegerLiteralExprSyntax( + digits: .integerLiteral( + "0xG", + leadingTrivia: [ + .newlines(1), + .spaces(6), + .blockComment("/*Unknown token */"), + ] + ) + ) + ) + ) + ]), + rightBrace: .rightBraceToken(leadingTrivia: [.newlines(1), .spaces(4)]) + ) + ) + ) + ) + ]), + rightBrace: .rightBraceToken(leadingTrivia: [.newlines(1), .spaces(2)]) + ) + ) + ) + ) + ]), + rightBrace: .rightBraceToken(leadingTrivia: .newline) + ) + ) + ) + ) + ]) + ) + + // Make sure we are indeed generating a syntax tree for the expected source file. + precondition( + source.description + == """ + func foo() { + public func foo() { + func foo() { + /*Unknown token */0xG + } + } + } + """ + ) + return source + } + + public func testBasic() { + class FuncCounter: SyntaxVisitor { + var funcCount = 0 + override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + funcCount += 1 + return .visitChildren + } + } + let parsed = Self.nestedFunctionsFile + let counter = FuncCounter(viewMode: .fixedUp) + let hashBefore = parsed.hashValue + counter.walk(parsed) + XCTAssertEqual(counter.funcCount, 3) + XCTAssertEqual(hashBefore, parsed.hashValue) + } + + public func testRewritingNodeWithEmptyChild() { + class ClosureRewriter: SyntaxRewriter { + override func visit(_ node: ClosureExprSyntax) -> ExprSyntax { + // Perform a no-op transform that requires rebuilding the node. + return ExprSyntax(node.with(\.statements, node.statements)) + } + } + let closure = ClosureExprSyntax( + statements: CodeBlockItemListSyntax([]) + ) + let rewriter = ClosureRewriter() + let rewritten = rewriter.visit(closure) + XCTAssertEqual(closure.description, rewritten.description) + } + + public func testSyntaxRewriterVisitAny() { + class VisitAnyRewriter: SyntaxRewriter { + let transform: (TokenSyntax) -> TokenSyntax + init(transform: @escaping (TokenSyntax) -> TokenSyntax) { + self.transform = transform + } + override func visitAny(_ node: Syntax) -> Syntax? { + if let tok = node.as(TokenSyntax.self) { + return Syntax(transform(tok)) + } + return nil + } + } + let parsed = IdentifierExprSyntax(identifier: .identifier("n")) + let rewriter = VisitAnyRewriter(transform: { _ in + return TokenSyntax.identifier("") + }) + let rewritten = rewriter.visit(parsed) + XCTAssertEqual(rewritten.description, "") + } + + public func testSyntaxRewriterVisitCollection() { + class VisitCollections: SyntaxVisitor { + var numberOfCodeBlockItems = 0 + + override func visit(_ items: CodeBlockItemListSyntax) -> SyntaxVisitorContinueKind { + numberOfCodeBlockItems += items.count + return .visitChildren + } + } + + let visitor = VisitCollections(viewMode: .fixedUp) + visitor.walk(Self.nestedFunctionsFile) + XCTAssertEqual(4, visitor.numberOfCodeBlockItems) + } + + public func testVisitorClass() { + class FuncCounter: SyntaxVisitor { + var funcCount = 0 + override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + funcCount += 1 + return super.visit(node) + } + } + let sourceFile = Self.nestedFunctionsFile + let counter = FuncCounter(viewMode: .fixedUp) + let hashBefore = sourceFile.hashValue + counter.walk(sourceFile) + XCTAssertEqual(counter.funcCount, 3) + XCTAssertEqual(hashBefore, sourceFile.hashValue) + } + + public func testRewriteTrivia() { + class TriviaRemover: SyntaxRewriter { + override func visit(_ token: TokenSyntax) -> TokenSyntax { + return token.with(\.trailingTrivia, []) + } + } + + let source = VariableDeclSyntax( + bindingKeyword: .keyword(.let, trailingTrivia: .space), + bindings: PatternBindingListSyntax([ + PatternBindingSyntax( + pattern: PatternSyntax(IdentifierPatternSyntax(identifier: .identifier("a", trailingTrivia: .space))), + initializer: InitializerClauseSyntax( + equal: .equalToken(trailingTrivia: .space), + value: ExprSyntax(IntegerLiteralExprSyntax(digits: .integerLiteral("5"))) + ) + ) + ]) + ) + XCTAssertEqual(source.description, "let a = 5") + let visitor = TriviaRemover() + let rewritten = visitor.visit(source) + XCTAssertEqual(rewritten.description, "leta=5") + } +} diff --git a/Tests/SwiftSyntaxParserTest/SyntaxComparisonTests.swift b/Tests/SwiftSyntaxTestSupportTest/SyntaxComparisonTests.swift similarity index 92% rename from Tests/SwiftSyntaxParserTest/SyntaxComparisonTests.swift rename to Tests/SwiftSyntaxTestSupportTest/SyntaxComparisonTests.swift index d6d55a0ca6c..89f34517bd2 100644 --- a/Tests/SwiftSyntaxParserTest/SyntaxComparisonTests.swift +++ b/Tests/SwiftSyntaxTestSupportTest/SyntaxComparisonTests.swift @@ -10,13 +10,13 @@ // //===----------------------------------------------------------------------===// -import SwiftSyntax import _SwiftSyntaxTestSupport -import SwiftSyntaxParser +import SwiftSyntax +import SwiftParser import XCTest -private func parse(source: String) throws -> Syntax { - return try Syntax(SyntaxParser.parse(source: source)) +private func parse(source: String) -> Syntax { + return Syntax(Parser.parse(source: source)) } public class SyntaxComparisonTests: XCTestCase { @@ -26,7 +26,7 @@ public class SyntaxComparisonTests: XCTestCase { let actual = Syntax(makeFunc(identifier: .identifier("f"))) XCTAssertNil(actual.findFirstDifference(baseline: expected)) - let matcher = try SubtreeMatcher("struct A { func f() { } }", parse: parse) + let matcher = SubtreeMatcher("struct A { func f() { } }", parse: parse) try XCTAssertNil(matcher.findFirstDifference(baseline: expected)) } @@ -53,7 +53,7 @@ public class SyntaxComparisonTests: XCTestCase { let actual = Syntax(makeFunc(identifier: .identifier("f"))) try expectations(actual.findFirstDifference(baseline: expected)) - let matcher = try SubtreeMatcher("struct A { 1️⃣func f() { } }", parse: parse) + let matcher = SubtreeMatcher("struct A { 1️⃣func f() { } }", parse: parse) try expectations(matcher.findFirstDifference(baseline: expected)) } @@ -69,7 +69,7 @@ public class SyntaxComparisonTests: XCTestCase { let actual = Syntax(makeFunc(identifier: .identifier("g"))) try expectations(actual.findFirstDifference(baseline: expected)) - let matcher = try SubtreeMatcher("struct A { 1️⃣func g() { } }", parse: parse) + let matcher = SubtreeMatcher("struct A { 1️⃣func g() { } }", parse: parse) try expectations(matcher.findFirstDifference(afterMarker: "1️⃣", baseline: expected)) } @@ -86,7 +86,7 @@ public class SyntaxComparisonTests: XCTestCase { XCTAssertNil(actual.findFirstDifference(baseline: expected)) try expectations(actual.findFirstDifference(baseline: expected, includeTrivia: true)) - let matcher = try SubtreeMatcher("struct A {func f() { }}", parse: parse) + let matcher = SubtreeMatcher("struct A {func f() { }}", parse: parse) try XCTAssertNil(matcher.findFirstDifference(baseline: expected)) try expectations(matcher.findFirstDifference(baseline: expected, includeTrivia: true)) } @@ -112,7 +112,7 @@ public class SyntaxComparisonTests: XCTestCase { let actual = Syntax(makeFunc(identifier: .identifier("f"))) try expectations(actual.findFirstDifference(baseline: expected)) - let matcher = try SubtreeMatcher("struct A { func f() { } }", parse: parse) + let matcher = SubtreeMatcher("struct A { func f() { } }", parse: parse) try expectations(matcher.findFirstDifference(baseline: expected)) } @@ -126,7 +126,7 @@ public class SyntaxComparisonTests: XCTestCase { let actual = Syntax(makeFunc(identifier: .identifier("f"))) try expectations(actual.findFirstDifference(baseline: expected)) - let matcher = try SubtreeMatcher("struct A { func f() { } }", parse: parse) + let matcher = SubtreeMatcher("struct A { func f() { } }", parse: parse) try expectations(matcher.findFirstDifference(baseline: expected)) } @@ -140,7 +140,7 @@ public class SyntaxComparisonTests: XCTestCase { let actual = Syntax(makeFunc(identifier: .identifier("f"), body: makeBody(statementCount: 1))) try expectations(actual.findFirstDifference(baseline: expected)) - let matcher = try SubtreeMatcher( + let matcher = SubtreeMatcher( """ struct A { func f() { @@ -157,7 +157,7 @@ public class SyntaxComparisonTests: XCTestCase { let expectedFunc = Syntax(makeFunc(identifier: .identifier("f"))) let expectedBody = Syntax(makeBody()) - let matcher = try SubtreeMatcher( + let matcher = SubtreeMatcher( """ struct A { 1️⃣ diff --git a/build-script.py b/build-script.py index 017311297e9..303d479db3c 100755 --- a/build-script.py +++ b/build-script.py @@ -502,7 +502,6 @@ def build_command(args: argparse.Namespace) -> None: # Until rdar://53881101 is implemented, we cannot request a build of multiple # targets simultaneously. For now, just build one product after the other. builder.buildProduct("SwiftSyntax") - builder.buildProduct("SwiftSyntaxParser") builder.buildProduct("SwiftSyntaxBuilder") # Build examples From 8d687086576aea8fe349c688d8e99fc543ba809f Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Mon, 17 Apr 2023 17:41:04 -0700 Subject: [PATCH 22/22] Re-generate code-generated files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cherry-picking caused a few codegen’d files to be out-of-date. Re-generate them now. --- .../SwiftSyntax/generated/ChildNameForKeyPath.swift | 8 ++------ .../generated/raw/RawSyntaxValidation.swift | 10 +--------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift b/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift index 53d80138d05..c1d0c1035d4 100644 --- a/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift +++ b/Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift @@ -1712,12 +1712,8 @@ internal func childName(_ keyPath: AnyKeyPath) -> String? { return "rightOperand" case \InfixOperatorExprSyntax.unexpectedAfterRightOperand: return "unexpectedAfterRightOperand" - case \InheritedTypeSyntax.unexpectedBeforeHasWithout: - return "unexpectedBeforeHasWithout" - case \InheritedTypeSyntax.hasWithout: - return "hasWithout" - case \InheritedTypeSyntax.unexpectedBetweenHasWithoutAndTypeName: - return "unexpectedBetweenHasWithoutAndTypeName" + case \InheritedTypeSyntax.unexpectedBeforeTypeName: + return "unexpectedBeforeTypeName" case \InheritedTypeSyntax.typeName: return "typeName" case \InheritedTypeSyntax.unexpectedBetweenTypeNameAndTrailingComma: diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index 821ffb2db6d..4f6426b6634 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -17,7 +17,7 @@ /// Note that this only validates the immediate children. /// Results in an assertion failure if the layout is invalid. func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { - #if DEBUG + #if SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION enum TokenChoice: CustomStringConvertible { case keyword(StaticString) case tokenKind(RawTokenKind) @@ -140,7 +140,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. - #if VALIDATE_TOKEN_CHOICES if raw != nil { return verify( raw, @@ -151,9 +150,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { ) } return nil - #else - return verify(raw, as: RawTokenSyntax?.self) - #endif } func verify( _ raw: RawSyntax?, @@ -166,7 +162,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { // the list of expected token choices in the syntax tree doesn't match those // the parser generates. Disable the verification for now until all issues // regarding it are fixed. - #if VALIDATE_TOKEN_CHOICES guard let raw = raw else { return .expectedNonNil(expectedKind: RawTokenSyntax.self, file: file, line: line) } @@ -193,9 +188,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { file: file, line: line ) - #else - return verify(raw, as: RawTokenSyntax.self) - #endif } func assertNoError(_ nodeKind: SyntaxKind, _ index: Int, _ error: ValidationError?) { if let error = error {