diff --git a/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift b/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift index 96df96c377a..31a139d954d 100644 --- a/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift @@ -180,8 +180,7 @@ public let AVAILABILITY_NODES: [Node] = [ Child( name: "Components", kind: .collection(kind: .versionComponentList, collectionElementName: "VersionComponent"), - documentation: "Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0`", - isOptional: true + documentation: "Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0`" ), ] ), diff --git a/CodeGeneration/Sources/SyntaxSupport/Child.swift b/CodeGeneration/Sources/SyntaxSupport/Child.swift index 53360817d14..2d6493bc6b0 100644 --- a/CodeGeneration/Sources/SyntaxSupport/Child.swift +++ b/CodeGeneration/Sources/SyntaxSupport/Child.swift @@ -32,7 +32,7 @@ public enum ChildKind { /// The child always contains a node that matches one of the `choices`. case nodeChoices(choices: [Child]) /// The child is a collection of `kind`. - case collection(kind: SyntaxNodeKind, collectionElementName: String, deprecatedCollectionElementName: String? = nil) + case collection(kind: SyntaxNodeKind, collectionElementName: String, defaultsToEmpty: Bool = false, deprecatedCollectionElementName: String? = nil) /// The child is a token that matches one of the given `choices`. /// If `requiresLeadingSpace` or `requiresTrailingSpace` is not `nil`, it /// overrides the default leading/trailing space behavior of the token. @@ -91,7 +91,7 @@ public class Child { return kind case .nodeChoices: return .syntax - case .collection(kind: let kind, _, _): + case .collection(kind: let kind, _, _, _): return kind case .token: return .token @@ -150,7 +150,7 @@ public class Child { /// Whether this child has syntax kind `UnexpectedNodes`. public var isUnexpectedNodes: Bool { switch kind { - case .collection(kind: .unexpectedNodes, _, _): + case .collection(kind: .unexpectedNodes, _, _, _): return true default: return false @@ -165,7 +165,7 @@ public class Child { return choices.isEmpty case .node(let kind): return kind.isBase - case .collection(let kind, _, _): + case .collection(kind: let kind, _, _, _): return kind.isBase case .token: return false diff --git a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift index d5ba294bed9..dfd68452065 100644 --- a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift @@ -166,15 +166,13 @@ public let COMMON_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - documentation: "If there were standalone attributes without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these.", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + documentation: "If there were standalone attributes without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - documentation: "If there were standalone modifiers without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these.", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + documentation: "If there were standalone modifiers without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these." ), Child( name: "Placeholder", diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift index 33e776dfd7e..3dd860dad75 100644 --- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift @@ -84,9 +84,8 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifier", @@ -186,15 +185,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "ActorKeyword", @@ -276,17 +273,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "Attributes attached to the associated type declaration.", - isOptional: true + documentation: "Attributes attached to the associated type declaration." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "Modifiers attached to the associated type declaration.", - isOptional: true + documentation: "Modifiers attached to the associated type declaration." ), Child( name: "AssociatedtypeKeyword", @@ -368,17 +363,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "Attributes attached to the class declaration, such as an `@available` attribute.", - isOptional: true + documentation: "Attributes attached to the class declaration, such as an `@available` attribute." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "Modifiers attached to the class declaration, such as `public`.", - isOptional: true + documentation: "Modifiers attached to the class declaration, such as `public`." ), Child( name: "ClassKeyword", @@ -518,17 +511,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "Attributes that are attached to the deinitializer.", - isOptional: true + documentation: "Attributes that are attached to the deinitializer." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "Modifiers that are attached to the deinitializer.", - isOptional: true + documentation: "Modifiers that are attached to the deinitializer." ), Child( name: "DeinitKeyword", @@ -588,15 +579,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - documentation: "If there were attributes before the editor placeholder, the ``EditorPlaceholderDeclSyntax`` will contain these.", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + documentation: "If there were attributes before the editor placeholder, the ``EditorPlaceholderDeclSyntax`` will contain these." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - documentation: "If there were modifiers before the editor placeholder, the `EditorPlaceholderDecl` will contain these.", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + documentation: "If there were modifiers before the editor placeholder, the `EditorPlaceholderDecl` will contain these." ), Child( name: "Placeholder", @@ -653,9 +642,8 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "FirstName", @@ -708,17 +696,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "The attributes applied to the case declaration.", - isOptional: true + documentation: "The attributes applied to the case declaration." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "The declaration modifiers applied to the case declaration.", - isOptional: true + documentation: "The declaration modifiers applied to the case declaration." ), Child( name: "CaseKeyword", @@ -795,17 +781,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "The attributes applied to the enum declaration.", - isOptional: true + documentation: "The attributes applied to the enum declaration." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "The declaration modifiers applied to the enum declaration.", - isOptional: true + documentation: "The declaration modifiers applied to the enum declaration." ), Child( name: "EnumKeyword", @@ -867,15 +851,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "ExtensionKeyword", @@ -918,15 +900,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "FuncKeyword", @@ -988,15 +968,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "FirstName", @@ -1156,17 +1134,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "Attributes attached to the import declaration, for example `@testable`.", - isOptional: true + documentation: "Attributes attached to the import declaration, for example `@testable`." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "Modifiers attached to the import declaration. Currently, no modifiers are supported by Swift.", - isOptional: true + documentation: "Modifiers attached to the import declaration. Currently, no modifiers are supported by Swift." ), Child( name: "ImportKeyword", @@ -1272,17 +1248,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "Attributes that are attached to the initializer.", - isOptional: true + documentation: "Attributes that are attached to the initializer." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "Modifiers attached to the initializer", - isOptional: true + documentation: "Modifiers attached to the initializer" ), Child( name: "InitKeyword", @@ -1341,15 +1315,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "MacroKeyword", @@ -1401,15 +1373,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "Pound", @@ -1450,8 +1420,7 @@ public let DECL_NODES: [Node] = [ ), Child( name: "AdditionalTrailingClosures", - kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure"), - isOptional: true + kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure", defaultsToEmpty: true) ), ] ), @@ -1843,17 +1812,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "The attributes applied to the 'precedencegroup' declaration.", - isOptional: true + documentation: "The attributes applied to the 'precedencegroup' declaration." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "The declaration modifiers applied to the 'precedencegroup' declaration.", - isOptional: true + documentation: "The declaration modifiers applied to the 'precedencegroup' declaration." ), Child( name: "PrecedencegroupKeyword", @@ -1960,17 +1927,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "Attributes attached to the protocol declaration, such as an `@available` attribute.", - isOptional: true + documentation: "Attributes attached to the protocol declaration, such as an `@available` attribute." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "Modifiers attached to the protocol declaration, such as `public`.", - isOptional: true + documentation: "Modifiers attached to the protocol declaration, such as `public`." ), Child( name: "ProtocolKeyword", @@ -2132,17 +2097,15 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), nameForDiagnostics: "attributes", - documentation: "Attributes that are attached to the struct declaration.", - isOptional: true + documentation: "Attributes that are attached to the struct declaration." ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), nameForDiagnostics: "modifiers", - documentation: "Modifiers that are attached to the struct declaration.", - isOptional: true + documentation: "Modifiers that are attached to the struct declaration." ), Child( name: "StructKeyword", @@ -2197,15 +2160,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "SubscriptKeyword", @@ -2297,15 +2258,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "TypealiasKeyword", @@ -2354,15 +2313,13 @@ public let DECL_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "BindingSpecifier", diff --git a/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift b/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift index 6840d714c1f..8d421ae77c4 100644 --- a/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift @@ -354,8 +354,7 @@ public let EXPR_NODES: [Node] = [ ), Child( name: "Items", - kind: .collection(kind: .closureCaptureList, collectionElementName: "Item"), - isOptional: true + kind: .collection(kind: .closureCaptureList, collectionElementName: "Item") ), Child( name: "RightSquare", @@ -373,15 +372,13 @@ public let EXPR_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Modifiers", - kind: .collection(kind: .declModifierList, collectionElementName: "Modifier"), - nameForDiagnostics: "modifiers", - isOptional: true + kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true), + nameForDiagnostics: "modifiers" ), Child( name: "FirstName", @@ -526,9 +523,8 @@ public let EXPR_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - nameForDiagnostics: "attributes", - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true), + nameForDiagnostics: "attributes" ), Child( name: "Capture", @@ -828,9 +824,8 @@ public let EXPR_NODES: [Node] = [ ), Child( name: "AdditionalTrailingClosures", - kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure"), - nameForDiagnostics: "trailing closures", - isOptional: true + kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure", defaultsToEmpty: true), + nameForDiagnostics: "trailing closures" ), ] ), @@ -1179,8 +1174,7 @@ public let EXPR_NODES: [Node] = [ ), Child( name: "AdditionalTrailingClosures", - kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure"), - isOptional: true + kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure", defaultsToEmpty: true) ), ] ), @@ -1583,9 +1577,8 @@ public let EXPR_NODES: [Node] = [ ), Child( name: "AdditionalTrailingClosures", - kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure"), - nameForDiagnostics: "trailing closures", - isOptional: true + kind: .collection(kind: .multipleTrailingClosureElementList, collectionElementName: "AdditionalTrailingClosure", defaultsToEmpty: true), + nameForDiagnostics: "trailing closures" ), ] ), diff --git a/CodeGeneration/Sources/SyntaxSupport/GenericNodes.swift b/CodeGeneration/Sources/SyntaxSupport/GenericNodes.swift index 997956130d3..4934f2b798e 100644 --- a/CodeGeneration/Sources/SyntaxSupport/GenericNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/GenericNodes.swift @@ -90,8 +90,7 @@ public let GENERIC_NODES: [Node] = [ children: [ Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true) ), Child( name: "EachKeyword", diff --git a/CodeGeneration/Sources/SyntaxSupport/GrammarGenerator.swift b/CodeGeneration/Sources/SyntaxSupport/GrammarGenerator.swift index 283a0f91dc4..421a8462aa9 100644 --- a/CodeGeneration/Sources/SyntaxSupport/GrammarGenerator.swift +++ b/CodeGeneration/Sources/SyntaxSupport/GrammarGenerator.swift @@ -36,7 +36,7 @@ struct GrammarGenerator { case .nodeChoices(let choices): let choicesDescriptions = choices.map { grammar(for: $0) } return "(\(choicesDescriptions.joined(separator: " | ")))\(optionality)" - case .collection(let kind, _, _): + case .collection(kind: let kind, _, _, _): return "``\(kind.syntaxType)``" case .token(let choices, _, _): if choices.count == 1 { diff --git a/CodeGeneration/Sources/SyntaxSupport/Node.swift b/CodeGeneration/Sources/SyntaxSupport/Node.swift index 4bd81cc6f33..5728e968c67 100644 --- a/CodeGeneration/Sources/SyntaxSupport/Node.swift +++ b/CodeGeneration/Sources/SyntaxSupport/Node.swift @@ -367,7 +367,7 @@ fileprivate extension Child { return [kind] case .nodeChoices(let choices): return choices.flatMap(\.kinds) - case .collection(let kind, _, _): + case .collection(kind: let kind, _, _, _): return [kind] case .token: return [.token] diff --git a/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift b/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift index 927b06f43ba..0b704c4f7f3 100644 --- a/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift @@ -86,8 +86,7 @@ public let STMT_NODES: [Node] = [ ), Child( name: "CatchItems", - kind: .collection(kind: .catchItemList, collectionElementName: "CatchItem"), - isOptional: true + kind: .collection(kind: .catchItemList, collectionElementName: "CatchItem", defaultsToEmpty: true) ), Child( name: "Body", @@ -240,8 +239,7 @@ public let STMT_NODES: [Node] = [ ), Child( name: "CatchClauses", - kind: .collection(kind: .catchClauseList, collectionElementName: "CatchClause"), - isOptional: true + kind: .collection(kind: .catchClauseList, collectionElementName: "CatchClause", defaultsToEmpty: true) ), ] ), diff --git a/CodeGeneration/Sources/SyntaxSupport/Traits.swift b/CodeGeneration/Sources/SyntaxSupport/Traits.swift index b2570ee1962..ec354825034 100644 --- a/CodeGeneration/Sources/SyntaxSupport/Traits.swift +++ b/CodeGeneration/Sources/SyntaxSupport/Traits.swift @@ -37,8 +37,8 @@ public let TRAITS: [Trait] = [ Trait( traitName: "DeclGroup", children: [ - Child(name: "Attributes", kind: .node(kind: .attributeList), isOptional: true), - Child(name: "Modifiers", kind: .node(kind: .declModifierList), isOptional: true), + Child(name: "Attributes", kind: .node(kind: .attributeList)), + Child(name: "Modifiers", kind: .node(kind: .declModifierList)), Child(name: "InheritanceClause", kind: .node(kind: .inheritanceClause), isOptional: true), Child( name: "GenericWhereClause", @@ -69,7 +69,7 @@ public let TRAITS: [Trait] = [ Child(name: "ArgumentList", kind: .node(kind: .labeledExprList)), Child(name: "RightParen", kind: .token(choices: [.token(.rightParen)]), isOptional: true), Child(name: "TrailingClosure", kind: .node(kind: .closureExpr), isOptional: true), - Child(name: "AdditionalTrailingClosures", kind: .node(kind: .multipleTrailingClosureElementList), isOptional: true), + Child(name: "AdditionalTrailingClosures", kind: .node(kind: .multipleTrailingClosureElementList)), ] ), Trait( @@ -105,7 +105,7 @@ public let TRAITS: [Trait] = [ Trait( traitName: "WithAttributes", children: [ - Child(name: "Attributes", kind: .node(kind: .attributeList), isOptional: true) + Child(name: "Attributes", kind: .node(kind: .attributeList)) ] ), Trait( @@ -140,7 +140,7 @@ public let TRAITS: [Trait] = [ Trait( traitName: "WithModifiers", children: [ - Child(name: "Modifiers", kind: .node(kind: .declModifierList), isOptional: true) + Child(name: "Modifiers", kind: .node(kind: .declModifierList)) ] ), Trait( diff --git a/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift b/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift index 80bf53d5900..1e826848fd5 100644 --- a/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift @@ -60,8 +60,7 @@ public let TYPE_NODES: [Node] = [ ), Child( name: "Attributes", - kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - isOptional: true + kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true) ), Child( name: "BaseType", diff --git a/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift b/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift index 7b70ed78bee..c33653f7d4a 100644 --- a/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift +++ b/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift @@ -33,7 +33,7 @@ public extension Child { buildableKind = .node(kind: kind) case .nodeChoices: buildableKind = .node(kind: .syntax) - case .collection(let kind, _, _): + case .collection(kind: let kind, _, _, _): buildableKind = .node(kind: kind) case .token: buildableKind = .token(self.tokenKind!) @@ -65,6 +65,9 @@ public extension Child { return ExprSyntax("nil") } } + if case .collection(_, _, defaultsToEmpty: true, _) = kind { + return ExprSyntax("[]") + } guard let token = token, isToken else { return type.defaultValue } diff --git a/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift b/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift index 11ce3f445c2..1a9ba2184d7 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift @@ -120,7 +120,6 @@ struct GenerateSwiftSyntax: ParsableCommand { GeneratedFileSpec(swiftSyntaxGeneratedDir + ["TriviaPieces.swift"], triviaPiecesFile), // SwiftSyntaxBuilder - GeneratedFileSpec(swiftSyntaxBuilderGeneratedDir + ["BuildableCollectionNodes.swift"], buildableCollectionNodesFile), GeneratedFileSpec(swiftSyntaxBuilderGeneratedDir + ["BuildableNodes.swift"], buildableNodesFile), GeneratedFileSpec(swiftSyntaxBuilderGeneratedDir + ["ResultBuilders.swift"], resultBuildersFile), GeneratedFileSpec( diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/ParserEntryFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/ParserEntryFile.swift index c982516f477..d4d5b3e45f3 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/ParserEntryFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/ParserEntryFile.swift @@ -57,7 +57,15 @@ let parserEntryFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { // The missing item is not necessary to be a declaration, // which is just a placeholder here return RawCodeBlockItemSyntax( - item: .decl(RawDeclSyntax(RawMissingDeclSyntax(attributes: nil, modifiers: nil, arena: self.arena))), + item: .decl( + RawDeclSyntax( + RawMissingDeclSyntax( + attributes: self.emptyCollection(RawAttributeListSyntax.self), + modifiers: self.emptyCollection(RawDeclModifierListSyntax.self), + arena: self.arena + ) + ) + ), semicolon: nil, arena: self.arena ) diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RenamedChildrenCompatibilityFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RenamedChildrenCompatibilityFile.swift index 33cb492a96f..c490be7f7cb 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RenamedChildrenCompatibilityFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RenamedChildrenCompatibilityFile.swift @@ -38,7 +38,8 @@ let renamedChildrenCompatibilityFile = try! SourceFileSyntax(leadingTrivia: copy ) if let childNode = SYNTAX_NODE_MAP[child.syntaxNodeKind]?.collectionNode, !child.isUnexpectedNodes, - case .collection(_, let collectionElementName, let deprecatedCollectionElementName) = child.kind, + case .collection(_, collectionElementName: let collectionElementName, _, deprecatedCollectionElementName: let deprecatedCollectionElementName) = + child.kind, let deprecatedCollectionElementName { let childEltType = childNode.collectionElementType.syntaxBaseName diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift index 666136cc9f3..9a55078c94c 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift @@ -193,7 +193,7 @@ func syntaxNode(emitKind: SyntaxNodeKind) -> SourceFileSyntax { // If needed, this could be added in the future, but for now withUnexpected should be sufficient. if let childNode = SYNTAX_NODE_MAP[child.syntaxNodeKind]?.collectionNode, !child.isUnexpectedNodes, - case .collection(_, let childElt, _) = child.kind + case .collection(_, collectionElementName: let childElt, _, _) = child.kind { let childEltType = childNode.collectionElementType.syntaxBaseName diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableCollectionNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableCollectionNodesFile.swift deleted file mode 100644 index 3648d3da8ef..00000000000 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableCollectionNodesFile.swift +++ /dev/null @@ -1,60 +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 -import SwiftBasicFormat - -let buildableCollectionNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) { - DeclSyntax("import SwiftSyntax") - - for node in SYNTAX_NODES.compactMap(\.collectionNode) { - let elementType = node.collectionElementType - - try! ExtensionDeclSyntax( - """ - extension \(raw: node.type.syntaxBaseName): ExpressibleByArrayLiteral - """ - ) { - // Generate initializers - if elementType.isBaseType && node.elementChoices.count == 1 { - DeclSyntax( - """ - public init(_ elements: \(ArrayTypeSyntax(element: elementType.parameterType))) { - self = \(raw: node.type.syntaxBaseName)(elements.map { - \(elementType.syntax)(fromProtocol: $0) - } as [\(elementType.syntax)]) - } - """ - ) - - DeclSyntax( - """ - public init(arrayLiteral elements: \(elementType.parameterType)...) { - self.init(elements) - } - """ - ) - } else { - DeclSyntax( - """ - public init(arrayLiteral elements: Element...) { - self.init(elements) - } - """ - ) - } - } - } -} diff --git a/CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift b/CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift index 22c1ed2cdd1..bac83f2773c 100644 --- a/CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift +++ b/CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift @@ -56,13 +56,13 @@ fileprivate extension ChildKind { return kind == otherKind case (.nodeChoices(let choices), .nodeChoices(let otherChoices)): return choices.count == otherChoices.count && zip(choices, otherChoices).allSatisfy { $0.hasSameType(as: $1) } - case (.collection(let kind, _, _), .collection(let otherKind, _, _)): + case (.collection(kind: let kind, _, _, _), .collection(kind: let otherKind, _, _, _)): return kind == otherKind case (.token(let choices, _, _), .token(let otherChoices, _, _)): return choices == otherChoices - case (.node(let kind), .collection(let otherKind, _, _)): + case (.node(let kind), .collection(kind: let otherKind, _, _, _)): return kind == otherKind - case (.collection(let kind, _, _), .node(let otherKind)): + case (.collection(kind: let kind, _, _, _), .node(let otherKind)): return kind == otherKind default: return false @@ -760,4 +760,23 @@ class ValidateSyntaxNodes: XCTestCase { assertFailuresMatchXFails(failures, expectedFailures: []) } + + func testNoOptionalSyntaxCollections() { + var failures: [ValidationFailure] = [] + + for node in SYNTAX_NODES.compactMap(\.layoutNode) { + for child in node.children { + if case .collection = child.kind, child.isOptional, !child.isUnexpectedNodes { + failures.append( + ValidationFailure( + node: node.kind, + message: "child '\(child.name)' is an optional syntax collection. All syntax collections should be non-optional." + ) + ) + } + } + } + + assertFailuresMatchXFails(failures, expectedFailures: []) + } } diff --git a/Sources/SwiftParser/Attributes.swift b/Sources/SwiftParser/Attributes.swift index 2b74e7e58dc..1f2267b9360 100644 --- a/Sources/SwiftParser/Attributes.swift +++ b/Sources/SwiftParser/Attributes.swift @@ -13,9 +13,9 @@ @_spi(RawSyntax) import SwiftSyntax extension Parser { - mutating func parseAttributeList() -> RawAttributeListSyntax? { + mutating func parseAttributeList() -> RawAttributeListSyntax { guard self.at(.atSign, .poundIf) else { - return nil + return self.emptyCollection(RawAttributeListSyntax.self) } var elements = [RawAttributeListSyntax.Element]() diff --git a/Sources/SwiftParser/Availability.swift b/Sources/SwiftParser/Availability.swift index 4dc2696359c..ac144c45187 100644 --- a/Sources/SwiftParser/Availability.swift +++ b/Sources/SwiftParser/Availability.swift @@ -298,7 +298,7 @@ extension Parser { let unexpectedAfterComponents = self.parseUnexpectedVersionTokens() return RawVersionTupleSyntax( major: major, - components: nil, + components: RawVersionComponentListSyntax(elements: [], arena: self.arena), unexpectedAfterComponents, arena: self.arena ) diff --git a/Sources/SwiftParser/CollectionNodes+Parsable.swift b/Sources/SwiftParser/CollectionNodes+Parsable.swift index a3b75e47f4d..900607b0e12 100644 --- a/Sources/SwiftParser/CollectionNodes+Parsable.swift +++ b/Sources/SwiftParser/CollectionNodes+Parsable.swift @@ -58,7 +58,7 @@ extension AccessorDeclListSyntax: SyntaxParseable { return parser.parseAccessorList() ?? RawAccessorDeclListSyntax(elements: [], arena: parser.arena) } makeMissing: { remainingTokens, arena in return RawAccessorDeclSyntax( - attributes: nil, + attributes: RawAttributeListSyntax(elements: [], arena: arena), modifier: nil, accessorSpecifier: RawTokenSyntax(missing: .keyword, text: "get", arena: arena), parameters: nil, @@ -73,8 +73,7 @@ extension AccessorDeclListSyntax: SyntaxParseable { extension AttributeListSyntax: SyntaxParseable { public static func parse(from parser: inout Parser) -> Self { return parse(from: &parser) { parser in - let node = parser.parseAttributeList() ?? RawAttributeListSyntax(elements: [], arena: parser.arena) - return RawSyntax(node) + return RawSyntax(parser.parseAttributeList()) } makeMissing: { remainingTokens, arena in return RawAttributeSyntax( atSign: RawTokenSyntax(missing: .atSign, arena: arena), @@ -106,8 +105,8 @@ extension MemberBlockItemListSyntax: SyntaxParseable { return RawSyntax(parser.parseMemberDeclList()) } makeMissing: { remainingTokens, arena in let missingDecl = RawMissingDeclSyntax( - attributes: nil, - modifiers: nil, + attributes: RawAttributeListSyntax(elements: [], arena: arena), + modifiers: RawDeclModifierListSyntax(elements: [], arena: arena), placeholder: RawTokenSyntax(missing: .identifier, text: "<#declaration#>", arena: arena), RawUnexpectedNodesSyntax(remainingTokens, arena: arena), arena: arena diff --git a/Sources/SwiftParser/Declarations.swift b/Sources/SwiftParser/Declarations.swift index ed1b8384b52..8a34be055e3 100644 --- a/Sources/SwiftParser/Declarations.swift +++ b/Sources/SwiftParser/Declarations.swift @@ -157,10 +157,10 @@ extension TokenConsumer { extension Parser { struct DeclAttributes { - var attributes: RawAttributeListSyntax? - var modifiers: RawDeclModifierListSyntax? + var attributes: RawAttributeListSyntax + var modifiers: RawDeclModifierListSyntax - init(attributes: RawAttributeListSyntax?, modifiers: RawDeclModifierListSyntax?) { + init(attributes: RawAttributeListSyntax, modifiers: RawDeclModifierListSyntax) { self.attributes = attributes self.modifiers = modifiers } @@ -393,7 +393,7 @@ extension Parser { var each = self.consume(if: .keyword(.each)) let (unexpectedBetweenEachAndName, name) = self.expectIdentifier(allowSelfOrCapitalSelfAsIdentifier: true) - if attributes == nil && each == nil && unexpectedBetweenEachAndName == nil && name.isMissing && elements.isEmpty && !self.at(prefix: ">") { + if attributes.isEmpty && each == nil && unexpectedBetweenEachAndName == nil && name.isMissing && elements.isEmpty && !self.at(prefix: ">") { break } @@ -676,7 +676,13 @@ extension Parser { if let remainingTokens = remainingTokensIfMaximumNestingLevelReached() { let item = RawMemberBlockItemSyntax( remainingTokens, - decl: RawDeclSyntax(RawMissingDeclSyntax(attributes: nil, modifiers: nil, arena: self.arena)), + decl: RawDeclSyntax( + RawMissingDeclSyntax( + attributes: self.emptyCollection(RawAttributeListSyntax.self), + modifiers: self.emptyCollection(RawDeclModifierListSyntax.self), + arena: self.arena + ) + ), semicolon: nil, arena: self.arena ) @@ -1295,7 +1301,7 @@ extension Parser { } struct AccessorIntroducer { - var attributes: RawAttributeListSyntax? + var attributes: RawAttributeListSyntax var modifier: RawDeclModifierSyntax? var kind: AccessorDeclSyntax.AccessorSpecifierOptions var unexpectedBeforeToken: RawUnexpectedNodesSyntax? @@ -1527,38 +1533,37 @@ extension Parser { } } - var unexpectedBeforeFixity = RawUnexpectedNodesSyntax(attrs.attributes?.elements ?? [], arena: self.arena) + var unexpectedBeforeFixity = RawUnexpectedNodesSyntax(attrs.attributes.elements, arena: self.arena) var fixity: RawTokenSyntax? var unexpectedAfterFixity: RawUnexpectedNodesSyntax? - if let modifiers = attrs.modifiers?.elements { - if let firstFixityIndex = modifiers.firstIndex(where: { isFixity($0) }) { - let fixityModifier = modifiers[firstFixityIndex] - fixity = fixityModifier.name + let modifiers = attrs.modifiers.elements + if let firstFixityIndex = modifiers.firstIndex(where: { isFixity($0) }) { + let fixityModifier = modifiers[firstFixityIndex] + fixity = fixityModifier.name - unexpectedBeforeFixity = RawUnexpectedNodesSyntax( - combining: unexpectedBeforeFixity, - RawUnexpectedNodesSyntax(Array(modifiers[0.. (RawClosureExprSyntax, RawMultipleTrailingClosureElementListSyntax?) { + mutating func parseTrailingClosures(_ flavor: ExprFlavor) -> (RawClosureExprSyntax, RawMultipleTrailingClosureElementListSyntax) { // Parse the closure. let closure = self.parseClosureExpression() @@ -1931,7 +1931,10 @@ extension Parser { ) } - let trailing = elements.isEmpty ? nil : RawMultipleTrailingClosureElementListSyntax(elements: elements, arena: self.arena) + let trailing = + elements.isEmpty + ? self.emptyCollection(RawMultipleTrailingClosureElementListSyntax.self) + : RawMultipleTrailingClosureElementListSyntax(elements: elements, arena: self.arena) return (closure, trailing) } } diff --git a/Sources/SwiftParser/Modifiers.swift b/Sources/SwiftParser/Modifiers.swift index bc497e70800..48a32971166 100644 --- a/Sources/SwiftParser/Modifiers.swift +++ b/Sources/SwiftParser/Modifiers.swift @@ -13,7 +13,7 @@ @_spi(RawSyntax) import SwiftSyntax extension Parser { - mutating func parseDeclModifierList() -> RawDeclModifierListSyntax? { + mutating func parseDeclModifierList() -> RawDeclModifierListSyntax { var elements = [RawDeclModifierSyntax]() var modifierLoopProgress = LoopProgressCondition() MODIFIER_LOOP: while self.hasProgressed(&modifierLoopProgress) { @@ -93,7 +93,7 @@ extension Parser { break MODIFIER_LOOP } } - return elements.isEmpty ? nil : RawDeclModifierListSyntax(elements: elements, arena: arena) + return elements.isEmpty ? self.emptyCollection(RawDeclModifierListSyntax.self) : RawDeclModifierListSyntax(elements: elements, arena: arena) } } diff --git a/Sources/SwiftParser/Nominals.swift b/Sources/SwiftParser/Nominals.swift index 4c8b7a67138..7e65bea5068 100644 --- a/Sources/SwiftParser/Nominals.swift +++ b/Sources/SwiftParser/Nominals.swift @@ -16,8 +16,8 @@ protocol NominalTypeDeclarationTrait { associatedtype PrimaryOrGenerics init( - attributes: RawAttributeListSyntax?, - modifiers: RawDeclModifierListSyntax?, + attributes: RawAttributeListSyntax, + modifiers: RawDeclModifierListSyntax, _ unexpectedBeforeIntroducerKeyword: RawUnexpectedNodesSyntax?, introducerKeyword: RawTokenSyntax, _ unexpectedBeforeIdentifier: RawUnexpectedNodesSyntax?, @@ -34,8 +34,8 @@ protocol NominalTypeDeclarationTrait { extension RawProtocolDeclSyntax: NominalTypeDeclarationTrait { init( - attributes: RawAttributeListSyntax?, - modifiers: RawDeclModifierListSyntax?, + attributes: RawAttributeListSyntax, + modifiers: RawDeclModifierListSyntax, _ unexpectedBeforeIntroducerKeyword: RawUnexpectedNodesSyntax?, introducerKeyword: RawTokenSyntax, _ unexpectedBeforeIdentifier: RawUnexpectedNodesSyntax?, @@ -68,8 +68,8 @@ extension RawProtocolDeclSyntax: NominalTypeDeclarationTrait { extension RawClassDeclSyntax: NominalTypeDeclarationTrait { init( - attributes: RawAttributeListSyntax?, - modifiers: RawDeclModifierListSyntax?, + attributes: RawAttributeListSyntax, + modifiers: RawDeclModifierListSyntax, _ unexpectedBeforeIntroducerKeyword: RawUnexpectedNodesSyntax?, introducerKeyword: RawTokenSyntax, _ unexpectedBeforeIdentifier: RawUnexpectedNodesSyntax?, @@ -102,8 +102,8 @@ extension RawClassDeclSyntax: NominalTypeDeclarationTrait { extension RawActorDeclSyntax: NominalTypeDeclarationTrait { init( - attributes: RawAttributeListSyntax?, - modifiers: RawDeclModifierListSyntax?, + attributes: RawAttributeListSyntax, + modifiers: RawDeclModifierListSyntax, _ unexpectedBeforeIntroducerKeyword: RawUnexpectedNodesSyntax?, introducerKeyword: RawTokenSyntax, _ unexpectedBeforeIdentifier: RawUnexpectedNodesSyntax?, @@ -136,8 +136,8 @@ extension RawActorDeclSyntax: NominalTypeDeclarationTrait { extension RawStructDeclSyntax: NominalTypeDeclarationTrait { init( - attributes: RawAttributeListSyntax?, - modifiers: RawDeclModifierListSyntax?, + attributes: RawAttributeListSyntax, + modifiers: RawDeclModifierListSyntax, _ unexpectedBeforeIntroducerKeyword: RawUnexpectedNodesSyntax?, introducerKeyword: RawTokenSyntax, _ unexpectedBeforeIdentifier: RawUnexpectedNodesSyntax?, @@ -170,8 +170,8 @@ extension RawStructDeclSyntax: NominalTypeDeclarationTrait { extension RawEnumDeclSyntax: NominalTypeDeclarationTrait { init( - attributes: RawAttributeListSyntax?, - modifiers: RawDeclModifierListSyntax?, + attributes: RawAttributeListSyntax, + modifiers: RawDeclModifierListSyntax, _ unexpectedBeforeIntroducerKeyword: RawUnexpectedNodesSyntax?, introducerKeyword: RawTokenSyntax, _ unexpectedBeforeIdentifier: RawUnexpectedNodesSyntax?, diff --git a/Sources/SwiftParser/Parameters.swift b/Sources/SwiftParser/Parameters.swift index b8c0c7d2c24..b4e23a40771 100644 --- a/Sources/SwiftParser/Parameters.swift +++ b/Sources/SwiftParser/Parameters.swift @@ -234,7 +234,7 @@ extension Parser { // MARK: - Parameter Modifiers extension Parser { - mutating func parseParameterModifiers(isClosure: Bool) -> RawDeclModifierListSyntax? { + mutating func parseParameterModifiers(isClosure: Bool) -> RawDeclModifierListSyntax { var elements = [RawDeclModifierSyntax]() var loopProgress = LoopProgressCondition() MODIFIER_LOOP: while self.hasProgressed(&loopProgress) { @@ -248,7 +248,7 @@ extension Parser { } } if elements.isEmpty { - return nil + return self.emptyCollection(RawDeclModifierListSyntax.self) } else { return RawDeclModifierListSyntax(elements: elements, arena: self.arena) } diff --git a/Sources/SwiftParser/Parser.swift b/Sources/SwiftParser/Parser.swift index 876b7d614cb..fe1f681b29c 100644 --- a/Sources/SwiftParser/Parser.swift +++ b/Sources/SwiftParser/Parser.swift @@ -129,6 +129,45 @@ public struct Parser { static let defaultMaximumNestingLevel = 256 #endif + var _emptyRawMultipleTrailingClosureElementListSyntax: RawMultipleTrailingClosureElementListSyntax? + + /// Create an empty collection of the given type. + /// + /// These empty collections are only created once and the same node is returned + /// on subsequent calls, reducing memory usage. + mutating func emptyCollection(_: RawMultipleTrailingClosureElementListSyntax.Type) -> RawMultipleTrailingClosureElementListSyntax { + if _emptyRawMultipleTrailingClosureElementListSyntax == nil { + _emptyRawMultipleTrailingClosureElementListSyntax = RawMultipleTrailingClosureElementListSyntax(elements: [], arena: self.arena) + } + return _emptyRawMultipleTrailingClosureElementListSyntax! + } + + var _emptyRawDeclModifierListSyntax: RawDeclModifierListSyntax? + + /// Create an empty collection of the given type. + /// + /// These empty collections are only created once and the same node is returned + /// on subsequent calls, reducing memory usage. + mutating func emptyCollection(_: RawDeclModifierListSyntax.Type) -> RawDeclModifierListSyntax { + if _emptyRawDeclModifierListSyntax == nil { + _emptyRawDeclModifierListSyntax = RawDeclModifierListSyntax(elements: [], arena: self.arena) + } + return _emptyRawDeclModifierListSyntax! + } + + var _emptyRawAttributeListSyntax: RawAttributeListSyntax? + + /// Create an empty collection of the given type. + /// + /// These empty collections are only created once and the same node is returned + /// on subsequent calls, reducing memory usage. + mutating func emptyCollection(_: RawAttributeListSyntax.Type) -> RawAttributeListSyntax { + if _emptyRawAttributeListSyntax == nil { + _emptyRawAttributeListSyntax = RawAttributeListSyntax(elements: [], arena: self.arena) + } + return _emptyRawAttributeListSyntax! + } + /// The delegated initializer for the parser. /// /// - Parameters diff --git a/Sources/SwiftParser/Statements.swift b/Sources/SwiftParser/Statements.swift index 7288500d37f..879c3b72303 100644 --- a/Sources/SwiftParser/Statements.swift +++ b/Sources/SwiftParser/Statements.swift @@ -384,7 +384,7 @@ extension Parser { unexpectedBeforeDoKeyword, doKeyword: doKeyword, body: body, - catchClauses: elements.isEmpty ? nil : RawCatchClauseListSyntax(elements: elements, arena: self.arena), + catchClauses: RawCatchClauseListSyntax(elements: elements, arena: self.arena), arena: self.arena ) } @@ -416,7 +416,7 @@ extension Parser { return RawCatchClauseSyntax( unexpectedBeforeCatchKeyword, catchKeyword: catchKeyword, - catchItems: catchItems.isEmpty ? nil : RawCatchItemListSyntax(elements: catchItems, arena: self.arena), + catchItems: RawCatchItemListSyntax(elements: catchItems, arena: self.arena), body: body, arena: self.arena ) diff --git a/Sources/SwiftParser/Types.swift b/Sources/SwiftParser/Types.swift index 506b61635c0..03f459cdfc0 100644 --- a/Sources/SwiftParser/Types.swift +++ b/Sources/SwiftParser/Types.swift @@ -100,7 +100,7 @@ extension Parser { ) } - if unexpectedBeforeAttrList != nil || specifier != nil || attrList != nil { + if unexpectedBeforeAttrList != nil || specifier != nil || !attrList.isEmpty { return RawTypeSyntax( RawAttributedTypeSyntax( specifier: specifier, @@ -862,7 +862,7 @@ extension Parser.Lookahead { extension Parser { mutating func parseTypeAttributeList(misplacedSpecifiers: [RawTokenSyntax] = []) -> ( - specifier: RawTokenSyntax?, unexpectedBeforeAttributes: RawUnexpectedNodesSyntax?, attributes: RawAttributeListSyntax? + specifier: RawTokenSyntax?, unexpectedBeforeAttributes: RawUnexpectedNodesSyntax?, attributes: RawAttributeListSyntax ) { var specifier: RawTokenSyntax? = nil if canHaveParameterSpecifier { @@ -889,7 +889,7 @@ extension Parser { return (specifier, unexpectedBeforeAttributeList, self.parseTypeAttributeListPresent()) } - return (specifier, unexpectedBeforeAttributeList, nil) + return (specifier, unexpectedBeforeAttributeList, self.emptyCollection(RawAttributeListSyntax.self)) } mutating func parseTypeAttributeListPresent() -> RawAttributeListSyntax { diff --git a/Sources/SwiftParser/generated/LayoutNodes+Parsable.swift b/Sources/SwiftParser/generated/LayoutNodes+Parsable.swift index 22dd88571c9..81cc422106e 100644 --- a/Sources/SwiftParser/generated/LayoutNodes+Parsable.swift +++ b/Sources/SwiftParser/generated/LayoutNodes+Parsable.swift @@ -330,7 +330,15 @@ fileprivate extension Parser { // The missing item is not necessary to be a declaration, // which is just a placeholder here return RawCodeBlockItemSyntax( - item: .decl(RawDeclSyntax(RawMissingDeclSyntax(attributes: nil, modifiers: nil, arena: self.arena))), + item: .decl( + RawDeclSyntax( + RawMissingDeclSyntax( + attributes: self.emptyCollection(RawAttributeListSyntax.self), + modifiers: self.emptyCollection(RawDeclModifierListSyntax.self), + arena: self.arena + ) + ) + ), semicolon: nil, arena: self.arena ) diff --git a/Sources/SwiftParserDiagnostics/MissingNodesError.swift b/Sources/SwiftParserDiagnostics/MissingNodesError.swift index 03f9a137d8d..b03a8fbae2b 100644 --- a/Sources/SwiftParserDiagnostics/MissingNodesError.swift +++ b/Sources/SwiftParserDiagnostics/MissingNodesError.swift @@ -251,9 +251,9 @@ public struct MissingNodesError: ParserError { return nil } if let missingDecl = firstMissingNode.as(MissingDeclSyntax.self) { - if let lastModifier = missingDecl.modifiers?.last { + if let lastModifier = missingDecl.modifiers.last { return "after '\(lastModifier.name.text)' modifier" - } else if missingDecl.attributes != nil { + } else if !missingDecl.attributes.isEmpty { return "after attribute" } } diff --git a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift index a8439b74148..a3bb0538744 100644 --- a/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift +++ b/Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift @@ -1926,8 +1926,8 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor { return .skipChildren } - if let modifiers = node.modifiers, modifiers.hasError { - for modifier in modifiers { + if node.modifiers.hasError { + for modifier in node.modifiers { guard let detail = modifier.detail else { continue } @@ -1986,19 +1986,17 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor { } if let unexpectedAfterComponents = node.unexpectedAfterComponents { - if let components = node.components, - unexpectedAfterComponents.allSatisfy({ $0.is(VersionComponentSyntax.self) }) - { + if unexpectedAfterComponents.allSatisfy({ $0.is(VersionComponentSyntax.self) }) { addDiagnostic( unexpectedAfterComponents, - TrailingVersionAreIgnored(major: node.major, components: components), + TrailingVersionAreIgnored(major: node.major, components: node.components), handledNodes: [unexpectedAfterComponents.id] ) } else { addDiagnostic( unexpectedAfterComponents, CannotParseVersionTuple(versionTuple: unexpectedAfterComponents), - handledNodes: [node.major.id, node.components?.id, unexpectedAfterComponents.id].compactMap { $0 } + handledNodes: [node.major.id, node.components.id, unexpectedAfterComponents.id] ) } } diff --git a/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift b/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift index a9b6e2276b2..6b43127801b 100644 --- a/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift +++ b/Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift @@ -511,7 +511,7 @@ public struct UnexpectedNodesError: ParserError { var message = "unexpected \(unexpectedNodes.shortSingleLineContentDescription)" if let parent = unexpectedNodes.parent { if let parentTypeName = parent.nodeTypeNameForDiagnostics(allowBlockNames: false), - parent.children(viewMode: .sourceAccurate).first?.id == unexpectedNodes.id + parent.children(viewMode: .sourceAccurate).first(where: { $0.totalLength.utf8Length > 0 })?.id == unexpectedNodes.id { message += " before \(parentTypeName)" } else if let parentTypeName = parent.ancestorOrSelf(mapping: { $0.nodeTypeNameForDiagnostics(allowBlockNames: false) }) { diff --git a/Sources/SwiftRefactor/CallToTrailingClosures.swift b/Sources/SwiftRefactor/CallToTrailingClosures.swift index 459fc861ef0..96bbbdcd3cf 100644 --- a/Sources/SwiftRefactor/CallToTrailingClosures.swift +++ b/Sources/SwiftRefactor/CallToTrailingClosures.swift @@ -54,7 +54,7 @@ public struct CallToTrailingClosures: SyntaxRefactoringProvider { extension FunctionCallExprSyntax { fileprivate func convertToTrailingClosures(from startAtArgument: Int) -> FunctionCallExprSyntax? { - guard trailingClosure == nil, additionalTrailingClosures == nil, leftParen != nil, rightParen != nil else { + guard trailingClosure == nil, additionalTrailingClosures.isEmpty, leftParen != nil, rightParen != nil else { // Already have trailing closures return nil } diff --git a/Sources/SwiftRefactor/OpaqueParameterToGeneric.swift b/Sources/SwiftRefactor/OpaqueParameterToGeneric.swift index 6346a31adb0..bc042790ad0 100644 --- a/Sources/SwiftRefactor/OpaqueParameterToGeneric.swift +++ b/Sources/SwiftRefactor/OpaqueParameterToGeneric.swift @@ -55,7 +55,7 @@ fileprivate class SomeParameterRewriter: SyntaxRewriter { } let genericParam = GenericParameterSyntax( - attributes: nil, + attributes: [], eachKeyword: nil, name: paramNameSyntax, colon: colon, diff --git a/Sources/SwiftSyntax/MissingNodeInitializers.swift b/Sources/SwiftSyntax/MissingNodeInitializers.swift index 5df2d6d9d36..c8faf49c0ca 100644 --- a/Sources/SwiftSyntax/MissingNodeInitializers.swift +++ b/Sources/SwiftSyntax/MissingNodeInitializers.swift @@ -12,8 +12,8 @@ public extension MissingDeclSyntax { init( - attributes: AttributeListSyntax?, - modifiers: DeclModifierListSyntax?, + attributes: AttributeListSyntax, + modifiers: DeclModifierListSyntax, arena: __shared SyntaxArena ) { self.init( @@ -68,8 +68,8 @@ public extension MissingSyntax { public extension RawMissingDeclSyntax { init( - attributes: RawAttributeListSyntax?, - modifiers: RawDeclModifierListSyntax?, + attributes: RawAttributeListSyntax, + modifiers: RawDeclModifierListSyntax, arena: __shared SyntaxArena ) { self.init( diff --git a/Sources/SwiftSyntax/Raw/RawSyntax.swift b/Sources/SwiftSyntax/Raw/RawSyntax.swift index b5c5ea944f4..9ff39983aa0 100644 --- a/Sources/SwiftSyntax/Raw/RawSyntax.swift +++ b/Sources/SwiftSyntax/Raw/RawSyntax.swift @@ -828,12 +828,14 @@ extension RawSyntax { if leadingTrivia != nil || trailingTrivia != nil { var layout = Array(collection) if let leadingTrivia = leadingTrivia, - let idx = layout.firstIndex(where: { $0 != nil }) + // Find the index of the first non-empty node so we can attach the trivia to it. + let idx = layout.firstIndex(where: { $0 != nil && ($0!.isToken || $0!.totalNodes > 1) }) { layout[idx] = layout[idx]!.withLeadingTrivia(leadingTrivia + (layout[idx]?.formLeadingTrivia() ?? []), arena: arena) } if let trailingTrivia = trailingTrivia, - let idx = layout.lastIndex(where: { $0 != nil }) + // Find the index of the first non-empty node so we can attach the trivia to it. + let idx = layout.lastIndex(where: { $0 != nil && ($0!.isToken || $0!.totalNodes > 1) }) { layout[idx] = layout[idx]!.withTrailingTrivia((layout[idx]?.formTrailingTrivia() ?? []) + trailingTrivia, arena: arena) } diff --git a/Sources/SwiftSyntax/SyntaxCollection.swift b/Sources/SwiftSyntax/SyntaxCollection.swift index da1d346f0ef..1623234ad56 100644 --- a/Sources/SwiftSyntax/SyntaxCollection.swift +++ b/Sources/SwiftSyntax/SyntaxCollection.swift @@ -10,7 +10,8 @@ // //===----------------------------------------------------------------------===// -public protocol SyntaxCollection: SyntaxProtocol, BidirectionalCollection where Element: SyntaxProtocol, Index == SyntaxChildrenIndex { +public protocol SyntaxCollection: SyntaxProtocol, BidirectionalCollection, ExpressibleByArrayLiteral +where Element: SyntaxProtocol, Index == SyntaxChildrenIndex { associatedtype Iterator = SyntaxCollectionIterator /// The ``SyntaxKind`` of the syntax node that conforms to ``SyntaxCollection``. @@ -58,6 +59,10 @@ extension SyntaxCollection { self.init(SyntaxData.forRoot(raw, rawNodeArena: arena)) } + public init(arrayLiteral elements: Element...) { + self.init(elements) + } + /// The number of elements, `present` or `missing`, in this collection. public var count: Int { return layoutView.children.count diff --git a/Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift b/Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift index 9c2360f2fec..2df170c16f0 100644 --- a/Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift +++ b/Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift @@ -68,7 +68,7 @@ extension AccessorDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifier: UnexpectedNodesSyntax? = nil, modifier: DeclModifierSyntax? = nil, _ unexpectedBetweenModifierAndAccessorKind: UnexpectedNodesSyntax? = nil, @@ -139,9 +139,9 @@ extension ActorDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndActorKeyword: UnexpectedNodesSyntax? = nil, actorKeyword: TokenSyntax = .keyword(.actor), _ unexpectedBetweenActorKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -605,9 +605,9 @@ extension AssociatedTypeDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndAssociatedtypeKeyword: UnexpectedNodesSyntax? = nil, associatedtypeKeyword: TokenSyntax = .keyword(.associatedtype), _ unexpectedBetweenAssociatedtypeKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -1124,9 +1124,9 @@ extension ClassDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndClassKeyword: UnexpectedNodesSyntax? = nil, classKeyword: TokenSyntax = .keyword(.class), _ unexpectedBetweenClassKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -1379,7 +1379,7 @@ extension ClosureSignatureSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndCapture: UnexpectedNodesSyntax? = nil, capture: ClosureCaptureClauseSyntax? = nil, _ unexpectedBetweenCaptureAndInput: UnexpectedNodesSyntax? = nil, @@ -2383,9 +2383,9 @@ extension EditorPlaceholderDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndIdentifier: UnexpectedNodesSyntax? = nil, identifier: TokenSyntax, _ unexpectedAfterIdentifier: UnexpectedNodesSyntax? = nil, @@ -2635,7 +2635,7 @@ extension EnumCaseParameterSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndFirstName: UnexpectedNodesSyntax? = nil, firstName: TokenSyntax? = nil, _ unexpectedBetweenFirstNameAndSecondName: UnexpectedNodesSyntax? = nil, @@ -2730,9 +2730,9 @@ extension EnumDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndEnumKeyword: UnexpectedNodesSyntax? = nil, enumKeyword: TokenSyntax = .keyword(.enum), _ unexpectedBetweenEnumKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -3024,7 +3024,7 @@ extension FunctionCallExprSyntax { _ unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -3085,9 +3085,9 @@ extension FunctionDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndFuncKeyword: UnexpectedNodesSyntax? = nil, funcKeyword: TokenSyntax = .keyword(.func), _ unexpectedBetweenFuncKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -3223,9 +3223,9 @@ extension FunctionParameterSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndFirstName: UnexpectedNodesSyntax? = nil, firstName: TokenSyntax, _ unexpectedBetweenFirstNameAndSecondName: UnexpectedNodesSyntax? = nil, @@ -3759,7 +3759,7 @@ extension GenericParameterSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndEach: UnexpectedNodesSyntax? = nil, each: TokenSyntax? = nil, _ unexpectedBetweenEachAndName: UnexpectedNodesSyntax? = nil, @@ -4019,9 +4019,9 @@ extension ImportDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? = nil, importTok: TokenSyntax = .keyword(.import), _ unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? = nil, @@ -4782,9 +4782,9 @@ extension MacroDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndMacroKeyword: UnexpectedNodesSyntax? = nil, macroKeyword: TokenSyntax = .keyword(.macro), _ unexpectedBetweenMacroKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -4931,9 +4931,9 @@ extension MacroExpansionDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndPoundToken: UnexpectedNodesSyntax? = nil, poundToken: TokenSyntax = .poundToken(), _ unexpectedBetweenPoundTokenAndMacro: UnexpectedNodesSyntax? = nil, @@ -4949,7 +4949,7 @@ extension MacroExpansionDeclSyntax { _ unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -5102,7 +5102,7 @@ extension MacroExpansionExprSyntax { _ unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -6269,9 +6269,9 @@ extension PrecedenceGroupDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndPrecedencegroupKeyword: UnexpectedNodesSyntax? = nil, precedencegroupKeyword: TokenSyntax = .keyword(.precedencegroup), _ unexpectedBetweenPrecedencegroupKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -6607,9 +6607,9 @@ extension ProtocolDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndProtocolKeyword: UnexpectedNodesSyntax? = nil, protocolKeyword: TokenSyntax = .keyword(.protocol), _ unexpectedBetweenProtocolKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -7444,9 +7444,9 @@ extension StructDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndStructKeyword: UnexpectedNodesSyntax? = nil, structKeyword: TokenSyntax = .keyword(.struct), _ unexpectedBetweenStructKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -7573,7 +7573,7 @@ extension SubscriptCallExprSyntax { _ unexpectedBetweenRightBracketAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -7684,9 +7684,9 @@ extension SubscriptDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndSubscriptKeyword: UnexpectedNodesSyntax? = nil, subscriptKeyword: TokenSyntax = .keyword(.subscript), _ unexpectedBetweenSubscriptKeywordAndGenericParameterClause: UnexpectedNodesSyntax? = nil, @@ -8318,9 +8318,9 @@ extension TypeAliasDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndTypealiasKeyword: UnexpectedNodesSyntax? = nil, typealiasKeyword: TokenSyntax = .keyword(.typealias), _ unexpectedBetweenTypealiasKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -8653,9 +8653,9 @@ extension VariableDeclSyntax { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndBindingKeyword: UnexpectedNodesSyntax? = nil, bindingKeyword: TokenSyntax, _ unexpectedBetweenBindingKeywordAndBindings: UnexpectedNodesSyntax? = nil, diff --git a/Sources/SwiftSyntax/generated/SyntaxTraits.swift b/Sources/SwiftSyntax/generated/SyntaxTraits.swift index 202c9889808..56d2259f51a 100644 --- a/Sources/SwiftSyntax/generated/SyntaxTraits.swift +++ b/Sources/SwiftSyntax/generated/SyntaxTraits.swift @@ -58,12 +58,12 @@ public extension SyntaxProtocol { public protocol DeclGroupSyntax: SyntaxProtocol { - var attributes: AttributeListSyntax? { + var attributes: AttributeListSyntax { get set } - var modifiers: DeclModifierListSyntax? { + var modifiers: DeclModifierListSyntax { get set } @@ -208,7 +208,7 @@ public protocol FreestandingMacroExpansionSyntax: SyntaxProtocol { set } - var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? { + var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax { get set } @@ -364,7 +364,7 @@ public extension SyntaxProtocol { public protocol WithAttributesSyntax: SyntaxProtocol { - var attributes: AttributeListSyntax? { + var attributes: AttributeListSyntax { get set } @@ -484,7 +484,7 @@ public extension SyntaxProtocol { public protocol WithModifiersSyntax: SyntaxProtocol { - var modifiers: DeclModifierListSyntax? { + var modifiers: DeclModifierListSyntax { get set } diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift index 5190988515e..7dae59c883e 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift @@ -220,7 +220,7 @@ public struct RawAccessorDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifier: RawUnexpectedNodesSyntax? = nil, modifier: RawDeclModifierSyntax?, _ unexpectedBetweenModifierAndAccessorSpecifier: RawUnexpectedNodesSyntax? = nil, @@ -238,7 +238,7 @@ public struct RawAccessorDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .accessorDecl, uninitializedCount: 13, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifier?.raw layout[3] = modifier?.raw layout[4] = unexpectedBetweenModifierAndAccessorSpecifier?.raw @@ -258,8 +258,8 @@ public struct RawAccessorDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifier: RawUnexpectedNodesSyntax? { @@ -490,9 +490,9 @@ public struct RawActorDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndActorKeyword: RawUnexpectedNodesSyntax? = nil, actorKeyword: RawTokenSyntax, _ unexpectedBetweenActorKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -512,9 +512,9 @@ public struct RawActorDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .actorDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndActorKeyword?.raw layout[5] = actorKeyword.raw layout[6] = unexpectedBetweenActorKeywordAndName?.raw @@ -536,16 +536,16 @@ public struct RawActorDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndActorKeyword: RawUnexpectedNodesSyntax? { @@ -1138,9 +1138,9 @@ public struct RawAssociatedTypeDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndAssociatedtypeKeyword: RawUnexpectedNodesSyntax? = nil, associatedtypeKeyword: RawTokenSyntax, _ unexpectedBetweenAssociatedtypeKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -1158,9 +1158,9 @@ public struct RawAssociatedTypeDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .associatedTypeDecl, uninitializedCount: 15, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndAssociatedtypeKeyword?.raw layout[5] = associatedtypeKeyword.raw layout[6] = unexpectedBetweenAssociatedtypeKeywordAndName?.raw @@ -1180,16 +1180,16 @@ public struct RawAssociatedTypeDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndAssociatedtypeKeyword: RawUnexpectedNodesSyntax? { @@ -1612,7 +1612,7 @@ public struct RawAttributedTypeSyntax: RawTypeSyntaxNodeProtocol { _ unexpectedBeforeSpecifier: RawUnexpectedNodesSyntax? = nil, specifier: RawTokenSyntax?, _ unexpectedBetweenSpecifierAndAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndBaseType: RawUnexpectedNodesSyntax? = nil, baseType: RawTypeSyntax, _ unexpectedAfterBaseType: RawUnexpectedNodesSyntax? = nil, @@ -1624,7 +1624,7 @@ public struct RawAttributedTypeSyntax: RawTypeSyntaxNodeProtocol { layout[0] = unexpectedBeforeSpecifier?.raw layout[1] = specifier?.raw layout[2] = unexpectedBetweenSpecifierAndAttributes?.raw - layout[3] = attributes?.raw + layout[3] = attributes.raw layout[4] = unexpectedBetweenAttributesAndBaseType?.raw layout[5] = baseType.raw layout[6] = unexpectedAfterBaseType?.raw @@ -1644,8 +1644,8 @@ public struct RawAttributedTypeSyntax: RawTypeSyntaxNodeProtocol { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[3].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[3].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndBaseType: RawUnexpectedNodesSyntax? { @@ -2715,7 +2715,7 @@ public struct RawCatchClauseSyntax: RawSyntaxNodeProtocol { _ unexpectedBeforeCatchKeyword: RawUnexpectedNodesSyntax? = nil, catchKeyword: RawTokenSyntax, _ unexpectedBetweenCatchKeywordAndCatchItems: RawUnexpectedNodesSyntax? = nil, - catchItems: RawCatchItemListSyntax?, + catchItems: RawCatchItemListSyntax, _ unexpectedBetweenCatchItemsAndBody: RawUnexpectedNodesSyntax? = nil, body: RawCodeBlockSyntax, _ unexpectedAfterBody: RawUnexpectedNodesSyntax? = nil, @@ -2727,7 +2727,7 @@ public struct RawCatchClauseSyntax: RawSyntaxNodeProtocol { layout[0] = unexpectedBeforeCatchKeyword?.raw layout[1] = catchKeyword.raw layout[2] = unexpectedBetweenCatchKeywordAndCatchItems?.raw - layout[3] = catchItems?.raw + layout[3] = catchItems.raw layout[4] = unexpectedBetweenCatchItemsAndBody?.raw layout[5] = body.raw layout[6] = unexpectedAfterBody?.raw @@ -2747,8 +2747,8 @@ public struct RawCatchClauseSyntax: RawSyntaxNodeProtocol { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var catchItems: RawCatchItemListSyntax? { - layoutView.children[3].map(RawCatchItemListSyntax.init(raw:)) + public var catchItems: RawCatchItemListSyntax { + layoutView.children[3].map(RawCatchItemListSyntax.init(raw:))! } public var unexpectedBetweenCatchItemsAndBody: RawUnexpectedNodesSyntax? { @@ -2927,9 +2927,9 @@ public struct RawClassDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndClassKeyword: RawUnexpectedNodesSyntax? = nil, classKeyword: RawTokenSyntax, _ unexpectedBetweenClassKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -2949,9 +2949,9 @@ public struct RawClassDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .classDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndClassKeyword?.raw layout[5] = classKeyword.raw layout[6] = unexpectedBetweenClassKeywordAndName?.raw @@ -2973,16 +2973,16 @@ public struct RawClassDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndClassKeyword: RawUnexpectedNodesSyntax? { @@ -3129,7 +3129,7 @@ public struct RawClosureCaptureClauseSyntax: RawSyntaxNodeProtocol { _ unexpectedBeforeLeftSquare: RawUnexpectedNodesSyntax? = nil, leftSquare: RawTokenSyntax, _ unexpectedBetweenLeftSquareAndItems: RawUnexpectedNodesSyntax? = nil, - items: RawClosureCaptureListSyntax?, + items: RawClosureCaptureListSyntax, _ unexpectedBetweenItemsAndRightSquare: RawUnexpectedNodesSyntax? = nil, rightSquare: RawTokenSyntax, _ unexpectedAfterRightSquare: RawUnexpectedNodesSyntax? = nil, @@ -3141,7 +3141,7 @@ public struct RawClosureCaptureClauseSyntax: RawSyntaxNodeProtocol { layout[0] = unexpectedBeforeLeftSquare?.raw layout[1] = leftSquare.raw layout[2] = unexpectedBetweenLeftSquareAndItems?.raw - layout[3] = items?.raw + layout[3] = items.raw layout[4] = unexpectedBetweenItemsAndRightSquare?.raw layout[5] = rightSquare.raw layout[6] = unexpectedAfterRightSquare?.raw @@ -3161,8 +3161,8 @@ public struct RawClosureCaptureClauseSyntax: RawSyntaxNodeProtocol { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var items: RawClosureCaptureListSyntax? { - layoutView.children[3].map(RawClosureCaptureListSyntax.init(raw:)) + public var items: RawClosureCaptureListSyntax { + layoutView.children[3].map(RawClosureCaptureListSyntax.init(raw:))! } public var unexpectedBetweenItemsAndRightSquare: RawUnexpectedNodesSyntax? { @@ -3685,9 +3685,9 @@ public struct RawClosureParameterSyntax: RawSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndFirstName: RawUnexpectedNodesSyntax? = nil, firstName: RawTokenSyntax, _ unexpectedBetweenFirstNameAndSecondName: RawUnexpectedNodesSyntax? = nil, @@ -3707,9 +3707,9 @@ public struct RawClosureParameterSyntax: RawSyntaxNodeProtocol { kind: .closureParameter, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndFirstName?.raw layout[5] = firstName.raw layout[6] = unexpectedBetweenFirstNameAndSecondName?.raw @@ -3731,16 +3731,16 @@ public struct RawClosureParameterSyntax: RawSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndFirstName: RawUnexpectedNodesSyntax? { @@ -3977,7 +3977,7 @@ public struct RawClosureSignatureSyntax: RawSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndCapture: RawUnexpectedNodesSyntax? = nil, capture: RawClosureCaptureClauseSyntax?, _ unexpectedBetweenCaptureAndParameterClause: RawUnexpectedNodesSyntax? = nil, @@ -3995,7 +3995,7 @@ public struct RawClosureSignatureSyntax: RawSyntaxNodeProtocol { kind: .closureSignature, uninitializedCount: 13, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndCapture?.raw layout[3] = capture?.raw layout[4] = unexpectedBetweenCaptureAndParameterClause?.raw @@ -4015,8 +4015,8 @@ public struct RawClosureSignatureSyntax: RawSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndCapture: RawUnexpectedNodesSyntax? { @@ -5739,9 +5739,9 @@ public struct RawDeinitializerDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndDeinitKeyword: RawUnexpectedNodesSyntax? = nil, deinitKeyword: RawTokenSyntax, _ unexpectedBetweenDeinitKeywordAndEffectSpecifiers: RawUnexpectedNodesSyntax? = nil, @@ -5755,9 +5755,9 @@ public struct RawDeinitializerDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .deinitializerDecl, uninitializedCount: 11, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndDeinitKeyword?.raw layout[5] = deinitKeyword.raw layout[6] = unexpectedBetweenDeinitKeywordAndEffectSpecifiers?.raw @@ -5773,16 +5773,16 @@ public struct RawDeinitializerDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndDeinitKeyword: RawUnexpectedNodesSyntax? { @@ -7067,7 +7067,7 @@ public struct RawDoStmtSyntax: RawStmtSyntaxNodeProtocol { _ unexpectedBetweenDoKeywordAndBody: RawUnexpectedNodesSyntax? = nil, body: RawCodeBlockSyntax, _ unexpectedBetweenBodyAndCatchClauses: RawUnexpectedNodesSyntax? = nil, - catchClauses: RawCatchClauseListSyntax?, + catchClauses: RawCatchClauseListSyntax, _ unexpectedAfterCatchClauses: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { @@ -7079,7 +7079,7 @@ public struct RawDoStmtSyntax: RawStmtSyntaxNodeProtocol { layout[2] = unexpectedBetweenDoKeywordAndBody?.raw layout[3] = body.raw layout[4] = unexpectedBetweenBodyAndCatchClauses?.raw - layout[5] = catchClauses?.raw + layout[5] = catchClauses.raw layout[6] = unexpectedAfterCatchClauses?.raw } self.init(unchecked: raw) @@ -7105,8 +7105,8 @@ public struct RawDoStmtSyntax: RawStmtSyntaxNodeProtocol { layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var catchClauses: RawCatchClauseListSyntax? { - layoutView.children[5].map(RawCatchClauseListSyntax.init(raw:)) + public var catchClauses: RawCatchClauseListSyntax { + layoutView.children[5].map(RawCatchClauseListSyntax.init(raw:))! } public var unexpectedAfterCatchClauses: RawUnexpectedNodesSyntax? { @@ -7401,9 +7401,9 @@ public struct RawEditorPlaceholderDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndPlaceholder: RawUnexpectedNodesSyntax? = nil, placeholder: RawTokenSyntax, _ unexpectedAfterPlaceholder: RawUnexpectedNodesSyntax? = nil, @@ -7413,9 +7413,9 @@ public struct RawEditorPlaceholderDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .editorPlaceholderDecl, uninitializedCount: 7, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndPlaceholder?.raw layout[5] = placeholder.raw layout[6] = unexpectedAfterPlaceholder?.raw @@ -7427,16 +7427,16 @@ public struct RawEditorPlaceholderDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndPlaceholder: RawUnexpectedNodesSyntax? { @@ -7591,9 +7591,9 @@ public struct RawEnumCaseDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndCaseKeyword: RawUnexpectedNodesSyntax? = nil, caseKeyword: RawTokenSyntax, _ unexpectedBetweenCaseKeywordAndElements: RawUnexpectedNodesSyntax? = nil, @@ -7605,9 +7605,9 @@ public struct RawEnumCaseDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .enumCaseDecl, uninitializedCount: 9, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndCaseKeyword?.raw layout[5] = caseKeyword.raw layout[6] = unexpectedBetweenCaseKeywordAndElements?.raw @@ -7621,16 +7621,16 @@ public struct RawEnumCaseDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndCaseKeyword: RawUnexpectedNodesSyntax? { @@ -7961,7 +7961,7 @@ public struct RawEnumCaseParameterSyntax: RawSyntaxNodeProtocol { public init( _ unexpectedBeforeModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndFirstName: RawUnexpectedNodesSyntax? = nil, firstName: RawTokenSyntax?, _ unexpectedBetweenFirstNameAndSecondName: RawUnexpectedNodesSyntax? = nil, @@ -7981,7 +7981,7 @@ public struct RawEnumCaseParameterSyntax: RawSyntaxNodeProtocol { kind: .enumCaseParameter, uninitializedCount: 15, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeModifiers?.raw - layout[1] = modifiers?.raw + layout[1] = modifiers.raw layout[2] = unexpectedBetweenModifiersAndFirstName?.raw layout[3] = firstName?.raw layout[4] = unexpectedBetweenFirstNameAndSecondName?.raw @@ -8003,8 +8003,8 @@ public struct RawEnumCaseParameterSyntax: RawSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[1].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[1].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndFirstName: RawUnexpectedNodesSyntax? { @@ -8091,9 +8091,9 @@ public struct RawEnumDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndEnumKeyword: RawUnexpectedNodesSyntax? = nil, enumKeyword: RawTokenSyntax, _ unexpectedBetweenEnumKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -8113,9 +8113,9 @@ public struct RawEnumDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .enumDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndEnumKeyword?.raw layout[5] = enumKeyword.raw layout[6] = unexpectedBetweenEnumKeywordAndName?.raw @@ -8137,16 +8137,16 @@ public struct RawEnumDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndEnumKeyword: RawUnexpectedNodesSyntax? { @@ -8626,9 +8626,9 @@ public struct RawExtensionDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndExtensionKeyword: RawUnexpectedNodesSyntax? = nil, extensionKeyword: RawTokenSyntax, _ unexpectedBetweenExtensionKeywordAndExtendedType: RawUnexpectedNodesSyntax? = nil, @@ -8646,9 +8646,9 @@ public struct RawExtensionDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .extensionDecl, uninitializedCount: 15, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndExtensionKeyword?.raw layout[5] = extensionKeyword.raw layout[6] = unexpectedBetweenExtensionKeywordAndExtendedType?.raw @@ -8668,16 +8668,16 @@ public struct RawExtensionDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndExtensionKeyword: RawUnexpectedNodesSyntax? { @@ -9118,7 +9118,7 @@ public struct RawFunctionCallExprSyntax: RawExprSyntaxNodeProtocol { _ unexpectedBetweenRightParenAndTrailingClosure: RawUnexpectedNodesSyntax? = nil, trailingClosure: RawClosureExprSyntax?, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, - additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax?, + additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax, _ unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { @@ -9136,7 +9136,7 @@ public struct RawFunctionCallExprSyntax: RawExprSyntaxNodeProtocol { layout[8] = unexpectedBetweenRightParenAndTrailingClosure?.raw layout[9] = trailingClosure?.raw layout[10] = unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw - layout[11] = additionalTrailingClosures?.raw + layout[11] = additionalTrailingClosures.raw layout[12] = unexpectedAfterAdditionalTrailingClosures?.raw } self.init(unchecked: raw) @@ -9186,8 +9186,8 @@ public struct RawFunctionCallExprSyntax: RawExprSyntaxNodeProtocol { layoutView.children[10].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax? { - layoutView.children[11].map(RawMultipleTrailingClosureElementListSyntax.init(raw:)) + public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax { + layoutView.children[11].map(RawMultipleTrailingClosureElementListSyntax.init(raw:))! } public var unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? { @@ -9226,9 +9226,9 @@ public struct RawFunctionDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndFuncKeyword: RawUnexpectedNodesSyntax? = nil, funcKeyword: RawTokenSyntax, _ unexpectedBetweenFuncKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -9248,9 +9248,9 @@ public struct RawFunctionDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .functionDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndFuncKeyword?.raw layout[5] = funcKeyword.raw layout[6] = unexpectedBetweenFuncKeywordAndName?.raw @@ -9272,16 +9272,16 @@ public struct RawFunctionDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndFuncKeyword: RawUnexpectedNodesSyntax? { @@ -9570,9 +9570,9 @@ public struct RawFunctionParameterSyntax: RawSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndFirstName: RawUnexpectedNodesSyntax? = nil, firstName: RawTokenSyntax, _ unexpectedBetweenFirstNameAndSecondName: RawUnexpectedNodesSyntax? = nil, @@ -9594,9 +9594,9 @@ public struct RawFunctionParameterSyntax: RawSyntaxNodeProtocol { kind: .functionParameter, uninitializedCount: 19, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndFirstName?.raw layout[5] = firstName.raw layout[6] = unexpectedBetweenFirstNameAndSecondName?.raw @@ -9620,16 +9620,16 @@ public struct RawFunctionParameterSyntax: RawSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndFirstName: RawUnexpectedNodesSyntax? { @@ -10258,7 +10258,7 @@ public struct RawGenericParameterSyntax: RawSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndEachKeyword: RawUnexpectedNodesSyntax? = nil, eachKeyword: RawTokenSyntax?, _ unexpectedBetweenEachKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -10276,7 +10276,7 @@ public struct RawGenericParameterSyntax: RawSyntaxNodeProtocol { kind: .genericParameter, uninitializedCount: 13, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndEachKeyword?.raw layout[3] = eachKeyword?.raw layout[4] = unexpectedBetweenEachKeywordAndName?.raw @@ -10296,8 +10296,8 @@ public struct RawGenericParameterSyntax: RawSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndEachKeyword: RawUnexpectedNodesSyntax? { @@ -11436,9 +11436,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? = nil, importKeyword: RawTokenSyntax, _ unexpectedBetweenImportKeywordAndImportKindSpecifier: RawUnexpectedNodesSyntax? = nil, @@ -11452,9 +11452,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .importDecl, uninitializedCount: 11, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndImportKeyword?.raw layout[5] = importKeyword.raw layout[6] = unexpectedBetweenImportKeywordAndImportKindSpecifier?.raw @@ -11470,16 +11470,16 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? { @@ -12074,9 +12074,9 @@ public struct RawInitializerDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndInitKeyword: RawUnexpectedNodesSyntax? = nil, initKeyword: RawTokenSyntax, _ unexpectedBetweenInitKeywordAndOptionalMark: RawUnexpectedNodesSyntax? = nil, @@ -12096,9 +12096,9 @@ public struct RawInitializerDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .initializerDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndInitKeyword?.raw layout[5] = initKeyword.raw layout[6] = unexpectedBetweenInitKeywordAndOptionalMark?.raw @@ -12120,16 +12120,16 @@ public struct RawInitializerDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndInitKeyword: RawUnexpectedNodesSyntax? { @@ -13337,9 +13337,9 @@ public struct RawMacroDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndMacroKeyword: RawUnexpectedNodesSyntax? = nil, macroKeyword: RawTokenSyntax, _ unexpectedBetweenMacroKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -13359,9 +13359,9 @@ public struct RawMacroDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .macroDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndMacroKeyword?.raw layout[5] = macroKeyword.raw layout[6] = unexpectedBetweenMacroKeywordAndName?.raw @@ -13383,16 +13383,16 @@ public struct RawMacroDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndMacroKeyword: RawUnexpectedNodesSyntax? { @@ -13479,9 +13479,9 @@ public struct RawMacroExpansionDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndPound: RawUnexpectedNodesSyntax? = nil, pound: RawTokenSyntax, _ unexpectedBetweenPoundAndMacroName: RawUnexpectedNodesSyntax? = nil, @@ -13497,7 +13497,7 @@ public struct RawMacroExpansionDeclSyntax: RawDeclSyntaxNodeProtocol { _ unexpectedBetweenRightParenAndTrailingClosure: RawUnexpectedNodesSyntax? = nil, trailingClosure: RawClosureExprSyntax?, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, - additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax?, + additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax, _ unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { @@ -13505,9 +13505,9 @@ public struct RawMacroExpansionDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .macroExpansionDecl, uninitializedCount: 21, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndPound?.raw layout[5] = pound.raw layout[6] = unexpectedBetweenPoundAndMacroName?.raw @@ -13523,7 +13523,7 @@ public struct RawMacroExpansionDeclSyntax: RawDeclSyntaxNodeProtocol { layout[16] = unexpectedBetweenRightParenAndTrailingClosure?.raw layout[17] = trailingClosure?.raw layout[18] = unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw - layout[19] = additionalTrailingClosures?.raw + layout[19] = additionalTrailingClosures.raw layout[20] = unexpectedAfterAdditionalTrailingClosures?.raw } self.init(unchecked: raw) @@ -13533,16 +13533,16 @@ public struct RawMacroExpansionDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndPound: RawUnexpectedNodesSyntax? { @@ -13605,8 +13605,8 @@ public struct RawMacroExpansionDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[18].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax? { - layoutView.children[19].map(RawMultipleTrailingClosureElementListSyntax.init(raw:)) + public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax { + layoutView.children[19].map(RawMultipleTrailingClosureElementListSyntax.init(raw:))! } public var unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? { @@ -13659,7 +13659,7 @@ public struct RawMacroExpansionExprSyntax: RawExprSyntaxNodeProtocol { _ unexpectedBetweenRightParenAndTrailingClosure: RawUnexpectedNodesSyntax? = nil, trailingClosure: RawClosureExprSyntax?, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, - additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax?, + additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax, _ unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { @@ -13681,7 +13681,7 @@ public struct RawMacroExpansionExprSyntax: RawExprSyntaxNodeProtocol { layout[12] = unexpectedBetweenRightParenAndTrailingClosure?.raw layout[13] = trailingClosure?.raw layout[14] = unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw - layout[15] = additionalTrailingClosures?.raw + layout[15] = additionalTrailingClosures.raw layout[16] = unexpectedAfterAdditionalTrailingClosures?.raw } self.init(unchecked: raw) @@ -13747,8 +13747,8 @@ public struct RawMacroExpansionExprSyntax: RawExprSyntaxNodeProtocol { layoutView.children[14].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax? { - layoutView.children[15].map(RawMultipleTrailingClosureElementListSyntax.init(raw:)) + public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax { + layoutView.children[15].map(RawMultipleTrailingClosureElementListSyntax.init(raw:))! } public var unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? { @@ -14341,9 +14341,9 @@ public struct RawMissingDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndPlaceholder: RawUnexpectedNodesSyntax? = nil, placeholder: RawTokenSyntax, _ unexpectedAfterPlaceholder: RawUnexpectedNodesSyntax? = nil, @@ -14353,9 +14353,9 @@ public struct RawMissingDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .missingDecl, uninitializedCount: 7, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndPlaceholder?.raw layout[5] = placeholder.raw layout[6] = unexpectedAfterPlaceholder?.raw @@ -14367,16 +14367,16 @@ public struct RawMissingDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndPlaceholder: RawUnexpectedNodesSyntax? { @@ -17029,9 +17029,9 @@ public struct RawPrecedenceGroupDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndPrecedencegroupKeyword: RawUnexpectedNodesSyntax? = nil, precedencegroupKeyword: RawTokenSyntax, _ unexpectedBetweenPrecedencegroupKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -17049,9 +17049,9 @@ public struct RawPrecedenceGroupDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .precedenceGroupDecl, uninitializedCount: 15, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndPrecedencegroupKeyword?.raw layout[5] = precedencegroupKeyword.raw layout[6] = unexpectedBetweenPrecedencegroupKeywordAndName?.raw @@ -17071,16 +17071,16 @@ public struct RawPrecedenceGroupDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndPrecedencegroupKeyword: RawUnexpectedNodesSyntax? { @@ -17633,9 +17633,9 @@ public struct RawProtocolDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndProtocolKeyword: RawUnexpectedNodesSyntax? = nil, protocolKeyword: RawTokenSyntax, _ unexpectedBetweenProtocolKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -17655,9 +17655,9 @@ public struct RawProtocolDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .protocolDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndProtocolKeyword?.raw layout[5] = protocolKeyword.raw layout[6] = unexpectedBetweenProtocolKeywordAndName?.raw @@ -17679,16 +17679,16 @@ public struct RawProtocolDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndProtocolKeyword: RawUnexpectedNodesSyntax? { @@ -19174,9 +19174,9 @@ public struct RawStructDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndStructKeyword: RawUnexpectedNodesSyntax? = nil, structKeyword: RawTokenSyntax, _ unexpectedBetweenStructKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -19196,9 +19196,9 @@ public struct RawStructDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .structDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndStructKeyword?.raw layout[5] = structKeyword.raw layout[6] = unexpectedBetweenStructKeywordAndName?.raw @@ -19220,16 +19220,16 @@ public struct RawStructDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndStructKeyword: RawUnexpectedNodesSyntax? { @@ -19326,7 +19326,7 @@ public struct RawSubscriptCallExprSyntax: RawExprSyntaxNodeProtocol { _ unexpectedBetweenRightSquareAndTrailingClosure: RawUnexpectedNodesSyntax? = nil, trailingClosure: RawClosureExprSyntax?, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, - additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax?, + additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax, _ unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { @@ -19344,7 +19344,7 @@ public struct RawSubscriptCallExprSyntax: RawExprSyntaxNodeProtocol { layout[8] = unexpectedBetweenRightSquareAndTrailingClosure?.raw layout[9] = trailingClosure?.raw layout[10] = unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw - layout[11] = additionalTrailingClosures?.raw + layout[11] = additionalTrailingClosures.raw layout[12] = unexpectedAfterAdditionalTrailingClosures?.raw } self.init(unchecked: raw) @@ -19394,8 +19394,8 @@ public struct RawSubscriptCallExprSyntax: RawExprSyntaxNodeProtocol { layoutView.children[10].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax? { - layoutView.children[11].map(RawMultipleTrailingClosureElementListSyntax.init(raw:)) + public var additionalTrailingClosures: RawMultipleTrailingClosureElementListSyntax { + layoutView.children[11].map(RawMultipleTrailingClosureElementListSyntax.init(raw:))! } public var unexpectedAfterAdditionalTrailingClosures: RawUnexpectedNodesSyntax? { @@ -19434,9 +19434,9 @@ public struct RawSubscriptDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndSubscriptKeyword: RawUnexpectedNodesSyntax? = nil, subscriptKeyword: RawTokenSyntax, _ unexpectedBetweenSubscriptKeywordAndGenericParameterClause: RawUnexpectedNodesSyntax? = nil, @@ -19456,9 +19456,9 @@ public struct RawSubscriptDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .subscriptDecl, uninitializedCount: 17, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndSubscriptKeyword?.raw layout[5] = subscriptKeyword.raw layout[6] = unexpectedBetweenSubscriptKeywordAndGenericParameterClause?.raw @@ -19480,16 +19480,16 @@ public struct RawSubscriptDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndSubscriptKeyword: RawUnexpectedNodesSyntax? { @@ -21114,9 +21114,9 @@ public struct RawTypeAliasDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndTypealiasKeyword: RawUnexpectedNodesSyntax? = nil, typealiasKeyword: RawTokenSyntax, _ unexpectedBetweenTypealiasKeywordAndName: RawUnexpectedNodesSyntax? = nil, @@ -21134,9 +21134,9 @@ public struct RawTypeAliasDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .typeAliasDecl, uninitializedCount: 15, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndTypealiasKeyword?.raw layout[5] = typealiasKeyword.raw layout[6] = unexpectedBetweenTypealiasKeywordAndName?.raw @@ -21156,16 +21156,16 @@ public struct RawTypeAliasDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndTypealiasKeyword: RawUnexpectedNodesSyntax? { @@ -22045,9 +22045,9 @@ public struct RawVariableDeclSyntax: RawDeclSyntaxNodeProtocol { public init( _ unexpectedBeforeAttributes: RawUnexpectedNodesSyntax? = nil, - attributes: RawAttributeListSyntax?, + attributes: RawAttributeListSyntax, _ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil, - modifiers: RawDeclModifierListSyntax?, + modifiers: RawDeclModifierListSyntax, _ unexpectedBetweenModifiersAndBindingSpecifier: RawUnexpectedNodesSyntax? = nil, bindingSpecifier: RawTokenSyntax, _ unexpectedBetweenBindingSpecifierAndBindings: RawUnexpectedNodesSyntax? = nil, @@ -22059,9 +22059,9 @@ public struct RawVariableDeclSyntax: RawDeclSyntaxNodeProtocol { kind: .variableDecl, uninitializedCount: 9, arena: arena) { layout in layout.initialize(repeating: nil) layout[0] = unexpectedBeforeAttributes?.raw - layout[1] = attributes?.raw + layout[1] = attributes.raw layout[2] = unexpectedBetweenAttributesAndModifiers?.raw - layout[3] = modifiers?.raw + layout[3] = modifiers.raw layout[4] = unexpectedBetweenModifiersAndBindingSpecifier?.raw layout[5] = bindingSpecifier.raw layout[6] = unexpectedBetweenBindingSpecifierAndBindings?.raw @@ -22075,16 +22075,16 @@ public struct RawVariableDeclSyntax: RawDeclSyntaxNodeProtocol { layoutView.children[0].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var attributes: RawAttributeListSyntax? { - layoutView.children[1].map(RawAttributeListSyntax.init(raw:)) + public var attributes: RawAttributeListSyntax { + layoutView.children[1].map(RawAttributeListSyntax.init(raw:))! } public var unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var modifiers: RawDeclModifierListSyntax? { - layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:)) + public var modifiers: RawDeclModifierListSyntax { + layoutView.children[3].map(RawDeclModifierListSyntax.init(raw:))! } public var unexpectedBetweenModifiersAndBindingSpecifier: RawUnexpectedNodesSyntax? { @@ -22261,7 +22261,7 @@ public struct RawVersionTupleSyntax: RawSyntaxNodeProtocol { _ unexpectedBeforeMajor: RawUnexpectedNodesSyntax? = nil, major: RawTokenSyntax, _ unexpectedBetweenMajorAndComponents: RawUnexpectedNodesSyntax? = nil, - components: RawVersionComponentListSyntax?, + components: RawVersionComponentListSyntax, _ unexpectedAfterComponents: RawUnexpectedNodesSyntax? = nil, arena: __shared SyntaxArena ) { @@ -22271,7 +22271,7 @@ public struct RawVersionTupleSyntax: RawSyntaxNodeProtocol { layout[0] = unexpectedBeforeMajor?.raw layout[1] = major.raw layout[2] = unexpectedBetweenMajorAndComponents?.raw - layout[3] = components?.raw + layout[3] = components.raw layout[4] = unexpectedAfterComponents?.raw } self.init(unchecked: raw) @@ -22289,8 +22289,8 @@ public struct RawVersionTupleSyntax: RawSyntaxNodeProtocol { layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:)) } - public var components: RawVersionComponentListSyntax? { - layoutView.children[3].map(RawVersionComponentListSyntax.init(raw:)) + public var components: RawVersionComponentListSyntax { + layoutView.children[3].map(RawVersionComponentListSyntax.init(raw:))! } public var unexpectedAfterComponents: RawUnexpectedNodesSyntax? { diff --git a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift index a3b14137bfd..8421ccb77bf 100644 --- a/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift +++ b/Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift @@ -222,7 +222,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .accessorDecl: assert(layout.count == 13) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierSyntax?.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) @@ -267,9 +267,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .actorDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("actor")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -338,9 +338,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .associatedTypeDecl: assert(layout.count == 15) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("associatedtype")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -385,7 +385,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { .keyword("consuming") ])) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawAttributeListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTypeSyntax.self)) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -501,7 +501,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: [.keyword("catch")])) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawCatchItemListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawCatchItemListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawCodeBlockSyntax.self)) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -521,9 +521,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .classDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("class")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -547,7 +547,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(.leftSquare)])) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawClosureCaptureListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawClosureCaptureListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.rightSquare)])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -606,9 +606,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .closureParameter: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.identifier), .tokenKind(.wildcard)])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -636,7 +636,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .closureSignature: assert(layout.count == 13) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 3, verify(layout[3], as: RawClosureCaptureClauseSyntax?.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) @@ -851,9 +851,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .deinitializerDecl: assert(layout.count == 11) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("deinit")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -994,7 +994,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 3, verify(layout[3], as: RawCodeBlockSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 5, verify(layout[5], as: RawCatchClauseListSyntax?.self)) + assertNoError(kind, 5, verify(layout[5], as: RawCatchClauseListSyntax.self)) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) case .documentationAttributeArgumentList: for (index, element) in layout.enumerated() { @@ -1024,9 +1024,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .editorPlaceholderDecl: assert(layout.count == 7) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) 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)) @@ -1042,9 +1042,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .enumCaseDecl: assert(layout.count == 9) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("case")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1081,7 +1081,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .enumCaseParameter: assert(layout.count == 15) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax?.self, tokenChoices: [.tokenKind(.identifier), .tokenKind(.wildcard)])) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) @@ -1098,9 +1098,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .enumDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("enum")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1153,9 +1153,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .extensionDecl: assert(layout.count == 15) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("extension")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1220,14 +1220,14 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 8, verify(layout[8], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 9, verify(layout[9], as: RawClosureExprSyntax?.self)) assertNoError(kind, 10, verify(layout[10], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 11, verify(layout[11], as: RawMultipleTrailingClosureElementListSyntax?.self)) + assertNoError(kind, 11, verify(layout[11], as: RawMultipleTrailingClosureElementListSyntax.self)) assertNoError(kind, 12, verify(layout[12], as: RawUnexpectedNodesSyntax?.self)) case .functionDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("func")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1269,9 +1269,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .functionParameter: assert(layout.count == 19) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.identifier), .tokenKind(.wildcard)])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1347,7 +1347,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .genericParameter: assert(layout.count == 13) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 3, verify(layout[3], as: RawTokenSyntax?.self, tokenChoices: [.keyword("each")])) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) @@ -1468,9 +1468,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .importDecl: assert(layout.count == 11) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("import")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1548,9 +1548,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .initializerDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("init")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1700,9 +1700,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .macroDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("macro")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1719,9 +1719,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .macroExpansionDecl: assert(layout.count == 21) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.pound)])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -1737,7 +1737,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 16, verify(layout[16], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 17, verify(layout[17], as: RawClosureExprSyntax?.self)) assertNoError(kind, 18, verify(layout[18], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 19, verify(layout[19], as: RawMultipleTrailingClosureElementListSyntax?.self)) + assertNoError(kind, 19, verify(layout[19], as: RawMultipleTrailingClosureElementListSyntax.self)) assertNoError(kind, 20, verify(layout[20], as: RawUnexpectedNodesSyntax?.self)) case .macroExpansionExpr: assert(layout.count == 17) @@ -1756,7 +1756,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 12, verify(layout[12], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 13, verify(layout[13], as: RawClosureExprSyntax?.self)) assertNoError(kind, 14, verify(layout[14], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 15, verify(layout[15], as: RawMultipleTrailingClosureElementListSyntax?.self)) + assertNoError(kind, 15, verify(layout[15], as: RawMultipleTrailingClosureElementListSyntax.self)) assertNoError(kind, 16, verify(layout[16], as: RawUnexpectedNodesSyntax?.self)) case .matchingPatternCondition: assert(layout.count == 9) @@ -1821,9 +1821,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .missingDecl: assert(layout.count == 7) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) 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)) @@ -2093,9 +2093,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .precedenceGroupDecl: assert(layout.count == 15) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("precedencegroup")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -2157,9 +2157,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .protocolDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("protocol")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -2319,9 +2319,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .structDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("struct")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -2348,14 +2348,14 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { assertNoError(kind, 8, verify(layout[8], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 9, verify(layout[9], as: RawClosureExprSyntax?.self)) assertNoError(kind, 10, verify(layout[10], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 11, verify(layout[11], as: RawMultipleTrailingClosureElementListSyntax?.self)) + assertNoError(kind, 11, verify(layout[11], as: RawMultipleTrailingClosureElementListSyntax.self)) assertNoError(kind, 12, verify(layout[12], as: RawUnexpectedNodesSyntax?.self)) case .subscriptDecl: assert(layout.count == 17) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("subscript")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -2534,9 +2534,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .typeAliasDecl: assert(layout.count == 15) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("typealias")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -2627,9 +2627,9 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) { case .variableDecl: assert(layout.count == 9) assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax?.self)) + assertNoError(kind, 1, verify(layout[1], as: RawAttributeListSyntax.self)) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawDeclModifierListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.keyword("let"), .keyword("var"), .keyword("inout")])) assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self)) @@ -2651,7 +2651,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(.integerLiteral)])) assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self)) - assertNoError(kind, 3, verify(layout[3], as: RawVersionComponentListSyntax?.self)) + assertNoError(kind, 3, verify(layout[3], as: RawVersionComponentListSyntax.self)) assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self)) case .whereClause: assert(layout.count == 5) diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift index a5b2d19624e..6813ba020f1 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift @@ -51,7 +51,7 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifier: UnexpectedNodesSyntax? = nil, modifier: DeclModifierSyntax? = nil, _ unexpectedBetweenModifierAndAccessorSpecifier: UnexpectedNodesSyntax? = nil, @@ -85,7 +85,7 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifier?.raw, modifier?.raw, unexpectedBetweenModifierAndAccessorSpecifier?.raw, @@ -120,12 +120,12 @@ public struct AccessorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = AccessorDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = AccessorDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -312,9 +312,9 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndActorKeyword: UnexpectedNodesSyntax? = nil, actorKeyword: TokenSyntax = .keyword(.actor), _ unexpectedBetweenActorKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -354,9 +354,9 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndActorKeyword?.raw, actorKeyword.raw, unexpectedBetweenActorKeywordAndName?.raw, @@ -393,12 +393,12 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = ActorDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = ActorDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -437,12 +437,12 @@ public struct ActorDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = ActorDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = ActorDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -683,9 +683,9 @@ public struct AssociatedTypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndAssociatedtypeKeyword: UnexpectedNodesSyntax? = nil, associatedtypeKeyword: TokenSyntax = .keyword(.associatedtype), _ unexpectedBetweenAssociatedtypeKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -721,9 +721,9 @@ public struct AssociatedTypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndAssociatedtypeKeyword?.raw, associatedtypeKeyword.raw, unexpectedBetweenAssociatedtypeKeywordAndName?.raw, @@ -759,12 +759,12 @@ public struct AssociatedTypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Attributes attached to the associated type declaration. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = AssociatedTypeDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = AssociatedTypeDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -804,12 +804,12 @@ public struct AssociatedTypeDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Modifiers attached to the associated type declaration. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = AssociatedTypeDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = AssociatedTypeDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -1033,9 +1033,9 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndClassKeyword: UnexpectedNodesSyntax? = nil, classKeyword: TokenSyntax = .keyword(.class), _ unexpectedBetweenClassKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -1075,9 +1075,9 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndClassKeyword?.raw, classKeyword.raw, unexpectedBetweenClassKeywordAndName?.raw, @@ -1115,12 +1115,12 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Attributes attached to the class declaration, such as an `@available` attribute. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = ClassDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = ClassDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -1160,12 +1160,12 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Modifiers attached to the class declaration, such as `public`. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = ClassDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = ClassDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -1388,9 +1388,9 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndDeinitKeyword: UnexpectedNodesSyntax? = nil, deinitKeyword: TokenSyntax = .keyword(.deinit), _ unexpectedBetweenDeinitKeywordAndEffectSpecifiers: UnexpectedNodesSyntax? = nil, @@ -1418,9 +1418,9 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndDeinitKeyword?.raw, deinitKeyword.raw, unexpectedBetweenDeinitKeywordAndEffectSpecifiers?.raw, @@ -1452,12 +1452,12 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Attributes that are attached to the deinitializer. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = DeinitializerDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = DeinitializerDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -1497,12 +1497,12 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Modifiers that are attached to the deinitializer. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = DeinitializerDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = DeinitializerDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -1651,9 +1651,9 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndPlaceholder: UnexpectedNodesSyntax? = nil, placeholder: TokenSyntax, _ unexpectedAfterPlaceholder: UnexpectedNodesSyntax? = nil, @@ -1673,9 +1673,9 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndPlaceholder?.raw, placeholder.raw, unexpectedAfterPlaceholder?.raw @@ -1703,12 +1703,12 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// If there were attributes before the editor placeholder, the ``EditorPlaceholderDeclSyntax`` will contain these. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = EditorPlaceholderDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = EditorPlaceholderDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -1748,12 +1748,12 @@ public struct EditorPlaceholderDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// If there were modifiers before the editor placeholder, the `EditorPlaceholderDecl` will contain these. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = EditorPlaceholderDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = EditorPlaceholderDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -1863,9 +1863,9 @@ public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndCaseKeyword: UnexpectedNodesSyntax? = nil, caseKeyword: TokenSyntax = .keyword(.case), _ unexpectedBetweenCaseKeywordAndElements: UnexpectedNodesSyntax? = nil, @@ -1889,9 +1889,9 @@ public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndCaseKeyword?.raw, caseKeyword.raw, unexpectedBetweenCaseKeywordAndElements?.raw, @@ -1921,12 +1921,12 @@ public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// The attributes applied to the case declaration. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = EnumCaseDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = EnumCaseDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -1966,12 +1966,12 @@ public struct EnumCaseDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// The declaration modifiers applied to the case declaration. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = EnumCaseDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = EnumCaseDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -2136,9 +2136,9 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndEnumKeyword: UnexpectedNodesSyntax? = nil, enumKeyword: TokenSyntax = .keyword(.enum), _ unexpectedBetweenEnumKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -2178,9 +2178,9 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndEnumKeyword?.raw, enumKeyword.raw, unexpectedBetweenEnumKeywordAndName?.raw, @@ -2218,12 +2218,12 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// The attributes applied to the enum declaration. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = EnumDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = EnumDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -2263,12 +2263,12 @@ public struct EnumDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// The declaration modifiers applied to the enum declaration. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = EnumDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = EnumDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -2481,9 +2481,9 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndExtensionKeyword: UnexpectedNodesSyntax? = nil, extensionKeyword: TokenSyntax = .keyword(.extension), _ unexpectedBetweenExtensionKeywordAndExtendedType: UnexpectedNodesSyntax? = nil, @@ -2519,9 +2519,9 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndExtensionKeyword?.raw, extensionKeyword.raw, unexpectedBetweenExtensionKeywordAndExtendedType?.raw, @@ -2556,12 +2556,12 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = ExtensionDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = ExtensionDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -2600,12 +2600,12 @@ public struct ExtensionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = ExtensionDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = ExtensionDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -2795,9 +2795,9 @@ public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndFuncKeyword: UnexpectedNodesSyntax? = nil, funcKeyword: TokenSyntax = .keyword(.func), _ unexpectedBetweenFuncKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -2837,9 +2837,9 @@ public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndFuncKeyword?.raw, funcKeyword.raw, unexpectedBetweenFuncKeywordAndName?.raw, @@ -2876,12 +2876,12 @@ public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = FunctionDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = FunctionDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -2920,12 +2920,12 @@ public struct FunctionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = FunctionDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = FunctionDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -3299,9 +3299,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndImportKeyword: UnexpectedNodesSyntax? = nil, importKeyword: TokenSyntax = .keyword(.import), _ unexpectedBetweenImportKeywordAndImportKindSpecifier: UnexpectedNodesSyntax? = nil, @@ -3329,9 +3329,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndImportKeyword?.raw, importKeyword.raw, unexpectedBetweenImportKeywordAndImportKindSpecifier?.raw, @@ -3363,12 +3363,12 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Attributes attached to the import declaration, for example `@testable`. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = ImportDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = ImportDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -3408,12 +3408,12 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Modifiers attached to the import declaration. Currently, no modifiers are supported by Swift. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = ImportDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = ImportDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -3610,9 +3610,9 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndInitKeyword: UnexpectedNodesSyntax? = nil, initKeyword: TokenSyntax = .keyword(.`init`), _ unexpectedBetweenInitKeywordAndOptionalMark: UnexpectedNodesSyntax? = nil, @@ -3652,9 +3652,9 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndInitKeyword?.raw, initKeyword.raw, unexpectedBetweenInitKeywordAndOptionalMark?.raw, @@ -3692,12 +3692,12 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Attributes that are attached to the initializer. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = InitializerDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = InitializerDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -3737,12 +3737,12 @@ public struct InitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Modifiers attached to the initializer - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = InitializerDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = InitializerDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -3957,9 +3957,9 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndMacroKeyword: UnexpectedNodesSyntax? = nil, macroKeyword: TokenSyntax = .keyword(.macro), _ unexpectedBetweenMacroKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -3999,9 +3999,9 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndMacroKeyword?.raw, macroKeyword.raw, unexpectedBetweenMacroKeywordAndName?.raw, @@ -4038,12 +4038,12 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = MacroDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = MacroDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -4082,12 +4082,12 @@ public struct MacroDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = MacroDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = MacroDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -4299,9 +4299,9 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndPound: UnexpectedNodesSyntax? = nil, pound: TokenSyntax = .poundToken(), _ unexpectedBetweenPoundAndMacroName: UnexpectedNodesSyntax? = nil, @@ -4317,7 +4317,7 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -4349,9 +4349,9 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndPound?.raw, pound.raw, unexpectedBetweenPoundAndMacroName?.raw, @@ -4367,7 +4367,7 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { unexpectedBetweenRightParenAndTrailingClosure?.raw, trailingClosure?.raw, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw, - additionalTrailingClosures?.raw, + additionalTrailingClosures.raw, unexpectedAfterAdditionalTrailingClosures?.raw ] let raw = RawSyntax.makeLayout( @@ -4392,12 +4392,12 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = MacroExpansionDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = MacroExpansionDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -4436,12 +4436,12 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = MacroExpansionDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = MacroExpansionDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -4633,12 +4633,12 @@ public struct MacroExpansionDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? { + public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax { get { - return data.child(at: 19, parent: Syntax(self)).map(MultipleTrailingClosureElementListSyntax.init) + return MultipleTrailingClosureElementListSyntax(data.child(at: 19, parent: Syntax(self))!) } set(value) { - self = MacroExpansionDeclSyntax(data.replacingChild(at: 19, with: value?.data, arena: SyntaxArena())) + self = MacroExpansionDeclSyntax(data.replacingChild(at: 19, with: value.data, arena: SyntaxArena())) } } @@ -4741,9 +4741,9 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndPlaceholder: UnexpectedNodesSyntax? = nil, placeholder: TokenSyntax, _ unexpectedAfterPlaceholder: UnexpectedNodesSyntax? = nil, @@ -4763,9 +4763,9 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndPlaceholder?.raw, placeholder.raw, unexpectedAfterPlaceholder?.raw @@ -4793,12 +4793,12 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// If there were standalone attributes without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = MissingDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = MissingDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -4838,12 +4838,12 @@ public struct MissingDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// If there were standalone modifiers without a declaration to attach them to, the ``MissingDeclSyntax`` will contain these. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = MissingDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = MissingDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -5318,9 +5318,9 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndPrecedencegroupKeyword: UnexpectedNodesSyntax? = nil, precedencegroupKeyword: TokenSyntax = .keyword(.precedencegroup), _ unexpectedBetweenPrecedencegroupKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -5356,9 +5356,9 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndPrecedencegroupKeyword?.raw, precedencegroupKeyword.raw, unexpectedBetweenPrecedencegroupKeywordAndName?.raw, @@ -5394,12 +5394,12 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// The attributes applied to the 'precedencegroup' declaration. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = PrecedenceGroupDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = PrecedenceGroupDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -5439,12 +5439,12 @@ public struct PrecedenceGroupDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// The declaration modifiers applied to the 'precedencegroup' declaration. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = PrecedenceGroupDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = PrecedenceGroupDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -5677,9 +5677,9 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndProtocolKeyword: UnexpectedNodesSyntax? = nil, protocolKeyword: TokenSyntax = .keyword(.protocol), _ unexpectedBetweenProtocolKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -5719,9 +5719,9 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndProtocolKeyword?.raw, protocolKeyword.raw, unexpectedBetweenProtocolKeywordAndName?.raw, @@ -5759,12 +5759,12 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Attributes attached to the protocol declaration, such as an `@available` attribute. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = ProtocolDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = ProtocolDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -5804,12 +5804,12 @@ public struct ProtocolDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Modifiers attached to the protocol declaration, such as `public`. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = ProtocolDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = ProtocolDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -6088,9 +6088,9 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndStructKeyword: UnexpectedNodesSyntax? = nil, structKeyword: TokenSyntax = .keyword(.struct), _ unexpectedBetweenStructKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -6130,9 +6130,9 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndStructKeyword?.raw, structKeyword.raw, unexpectedBetweenStructKeywordAndName?.raw, @@ -6170,12 +6170,12 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Attributes that are attached to the struct declaration. - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = StructDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = StructDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -6215,12 +6215,12 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } /// Modifiers that are attached to the struct declaration. - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = StructDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = StructDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -6435,9 +6435,9 @@ public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndSubscriptKeyword: UnexpectedNodesSyntax? = nil, subscriptKeyword: TokenSyntax = .keyword(.subscript), _ unexpectedBetweenSubscriptKeywordAndGenericParameterClause: UnexpectedNodesSyntax? = nil, @@ -6477,9 +6477,9 @@ public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndSubscriptKeyword?.raw, subscriptKeyword.raw, unexpectedBetweenSubscriptKeywordAndGenericParameterClause?.raw, @@ -6516,12 +6516,12 @@ public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = SubscriptDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = SubscriptDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -6560,12 +6560,12 @@ public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = SubscriptDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = SubscriptDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -6775,9 +6775,9 @@ public struct TypeAliasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndTypealiasKeyword: UnexpectedNodesSyntax? = nil, typealiasKeyword: TokenSyntax = .keyword(.typealias), _ unexpectedBetweenTypealiasKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -6813,9 +6813,9 @@ public struct TypeAliasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndTypealiasKeyword?.raw, typealiasKeyword.raw, unexpectedBetweenTypealiasKeywordAndName?.raw, @@ -6850,12 +6850,12 @@ public struct TypeAliasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = TypeAliasDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = TypeAliasDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -6894,12 +6894,12 @@ public struct TypeAliasDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = TypeAliasDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = TypeAliasDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -7091,9 +7091,9 @@ public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndBindingSpecifier: UnexpectedNodesSyntax? = nil, bindingSpecifier: TokenSyntax, _ unexpectedBetweenBindingSpecifierAndBindings: UnexpectedNodesSyntax? = nil, @@ -7117,9 +7117,9 @@ public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndBindingSpecifier?.raw, bindingSpecifier.raw, unexpectedBetweenBindingSpecifierAndBindings?.raw, @@ -7148,12 +7148,12 @@ public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = VariableDeclSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = VariableDeclSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -7192,12 +7192,12 @@ public struct VariableDeclSyntax: DeclSyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = VariableDeclSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = VariableDeclSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift index 1cd01393618..fbf051226e6 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift @@ -2572,7 +2572,7 @@ public struct FunctionCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -2606,7 +2606,7 @@ public struct FunctionCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { unexpectedBetweenRightParenAndTrailingClosure?.raw, trailingClosure?.raw, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw, - additionalTrailingClosures?.raw, + additionalTrailingClosures.raw, unexpectedAfterAdditionalTrailingClosures?.raw ] let raw = RawSyntax.makeLayout( @@ -2747,12 +2747,12 @@ public struct FunctionCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } - public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? { + public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax { get { - return data.child(at: 11, parent: Syntax(self)).map(MultipleTrailingClosureElementListSyntax.init) + return MultipleTrailingClosureElementListSyntax(data.child(at: 11, parent: Syntax(self))!) } set(value) { - self = FunctionCallExprSyntax(data.replacingChild(at: 11, with: value?.data, arena: SyntaxArena())) + self = FunctionCallExprSyntax(data.replacingChild(at: 11, with: value.data, arena: SyntaxArena())) } } @@ -3960,7 +3960,7 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -4002,7 +4002,7 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { unexpectedBetweenRightParenAndTrailingClosure?.raw, trailingClosure?.raw, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw, - additionalTrailingClosures?.raw, + additionalTrailingClosures.raw, unexpectedAfterAdditionalTrailingClosures?.raw ] let raw = RawSyntax.makeLayout( @@ -4180,12 +4180,12 @@ public struct MacroExpansionExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } - public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? { + public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax { get { - return data.child(at: 15, parent: Syntax(self)).map(MultipleTrailingClosureElementListSyntax.init) + return MultipleTrailingClosureElementListSyntax(data.child(at: 15, parent: Syntax(self))!) } set(value) { - self = MacroExpansionExprSyntax(data.replacingChild(at: 15, with: value?.data, arena: SyntaxArena())) + self = MacroExpansionExprSyntax(data.replacingChild(at: 15, with: value.data, arena: SyntaxArena())) } } @@ -6182,7 +6182,7 @@ public struct SubscriptCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenRightSquareAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, _ unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], _ unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -6216,7 +6216,7 @@ public struct SubscriptCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { unexpectedBetweenRightSquareAndTrailingClosure?.raw, trailingClosure?.raw, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures?.raw, - additionalTrailingClosures?.raw, + additionalTrailingClosures.raw, unexpectedAfterAdditionalTrailingClosures?.raw ] let raw = RawSyntax.makeLayout( @@ -6357,12 +6357,12 @@ public struct SubscriptCallExprSyntax: ExprSyntaxProtocol, SyntaxHashable { } } - public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? { + public var additionalTrailingClosures: MultipleTrailingClosureElementListSyntax { get { - return data.child(at: 11, parent: Syntax(self)).map(MultipleTrailingClosureElementListSyntax.init) + return MultipleTrailingClosureElementListSyntax(data.child(at: 11, parent: Syntax(self))!) } set(value) { - self = SubscriptCallExprSyntax(data.replacingChild(at: 11, with: value?.data, arena: SyntaxArena())) + self = SubscriptCallExprSyntax(data.replacingChild(at: 11, with: value.data, arena: SyntaxArena())) } } diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift index a1c57ab49b7..0a6ecd17e82 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift @@ -1925,7 +1925,7 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBeforeCatchKeyword: UnexpectedNodesSyntax? = nil, catchKeyword: TokenSyntax = .keyword(.catch), _ unexpectedBetweenCatchKeywordAndCatchItems: UnexpectedNodesSyntax? = nil, - catchItems: CatchItemListSyntax? = nil, + catchItems: CatchItemListSyntax = [], _ unexpectedBetweenCatchItemsAndBody: UnexpectedNodesSyntax? = nil, body: CodeBlockSyntax, _ unexpectedAfterBody: UnexpectedNodesSyntax? = nil, @@ -1947,7 +1947,7 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable { unexpectedBeforeCatchKeyword?.raw, catchKeyword.raw, unexpectedBetweenCatchKeywordAndCatchItems?.raw, - catchItems?.raw, + catchItems.raw, unexpectedBetweenCatchItemsAndBody?.raw, body.raw, unexpectedAfterBody?.raw @@ -1992,12 +1992,12 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable { } } - public var catchItems: CatchItemListSyntax? { + public var catchItems: CatchItemListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(CatchItemListSyntax.init) + return CatchItemListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = CatchClauseSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = CatchClauseSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -2259,7 +2259,7 @@ public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBeforeLeftSquare: UnexpectedNodesSyntax? = nil, leftSquare: TokenSyntax = .leftSquareToken(), _ unexpectedBetweenLeftSquareAndItems: UnexpectedNodesSyntax? = nil, - items: ClosureCaptureListSyntax? = nil, + items: ClosureCaptureListSyntax, _ unexpectedBetweenItemsAndRightSquare: UnexpectedNodesSyntax? = nil, rightSquare: TokenSyntax = .rightSquareToken(), _ unexpectedAfterRightSquare: UnexpectedNodesSyntax? = nil, @@ -2281,7 +2281,7 @@ public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable { unexpectedBeforeLeftSquare?.raw, leftSquare.raw, unexpectedBetweenLeftSquareAndItems?.raw, - items?.raw, + items.raw, unexpectedBetweenItemsAndRightSquare?.raw, rightSquare.raw, unexpectedAfterRightSquare?.raw @@ -2326,12 +2326,12 @@ public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable { } } - public var items: ClosureCaptureListSyntax? { + public var items: ClosureCaptureListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(ClosureCaptureListSyntax.init) + return ClosureCaptureListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = ClosureCaptureClauseSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = ClosureCaptureClauseSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -3023,9 +3023,9 @@ public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndFirstName: UnexpectedNodesSyntax? = nil, firstName: TokenSyntax, _ unexpectedBetweenFirstNameAndSecondName: UnexpectedNodesSyntax? = nil, @@ -3065,9 +3065,9 @@ public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndFirstName?.raw, firstName.raw, unexpectedBetweenFirstNameAndSecondName?.raw, @@ -3104,12 +3104,12 @@ public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = ClosureParameterSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = ClosureParameterSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -3148,12 +3148,12 @@ public struct ClosureParameterSyntax: SyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = ClosureParameterSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = ClosureParameterSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -3537,7 +3537,7 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndCapture: UnexpectedNodesSyntax? = nil, capture: ClosureCaptureClauseSyntax? = nil, _ unexpectedBetweenCaptureAndParameterClause: UnexpectedNodesSyntax? = nil, @@ -3571,7 +3571,7 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndCapture?.raw, capture?.raw, unexpectedBetweenCaptureAndParameterClause?.raw, @@ -3606,12 +3606,12 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = ClosureSignatureSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = ClosureSignatureSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -7776,7 +7776,7 @@ public struct EnumCaseParameterSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndFirstName: UnexpectedNodesSyntax? = nil, firstName: TokenSyntax? = nil, _ unexpectedBetweenFirstNameAndSecondName: UnexpectedNodesSyntax? = nil, @@ -7814,7 +7814,7 @@ public struct EnumCaseParameterSyntax: SyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndFirstName?.raw, firstName?.raw, unexpectedBetweenFirstNameAndSecondName?.raw, @@ -7851,12 +7851,12 @@ public struct EnumCaseParameterSyntax: SyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = EnumCaseParameterSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = EnumCaseParameterSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -8768,9 +8768,9 @@ public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], _ unexpectedBetweenModifiersAndFirstName: UnexpectedNodesSyntax? = nil, firstName: TokenSyntax, _ unexpectedBetweenFirstNameAndSecondName: UnexpectedNodesSyntax? = nil, @@ -8814,9 +8814,9 @@ public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndModifiers?.raw, - modifiers?.raw, + modifiers.raw, unexpectedBetweenModifiersAndFirstName?.raw, firstName.raw, unexpectedBetweenFirstNameAndSecondName?.raw, @@ -8855,12 +8855,12 @@ public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = FunctionParameterSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = FunctionParameterSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -8899,12 +8899,12 @@ public struct FunctionParameterSyntax: SyntaxProtocol, SyntaxHashable { } } - public var modifiers: DeclModifierListSyntax? { + public var modifiers: DeclModifierListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(DeclModifierListSyntax.init) + return DeclModifierListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = FunctionParameterSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = FunctionParameterSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } @@ -9827,7 +9827,7 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { public init( leadingTrivia: Trivia? = nil, _ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndEachKeyword: UnexpectedNodesSyntax? = nil, eachKeyword: TokenSyntax? = nil, _ unexpectedBetweenEachKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -9861,7 +9861,7 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { ))) { (arena, _) in let layout: [RawSyntax?] = [ unexpectedBeforeAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndEachKeyword?.raw, eachKeyword?.raw, unexpectedBetweenEachKeywordAndName?.raw, @@ -9896,12 +9896,12 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 1, parent: Syntax(self))!) } set(value) { - self = GenericParameterSyntax(data.replacingChild(at: 1, with: value?.data, arena: SyntaxArena())) + self = GenericParameterSyntax(data.replacingChild(at: 1, with: value.data, arena: SyntaxArena())) } } @@ -19003,7 +19003,7 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { _ unexpectedBeforeMajor: UnexpectedNodesSyntax? = nil, major: TokenSyntax, _ unexpectedBetweenMajorAndComponents: UnexpectedNodesSyntax? = nil, - components: VersionComponentListSyntax? = nil, + components: VersionComponentListSyntax, _ unexpectedAfterComponents: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -19021,7 +19021,7 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { unexpectedBeforeMajor?.raw, major.raw, unexpectedBetweenMajorAndComponents?.raw, - components?.raw, + components.raw, unexpectedAfterComponents?.raw ] let raw = RawSyntax.makeLayout( @@ -19066,12 +19066,12 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable { } /// Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0` - public var components: VersionComponentListSyntax? { + public var components: VersionComponentListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(VersionComponentListSyntax.init) + return VersionComponentListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = VersionTupleSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = VersionTupleSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift index 48729900771..642c7bb8c79 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift @@ -540,7 +540,7 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { _ unexpectedBetweenDoKeywordAndBody: UnexpectedNodesSyntax? = nil, body: CodeBlockSyntax, _ unexpectedBetweenBodyAndCatchClauses: UnexpectedNodesSyntax? = nil, - catchClauses: CatchClauseListSyntax? = nil, + catchClauses: CatchClauseListSyntax = [], _ unexpectedAfterCatchClauses: UnexpectedNodesSyntax? = nil, trailingTrivia: Trivia? = nil @@ -562,7 +562,7 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { unexpectedBetweenDoKeywordAndBody?.raw, body.raw, unexpectedBetweenBodyAndCatchClauses?.raw, - catchClauses?.raw, + catchClauses.raw, unexpectedAfterCatchClauses?.raw ] let raw = RawSyntax.makeLayout( @@ -623,12 +623,12 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable { } } - public var catchClauses: CatchClauseListSyntax? { + public var catchClauses: CatchClauseListSyntax { get { - return data.child(at: 5, parent: Syntax(self)).map(CatchClauseListSyntax.init) + return CatchClauseListSyntax(data.child(at: 5, parent: Syntax(self))!) } set(value) { - self = DoStmtSyntax(data.replacingChild(at: 5, with: value?.data, arena: SyntaxArena())) + self = DoStmtSyntax(data.replacingChild(at: 5, with: value.data, arena: SyntaxArena())) } } diff --git a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift index 3a292272791..5a1710b5a65 100644 --- a/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift +++ b/Sources/SwiftSyntax/generated/syntaxNodes/SyntaxTypeNodes.swift @@ -196,7 +196,7 @@ public struct AttributedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { _ unexpectedBeforeSpecifier: UnexpectedNodesSyntax? = nil, specifier: TokenSyntax? = nil, _ unexpectedBetweenSpecifierAndAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], _ unexpectedBetweenAttributesAndBaseType: UnexpectedNodesSyntax? = nil, baseType: some TypeSyntaxProtocol, _ unexpectedAfterBaseType: UnexpectedNodesSyntax? = nil, @@ -218,7 +218,7 @@ public struct AttributedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { unexpectedBeforeSpecifier?.raw, specifier?.raw, unexpectedBetweenSpecifierAndAttributes?.raw, - attributes?.raw, + attributes.raw, unexpectedBetweenAttributesAndBaseType?.raw, baseType.raw, unexpectedAfterBaseType?.raw @@ -263,12 +263,12 @@ public struct AttributedTypeSyntax: TypeSyntaxProtocol, SyntaxHashable { } } - public var attributes: AttributeListSyntax? { + public var attributes: AttributeListSyntax { get { - return data.child(at: 3, parent: Syntax(self)).map(AttributeListSyntax.init) + return AttributeListSyntax(data.child(at: 3, parent: Syntax(self))!) } set(value) { - self = AttributedTypeSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena())) + self = AttributedTypeSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena())) } } diff --git a/Sources/SwiftSyntaxBuilder/CMakeLists.txt b/Sources/SwiftSyntaxBuilder/CMakeLists.txt index 895f8eee63e..36f5f1c9008 100644 --- a/Sources/SwiftSyntaxBuilder/CMakeLists.txt +++ b/Sources/SwiftSyntaxBuilder/CMakeLists.txt @@ -19,7 +19,6 @@ add_swift_host_library(SwiftSyntaxBuilder WithTrailingCommaSyntax+EnsuringTrailingComma.swift - generated/BuildableCollectionNodes.swift generated/BuildableNodes.swift generated/ResultBuilders.swift generated/RenamedChildrenBuilderCompatibility.swift diff --git a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift index 5152d73097f..6c4c3a302b9 100644 --- a/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift +++ b/Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift @@ -172,7 +172,7 @@ extension FunctionCallExprSyntax { public init( callee: some ExprSyntaxProtocol, trailingClosure: ClosureExprSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], @LabeledExprListBuilder argumentList: () -> LabeledExprListSyntax = { [] } ) { let argumentList = argumentList() @@ -358,8 +358,8 @@ extension VariableDeclSyntax { /// Creates an optionally initialized property. public init( leadingTrivia: Trivia = [], - attributes: AttributeListSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + attributes: AttributeListSyntax = [], + modifiers: DeclModifierListSyntax = [], _ bindingSpecifier: Keyword, name: PatternSyntax, type: TypeAnnotationSyntax? = nil, @@ -367,7 +367,7 @@ extension VariableDeclSyntax { ) { self.init( leadingTrivia: leadingTrivia, - attributes: attributes?.with(\.trailingTrivia, .space), + attributes: attributes.with(\.trailingTrivia, .space), modifiers: modifiers, bindingSpecifier: .keyword(bindingSpecifier) ) { diff --git a/Sources/SwiftSyntaxBuilder/ResultBuilderExtensions.swift b/Sources/SwiftSyntaxBuilder/ResultBuilderExtensions.swift index 4ea1a20407f..ebf0a04690d 100644 --- a/Sources/SwiftSyntaxBuilder/ResultBuilderExtensions.swift +++ b/Sources/SwiftSyntaxBuilder/ResultBuilderExtensions.swift @@ -49,3 +49,21 @@ extension MemberBlockItemListBuilder { return buildExpression(MemberBlockItemSyntax(decl: expression)) } } + +// MARK: Initializing collections from protocols +// These initializers allow the creation of syntax collections that have a base +// node as their element from the corresponding protocol type. +// These are used by the result builders. +// Since we only have two of these, it doesn’t make sense to generate them. + +extension ExprListSyntax { + init(_ elements: [ExprSyntaxProtocol]) { + self = ExprListSyntax(elements.map { ExprSyntax(fromProtocol: $0) } as [ExprSyntax]) + } +} + +extension UnexpectedNodesSyntax { + public init(_ elements: [SyntaxProtocol]) { + self = UnexpectedNodesSyntax(elements.map { Syntax(fromProtocol: $0) } as [Syntax]) + } +} diff --git a/Sources/SwiftSyntaxBuilder/generated/BuildableCollectionNodes.swift b/Sources/SwiftSyntaxBuilder/generated/BuildableCollectionNodes.swift deleted file mode 100644 index e419047fe38..00000000000 --- a/Sources/SwiftSyntaxBuilder/generated/BuildableCollectionNodes.swift +++ /dev/null @@ -1,321 +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 -// -//===----------------------------------------------------------------------===// - -import SwiftSyntax - -extension AccessorDeclListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ArrayElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension AttributeListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension AvailabilityArgumentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension CatchClauseListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension CatchItemListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ClosureCaptureListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ClosureParameterListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ClosureShorthandParameterListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension CodeBlockItemListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension CompositionTypeElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ConditionElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension DeclModifierListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension DeclNameArgumentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension DesignatedTypeListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension DictionaryElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension DifferentiabilityArgumentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension DocumentationAttributeArgumentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension EffectsAttributeArgumentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension EnumCaseElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension EnumCaseParameterListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ExprListSyntax: ExpressibleByArrayLiteral { - public init(_ elements: [ExprSyntaxProtocol]) { - self = ExprListSyntax(elements.map { - ExprSyntax(fromProtocol: $0) - } as [ExprSyntax]) - } - - public init(arrayLiteral elements: ExprSyntaxProtocol...) { - self.init(elements) - } -} - -extension FunctionParameterListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension GenericArgumentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension GenericParameterListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension GenericRequirementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension IfConfigClauseListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ImportPathComponentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension InheritedTypeListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension KeyPathComponentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension LabeledExprListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension MemberBlockItemListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension MultipleTrailingClosureElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension ObjCSelectorPieceListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension PatternBindingListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension PlatformVersionItemListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension PrecedenceGroupAttributeListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension PrecedenceGroupNameListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension PrimaryAssociatedTypeListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension SimpleStringLiteralSegmentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension SpecializeAttributeArgumentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension StringLiteralSegmentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension SwitchCaseItemListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension SwitchCaseListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension TuplePatternElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension TupleTypeElementListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension UnexpectedNodesSyntax: ExpressibleByArrayLiteral { - public init(_ elements: [SyntaxProtocol]) { - self = UnexpectedNodesSyntax(elements.map { - Syntax(fromProtocol: $0) - } as [Syntax]) - } - - public init(arrayLiteral elements: SyntaxProtocol...) { - self.init(elements) - } -} - -extension VersionComponentListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} - -extension YieldedExpressionListSyntax: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: Element...) { - self.init(elements) - } -} diff --git a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift index ea96496583d..2064d31c349 100644 --- a/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift +++ b/Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift @@ -19,7 +19,7 @@ extension AccessorDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifier: UnexpectedNodesSyntax? = nil, modifier: DeclModifierSyntax? = nil, unexpectedBetweenModifierAndAccessorSpecifier: UnexpectedNodesSyntax? = nil, @@ -60,9 +60,9 @@ extension ActorDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndActorKeyword: UnexpectedNodesSyntax? = nil, actorKeyword: TokenSyntax = .keyword(.actor), unexpectedBetweenActorKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -136,7 +136,7 @@ extension CatchClauseSyntax { unexpectedBeforeCatchKeyword: UnexpectedNodesSyntax? = nil, catchKeyword: TokenSyntax = .keyword(.catch), unexpectedBetweenCatchKeywordAndCatchItems: UnexpectedNodesSyntax? = nil, - catchItems: CatchItemListSyntax? = nil, + catchItems: CatchItemListSyntax = [], unexpectedBetweenCatchItemsAndBody: UnexpectedNodesSyntax? = nil, unexpectedAfterBody: UnexpectedNodesSyntax? = nil, @CodeBlockItemListBuilder bodyBuilder: () throws -> CodeBlockItemListSyntax, @@ -161,9 +161,9 @@ extension ClassDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndClassKeyword: UnexpectedNodesSyntax? = nil, classKeyword: TokenSyntax = .keyword(.class), unexpectedBetweenClassKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -213,7 +213,7 @@ extension ClosureCaptureClauseSyntax { unexpectedBetweenItemsAndRightSquare: UnexpectedNodesSyntax? = nil, rightSquare: TokenSyntax = .rightSquareToken(), unexpectedAfterRightSquare: UnexpectedNodesSyntax? = nil, - @ClosureCaptureListBuilder itemsBuilder: () throws -> ClosureCaptureListSyntax?, + @ClosureCaptureListBuilder itemsBuilder: () throws -> ClosureCaptureListSyntax, trailingTrivia: Trivia? = nil ) rethrows { try self.init( @@ -316,9 +316,9 @@ extension DeinitializerDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndDeinitKeyword: UnexpectedNodesSyntax? = nil, deinitKeyword: TokenSyntax = .keyword(.deinit), unexpectedBetweenDeinitKeywordAndEffectSpecifiers: UnexpectedNodesSyntax? = nil, @@ -356,7 +356,7 @@ extension DoStmtSyntax { doKeyword: TokenSyntax = .keyword(.do), unexpectedBetweenDoKeywordAndBody: UnexpectedNodesSyntax? = nil, unexpectedBetweenBodyAndCatchClauses: UnexpectedNodesSyntax? = nil, - catchClauses: CatchClauseListSyntax? = nil, + catchClauses: CatchClauseListSyntax = [], unexpectedAfterCatchClauses: UnexpectedNodesSyntax? = nil, @CodeBlockItemListBuilder bodyBuilder: () throws -> CodeBlockItemListSyntax, trailingTrivia: Trivia? = nil @@ -380,9 +380,9 @@ extension EnumCaseDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndCaseKeyword: UnexpectedNodesSyntax? = nil, caseKeyword: TokenSyntax = .keyword(.case), unexpectedBetweenCaseKeywordAndElements: UnexpectedNodesSyntax? = nil, @@ -411,9 +411,9 @@ extension EnumDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndEnumKeyword: UnexpectedNodesSyntax? = nil, enumKeyword: TokenSyntax = .keyword(.enum), unexpectedBetweenEnumKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -493,9 +493,9 @@ extension ExtensionDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndExtensionKeyword: UnexpectedNodesSyntax? = nil, extensionKeyword: TokenSyntax = .keyword(.extension), unexpectedBetweenExtensionKeywordAndExtendedType: UnexpectedNodesSyntax? = nil, @@ -600,7 +600,7 @@ extension FunctionCallExprSyntax { unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentsBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -630,9 +630,9 @@ extension FunctionDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndFuncKeyword: UnexpectedNodesSyntax? = nil, funcKeyword: TokenSyntax = .keyword(.func), unexpectedBetweenFuncKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -876,9 +876,9 @@ extension InitializerDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndInitKeyword: UnexpectedNodesSyntax? = nil, initKeyword: TokenSyntax = .keyword(.`init`), unexpectedBetweenInitKeywordAndOptionalMark: UnexpectedNodesSyntax? = nil, @@ -952,9 +952,9 @@ extension MacroExpansionDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndPound: UnexpectedNodesSyntax? = nil, pound: TokenSyntax = .poundToken(), unexpectedBetweenPoundAndMacroName: UnexpectedNodesSyntax? = nil, @@ -969,7 +969,7 @@ extension MacroExpansionDeclSyntax { unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentsBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -1020,7 +1020,7 @@ extension MacroExpansionExprSyntax { unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentsBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -1081,9 +1081,9 @@ extension ProtocolDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndProtocolKeyword: UnexpectedNodesSyntax? = nil, protocolKeyword: TokenSyntax = .keyword(.protocol), unexpectedBetweenProtocolKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -1201,9 +1201,9 @@ extension StructDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndStructKeyword: UnexpectedNodesSyntax? = nil, structKeyword: TokenSyntax = .keyword(.struct), unexpectedBetweenStructKeywordAndName: UnexpectedNodesSyntax? = nil, @@ -1257,7 +1257,7 @@ extension SubscriptCallExprSyntax { unexpectedBetweenRightSquareAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentsBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -1430,9 +1430,9 @@ extension VariableDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndBindingSpecifier: UnexpectedNodesSyntax? = nil, bindingSpecifier: TokenSyntax, unexpectedBetweenBindingSpecifierAndBindings: UnexpectedNodesSyntax? = nil, diff --git a/Sources/SwiftSyntaxBuilder/generated/RenamedChildrenBuilderCompatibility.swift b/Sources/SwiftSyntaxBuilder/generated/RenamedChildrenBuilderCompatibility.swift index 7a9d25c9d3e..ecaee9bce5c 100644 --- a/Sources/SwiftSyntaxBuilder/generated/RenamedChildrenBuilderCompatibility.swift +++ b/Sources/SwiftSyntaxBuilder/generated/RenamedChildrenBuilderCompatibility.swift @@ -21,7 +21,7 @@ extension AccessorDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifier: UnexpectedNodesSyntax? = nil, modifier: DeclModifierSyntax? = nil, unexpectedBetweenModifierAndAccessorKind: UnexpectedNodesSyntax? = nil, @@ -64,9 +64,9 @@ extension ActorDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndActorKeyword: UnexpectedNodesSyntax? = nil, actorKeyword: TokenSyntax = .keyword(.actor), unexpectedBetweenActorKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -142,9 +142,9 @@ extension ClassDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndClassKeyword: UnexpectedNodesSyntax? = nil, classKeyword: TokenSyntax = .keyword(.class), unexpectedBetweenClassKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -191,9 +191,9 @@ extension EnumDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndEnumKeyword: UnexpectedNodesSyntax? = nil, enumKeyword: TokenSyntax = .keyword(.enum), unexpectedBetweenEnumKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -343,7 +343,7 @@ extension FunctionCallExprSyntax { unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentListBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -375,9 +375,9 @@ extension FunctionDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndFuncKeyword: UnexpectedNodesSyntax? = nil, funcKeyword: TokenSyntax = .keyword(.func), unexpectedBetweenFuncKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -596,9 +596,9 @@ extension MacroExpansionDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndPoundToken: UnexpectedNodesSyntax? = nil, poundToken: TokenSyntax = .poundToken(), unexpectedBetweenPoundTokenAndMacro: UnexpectedNodesSyntax? = nil, @@ -613,7 +613,7 @@ extension MacroExpansionDeclSyntax { unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentListBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -666,7 +666,7 @@ extension MacroExpansionExprSyntax { unexpectedBetweenRightParenAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentListBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -702,9 +702,9 @@ extension ProtocolDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndProtocolKeyword: UnexpectedNodesSyntax? = nil, protocolKeyword: TokenSyntax = .keyword(.protocol), unexpectedBetweenProtocolKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -776,9 +776,9 @@ extension StructDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndStructKeyword: UnexpectedNodesSyntax? = nil, structKeyword: TokenSyntax = .keyword(.struct), unexpectedBetweenStructKeywordAndIdentifier: UnexpectedNodesSyntax? = nil, @@ -834,7 +834,7 @@ extension SubscriptCallExprSyntax { unexpectedBetweenRightBracketAndTrailingClosure: UnexpectedNodesSyntax? = nil, trailingClosure: ClosureExprSyntax? = nil, unexpectedBetweenTrailingClosureAndAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, - additionalTrailingClosures: MultipleTrailingClosureElementListSyntax? = nil, + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax = [], unexpectedAfterAdditionalTrailingClosures: UnexpectedNodesSyntax? = nil, @LabeledExprListBuilder argumentListBuilder: () throws -> LabeledExprListSyntax, trailingTrivia: Trivia? = nil @@ -961,9 +961,9 @@ extension VariableDeclSyntax { public init( leadingTrivia: Trivia? = nil, unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil, - attributes: AttributeListSyntax? = nil, + attributes: AttributeListSyntax = [], unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil, - modifiers: DeclModifierListSyntax? = nil, + modifiers: DeclModifierListSyntax = [], unexpectedBetweenModifiersAndBindingKeyword: UnexpectedNodesSyntax? = nil, bindingKeyword: TokenSyntax, unexpectedBetweenBindingKeywordAndBindings: UnexpectedNodesSyntax? = nil, diff --git a/Sources/SwiftSyntaxMacroExpansion/MacroExpansion.swift b/Sources/SwiftSyntaxMacroExpansion/MacroExpansion.swift index 75b60e6ec8d..a810d85b476 100644 --- a/Sources/SwiftSyntaxMacroExpansion/MacroExpansion.swift +++ b/Sources/SwiftSyntaxMacroExpansion/MacroExpansion.swift @@ -106,8 +106,8 @@ public func expandFreestandingMacro( if let expansionDecl = node.as(MacroExpansionDeclSyntax.self) { // Strip any indentation from the attributes and modifiers that we are // inheriting. The expanded macro should start at the leftmost column. - let attributes = declMacroDef.propagateFreestandingMacroAttributes ? expansionDecl.attributes?.withIndentationRemoved : nil - let modifiers = declMacroDef.propagateFreestandingMacroModifiers ? expansionDecl.modifiers?.withIndentationRemoved : nil + let attributes = declMacroDef.propagateFreestandingMacroAttributes ? expansionDecl.attributes.withIndentationRemoved : nil + let modifiers = declMacroDef.propagateFreestandingMacroModifiers ? expansionDecl.modifiers.withIndentationRemoved : nil rewritten = rewritten.map { $0.applying(attributes: attributes, modifiers: modifiers) } @@ -363,7 +363,7 @@ fileprivate extension DeclSyntax { attributes: AttributeListSyntax?, modifiers: DeclModifierListSyntax? ) -> DeclSyntax { - func _combine(_ left: C, _ right: C?) -> C? { + func _combine(_ left: C, _ right: C?) -> C { guard let right = right else { return left } var elems: [C.Element] = [] elems += left diff --git a/Sources/SwiftSyntaxMacroExpansion/MacroSystem.swift b/Sources/SwiftSyntaxMacroExpansion/MacroSystem.swift index d672494c131..81d6c9cc648 100644 --- a/Sources/SwiftSyntaxMacroExpansion/MacroSystem.swift +++ b/Sources/SwiftSyntaxMacroExpansion/MacroSystem.swift @@ -491,7 +491,7 @@ private class MacroApplication: SyntaxRewriter { if let declSyntax = node.as(DeclSyntax.self), let attributedNode = node.asProtocol(WithAttributesSyntax.self), - !(attributedNode.attributes?.isEmpty ?? true) + !attributedNode.attributes.isEmpty { // Visit the node, disabling the `visitAny` handling. skipVisitAnyHandling.insert(node) @@ -579,9 +579,7 @@ private class MacroApplication: SyntaxRewriter { ) .map { visit($0) } if !newAttributes.isEmpty { - if let existingAttrs = decl.attributes { - newAttributes.insert(contentsOf: existingAttrs, at: 0) - } + newAttributes.insert(contentsOf: decl.attributes, at: 0) item.decl = decl.with(\.attributes, AttributeListSyntax(newAttributes)).cast(DeclSyntax.self) } } @@ -626,13 +624,11 @@ extension MacroApplication { private func macroAttributes( attachedTo decl: DeclSyntax ) -> [(attributeNode: AttributeSyntax, definition: Macro.Type)] { - guard let attributedNode = decl.asProtocol(WithAttributesSyntax.self), - let attributes = attributedNode.attributes - else { + guard let attributedNode = decl.asProtocol(WithAttributesSyntax.self) else { return [] } - return attributes.compactMap { + return attributedNode.attributes.compactMap { guard case let .attribute(attribute) = $0, let attributeName = attribute.attributeName.as(IdentifierTypeSyntax.self)?.name.text, let macro = macroSystem.lookup(attributeName) diff --git a/Tests/SwiftParserTest/AvailabilityTests.swift b/Tests/SwiftParserTest/AvailabilityTests.swift index 9dc2904bd02..506699259fb 100644 --- a/Tests/SwiftParserTest/AvailabilityTests.swift +++ b/Tests/SwiftParserTest/AvailabilityTests.swift @@ -107,7 +107,8 @@ final class AvailabilityTests: ParserTestCase { func test() {} """, substructure: VersionTupleSyntax( - major: .integerLiteral("10") + major: .integerLiteral("10"), + components: [] ) ) diff --git a/Tests/SwiftParserTest/RegexLiteralTests.swift b/Tests/SwiftParserTest/RegexLiteralTests.swift index 30fc6feeb63..dabcbfff912 100644 --- a/Tests/SwiftParserTest/RegexLiteralTests.swift +++ b/Tests/SwiftParserTest/RegexLiteralTests.swift @@ -1255,13 +1255,11 @@ final class RegexLiteralTests: ParserTestCase { """ let x = true ?/abc/ : /def/ """, - substructure: SequenceExprSyntax( - elements: .init([ - BooleanLiteralExprSyntax(booleanLiteral: true), - UnresolvedTernaryExprSyntax(thenExpression: RegexLiteralExprSyntax(regex: .regexLiteralPattern("abc"))), - RegexLiteralExprSyntax(regex: .regexLiteralPattern("def")), - ]) - ) + substructure: SequenceExprSyntax { + BooleanLiteralExprSyntax(booleanLiteral: true) + UnresolvedTernaryExprSyntax(thenExpression: RegexLiteralExprSyntax(regex: .regexLiteralPattern("abc"))) + RegexLiteralExprSyntax(regex: .regexLiteralPattern("def")) + } ) } diff --git a/Tests/SwiftParserTest/StatementTests.swift b/Tests/SwiftParserTest/StatementTests.swift index f1ea85d05fc..314e35a5314 100644 --- a/Tests/SwiftParserTest/StatementTests.swift +++ b/Tests/SwiftParserTest/StatementTests.swift @@ -537,13 +537,11 @@ final class StatementTests: ParserTestCase { 1️⃣yield & 5 } """, - substructure: SequenceExprSyntax( - elements: ExprListSyntax([ - DeclReferenceExprSyntax(baseName: .identifier("yield")), - BinaryOperatorExprSyntax(operator: .binaryOperator("&")), - IntegerLiteralExprSyntax(5), - ]) - ), + substructure: SequenceExprSyntax { + DeclReferenceExprSyntax(baseName: .identifier("yield")) + BinaryOperatorExprSyntax(operator: .binaryOperator("&")) + IntegerLiteralExprSyntax(5) + }, substructureAfterMarker: "1️⃣" ) @@ -553,13 +551,11 @@ final class StatementTests: ParserTestCase { 1️⃣yield&5 } """, - substructure: SequenceExprSyntax( - elements: ExprListSyntax([ - DeclReferenceExprSyntax(baseName: .identifier("yield")), - BinaryOperatorExprSyntax(operator: .binaryOperator("&")), - IntegerLiteralExprSyntax(5), - ]) - ), + substructure: SequenceExprSyntax { + DeclReferenceExprSyntax(baseName: .identifier("yield")) + BinaryOperatorExprSyntax(operator: .binaryOperator("&")) + IntegerLiteralExprSyntax(5) + }, substructureAfterMarker: "1️⃣" ) } diff --git a/Tests/SwiftParserTest/translated/ForwardSlashRegexTests.swift b/Tests/SwiftParserTest/translated/ForwardSlashRegexTests.swift index 1b0a9e7cbd9..11f45f1d34b 100644 --- a/Tests/SwiftParserTest/translated/ForwardSlashRegexTests.swift +++ b/Tests/SwiftParserTest/translated/ForwardSlashRegexTests.swift @@ -361,19 +361,17 @@ final class ForwardSlashRegexTests: ParserTestCase { """ _ = /x/??/x/ """, - substructure: SequenceExprSyntax( - elements: .init([ - DiscardAssignmentExprSyntax(), - AssignmentExprSyntax(), - OptionalChainingExprSyntax( - expression: OptionalChainingExprSyntax( - expression: RegexLiteralExprSyntax(regex: .regexLiteralPattern("x")) - ) - ), - BinaryOperatorExprSyntax(operator: .binaryOperator("/")), - PostfixOperatorExprSyntax(expression: DeclReferenceExprSyntax(baseName: "x"), operator: .postfixOperator("/")), - ]) - ) + substructure: SequenceExprSyntax { + DiscardAssignmentExprSyntax() + AssignmentExprSyntax() + OptionalChainingExprSyntax( + expression: OptionalChainingExprSyntax( + expression: RegexLiteralExprSyntax(regex: .regexLiteralPattern("x")) + ) + ) + BinaryOperatorExprSyntax(operator: .binaryOperator("/")) + PostfixOperatorExprSyntax(expression: DeclReferenceExprSyntax(baseName: "x"), operator: .postfixOperator("/")) + } ) } diff --git a/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift b/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift index 6ac366ac0ab..77e974d4903 100644 --- a/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ExprListTests.swift @@ -17,8 +17,22 @@ import SwiftSyntaxBuilder final class ExprListTests: XCTestCase { func testExprList() { let testCases: [UInt: (ExprListSyntax, String)] = [ - #line: (ExprListSyntax([IntegerLiteralExprSyntax(1), BinaryOperatorExprSyntax(text: "+"), FloatLiteralExprSyntax(2.34)]), "1 + 2.34"), - #line: ([IntegerLiteralExprSyntax(1), BinaryOperatorExprSyntax(text: "+"), FloatLiteralExprSyntax(2.34)], "1 + 2.34"), + #line: ( + ExprListSyntax( + [ + ExprSyntax(IntegerLiteralExprSyntax(1)), + ExprSyntax(BinaryOperatorExprSyntax(text: "+")), + ExprSyntax(FloatLiteralExprSyntax(2.34)), + ] + ), "1 + 2.34" + ), + #line: ( + [ + ExprSyntax(IntegerLiteralExprSyntax(1)), + ExprSyntax(BinaryOperatorExprSyntax(text: "+")), + ExprSyntax(FloatLiteralExprSyntax(2.34)), + ], "1 + 2.34" + ), ] for (line, testCase) in testCases { diff --git a/Tests/SwiftSyntaxMacroExpansionTest/MacroSystemTests.swift b/Tests/SwiftSyntaxMacroExpansionTest/MacroSystemTests.swift index b9613966303..2ad736936b5 100644 --- a/Tests/SwiftSyntaxMacroExpansionTest/MacroSystemTests.swift +++ b/Tests/SwiftSyntaxMacroExpansionTest/MacroSystemTests.swift @@ -343,14 +343,12 @@ public struct AddCompletionHandler: PeerMacro { """ // Drop the @addCompletionHandler attribute from the new declaration. - let newAttributeList = AttributeListSyntax( - funcDecl.attributes?.filter { - guard case let .attribute(attribute) = $0 else { - return true - } - return attribute.attributeName.as(IdentifierTypeSyntax.self)?.name == "addCompletionHandler" - } ?? [] - ) + let newAttributeList = funcDecl.attributes.filter { + guard case let .attribute(attribute) = $0 else { + return true + } + return attribute.attributeName.as(IdentifierTypeSyntax.self)?.name == "addCompletionHandler" + } let newFunc = funcDecl diff --git a/Tests/SwiftSyntaxTest/DebugDescriptionTests.swift b/Tests/SwiftSyntaxTest/DebugDescriptionTests.swift index e47ec588499..f92c75487ba 100644 --- a/Tests/SwiftSyntaxTest/DebugDescriptionTests.swift +++ b/Tests/SwiftSyntaxTest/DebugDescriptionTests.swift @@ -192,7 +192,8 @@ public class DebugDescriptionTests: XCTestCase { ), LabeledExprSyntax(expression: ExprSyntax(IntegerLiteralExprSyntax(literal: .integerLiteral("2")))) ]), - rightParen: .rightParenToken() + rightParen: .rightParenToken(), + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax([]) ))) ]), endOfFileToken: .endOfFileToken() @@ -215,7 +216,8 @@ public class DebugDescriptionTests: XCTestCase { ), LabeledExprSyntax(expression: ExprSyntax(IntegerLiteralExprSyntax(literal: .integerLiteral("2")))) ]), - rightParen: .rightParenToken() + rightParen: .rightParenToken(), + additionalTrailingClosures: MultipleTrailingClosureElementListSyntax([]) ))) ]), endOfFileToken: .endOfFileToken() diff --git a/Tests/SwiftSyntaxTest/RawSyntaxTests.swift b/Tests/SwiftSyntaxTest/RawSyntaxTests.swift index 791579dd6d6..2bc87ed3c1e 100644 --- a/Tests/SwiftSyntaxTest/RawSyntaxTests.swift +++ b/Tests/SwiftSyntaxTest/RawSyntaxTests.swift @@ -53,8 +53,8 @@ fileprivate func cannedStructDecl(arena: SyntaxArena) -> RawStructDeclSyntax { arena: arena ) return RawStructDeclSyntax( - attributes: nil, - modifiers: nil, + attributes: RawAttributeListSyntax(elements: [], arena: arena), + modifiers: RawDeclModifierListSyntax(elements: [], arena: arena), structKeyword: structKW, name: fooID, genericParameterClause: nil,