Skip to content

Commit 4007f33

Browse files
committed
Conform all SyntaxChildChoices to SyntaxHashable
1 parent 1da5f5f commit 4007f33

File tree

8 files changed

+24
-25
lines changed

8 files changed

+24
-25
lines changed

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxCollectionsFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let syntaxCollectionsFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
4141
} else {
4242
try EnumDeclSyntax(
4343
"""
44-
public enum Element: SyntaxChildChoices
44+
public enum Element: SyntaxChildChoices, SyntaxHashable
4545
"""
4646
) {
4747
for choiceName in node.elementChoices {

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private func generateSyntaxChildChoices(for child: Child) throws -> EnumDeclSynt
241241
return nil
242242
}
243243

244-
return try! EnumDeclSyntax("public enum \(raw: child.name): SyntaxChildChoices") {
244+
return try! EnumDeclSyntax("public enum \(raw: child.name): SyntaxChildChoices, SyntaxHashable") {
245245
for choice in choices {
246246
DeclSyntax("case `\(choice.varOrCaseName)`(\(raw: choice.syntaxNodeKind.syntaxType))")
247247
}

Sources/SwiftParser/CollectionNodes+Parsable.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ extension AccessorDeclListSyntax: SyntaxParseable {
6363
accessorSpecifier: RawTokenSyntax(missing: .keyword, text: "get", arena: arena),
6464
parameters: nil,
6565
effectSpecifiers: nil,
66-
initEffects: nil,
6766
body: nil,
6867
arena: arena
6968
)

Sources/SwiftSyntax/generated/SyntaxCollections.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public struct ArrayElementListSyntax: SyntaxCollection, SyntaxHashable {
9090
/// - ``TypeAliasDeclSyntax``.``TypeAliasDeclSyntax/attributes``
9191
/// - ``VariableDeclSyntax``.``VariableDeclSyntax/attributes``
9292
public struct AttributeListSyntax: SyntaxCollection, SyntaxHashable {
93-
public enum Element: SyntaxChildChoices {
93+
public enum Element: SyntaxChildChoices, SyntaxHashable {
9494
case `attribute`(AttributeSyntax)
9595
case `ifConfigDecl`(IfConfigDeclSyntax)
9696

@@ -930,7 +930,7 @@ public struct PlatformVersionItemListSyntax: SyntaxCollection, SyntaxHashable {
930930
///
931931
/// - ``PrecedenceGroupDeclSyntax``.``PrecedenceGroupDeclSyntax/groupAttributes``
932932
public struct PrecedenceGroupAttributeListSyntax: SyntaxCollection, SyntaxHashable {
933-
public enum Element: SyntaxChildChoices {
933+
public enum Element: SyntaxChildChoices, SyntaxHashable {
934934
case `precedenceGroupRelation`(PrecedenceGroupRelationSyntax)
935935
case `precedenceGroupAssignment`(PrecedenceGroupAssignmentSyntax)
936936
case `precedenceGroupAssociativity`(PrecedenceGroupAssociativitySyntax)
@@ -1052,7 +1052,7 @@ public struct PrimaryAssociatedTypeListSyntax: SyntaxCollection, SyntaxHashable
10521052
///
10531053
/// - ``AttributeSyntax``.``AttributeSyntax/arguments``
10541054
public struct SpecializeAttributeArgumentListSyntax: SyntaxCollection, SyntaxHashable {
1055-
public enum Element: SyntaxChildChoices {
1055+
public enum Element: SyntaxChildChoices, SyntaxHashable {
10561056
case `labeledSpecializeArgument`(LabeledSpecializeArgumentSyntax)
10571057
case `specializeAvailabilityArgument`(SpecializeAvailabilityArgumentSyntax)
10581058
case `specializeTargetFunctionArgument`(SpecializeTargetFunctionArgumentSyntax)
@@ -1141,7 +1141,7 @@ public struct SpecializeAttributeArgumentListSyntax: SyntaxCollection, SyntaxHas
11411141
///
11421142
/// - ``StringLiteralExprSyntax``.``StringLiteralExprSyntax/segments``
11431143
public struct StringLiteralSegmentListSyntax: SyntaxCollection, SyntaxHashable {
1144-
public enum Element: SyntaxChildChoices {
1144+
public enum Element: SyntaxChildChoices, SyntaxHashable {
11451145
case `stringSegment`(StringSegmentSyntax)
11461146
case `expressionSegment`(ExpressionSegmentSyntax)
11471147

@@ -1228,7 +1228,7 @@ public struct SwitchCaseItemListSyntax: SyntaxCollection, SyntaxHashable {
12281228
/// - ``IfConfigClauseSyntax``.``IfConfigClauseSyntax/elements``
12291229
/// - ``SwitchExprSyntax``.``SwitchExprSyntax/cases``
12301230
public struct SwitchCaseListSyntax: SyntaxCollection, SyntaxHashable {
1231-
public enum Element: SyntaxChildChoices {
1231+
public enum Element: SyntaxChildChoices, SyntaxHashable {
12321232
case `switchCase`(SwitchCaseSyntax)
12331233
case `ifConfigDecl`(IfConfigDeclSyntax)
12341234

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6290,7 +6290,7 @@ public struct StructDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
62906290
/// - `genericWhereClause`: ``GenericWhereClauseSyntax``?
62916291
/// - `accessors`: (``AccessorBlockSyntax`` | ``CodeBlockSyntax``)?
62926292
public struct SubscriptDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
6293-
public enum Accessors: SyntaxChildChoices {
6293+
public enum Accessors: SyntaxChildChoices, SyntaxHashable {
62946294
case `accessors`(AccessorBlockSyntax)
62956295
case `getter`(CodeBlockSyntax)
62966296

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxExprNodes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ public struct CopyExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
18191819
/// - `content`: (`':'` | ``DictionaryElementListSyntax``)
18201820
/// - `rightSquare`: `']'`
18211821
public struct DictionaryExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
1822-
public enum Content: SyntaxChildChoices {
1822+
public enum Content: SyntaxChildChoices, SyntaxHashable {
18231823
case `colon`(TokenSyntax)
18241824
case `elements`(DictionaryElementListSyntax)
18251825

@@ -2909,7 +2909,7 @@ public struct IdentifierExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
29092909
///
29102910
/// - ``IfExprSyntax``.``IfExprSyntax/elseBody``
29112911
public struct IfExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
2912-
public enum ElseBody: SyntaxChildChoices {
2912+
public enum ElseBody: SyntaxChildChoices, SyntaxHashable {
29132913
case `ifExpr`(IfExprSyntax)
29142914
case `codeBlock`(CodeBlockSyntax)
29152915

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public struct ArrayElementSyntax: SyntaxProtocol, SyntaxHashable {
612612
/// - ``AttributeListSyntax``
613613
/// - ``SwitchCaseSyntax``.``SwitchCaseSyntax/attribute``
614614
public struct AttributeSyntax: SyntaxProtocol, SyntaxHashable {
615-
public enum Arguments: SyntaxChildChoices {
615+
public enum Arguments: SyntaxChildChoices, SyntaxHashable {
616616
case `argumentList`(LabeledExprListSyntax)
617617
case `token`(TokenSyntax)
618618
case `string`(StringLiteralExprSyntax)
@@ -1089,7 +1089,7 @@ public struct AttributeSyntax: SyntaxProtocol, SyntaxHashable {
10891089
///
10901090
/// - ``AvailabilityArgumentListSyntax``
10911091
public struct AvailabilityArgumentSyntax: SyntaxProtocol, SyntaxHashable {
1092-
public enum Argument: SyntaxChildChoices {
1092+
public enum Argument: SyntaxChildChoices, SyntaxHashable {
10931093
case `token`(TokenSyntax)
10941094
case `availabilityVersionRestriction`(PlatformVersionSyntax)
10951095
case `availabilityLabeledArgument`(AvailabilityLabeledArgumentSyntax)
@@ -1479,7 +1479,7 @@ public struct AvailabilityConditionSyntax: SyntaxProtocol, SyntaxHashable {
14791479
///
14801480
/// - ``AvailabilityArgumentSyntax``.``AvailabilityArgumentSyntax/argument``
14811481
public struct AvailabilityLabeledArgumentSyntax: SyntaxProtocol, SyntaxHashable {
1482-
public enum Value: SyntaxChildChoices {
1482+
public enum Value: SyntaxChildChoices, SyntaxHashable {
14831483
case `string`(StringLiteralExprSyntax)
14841484
case `version`(VersionTupleSyntax)
14851485

@@ -3419,7 +3419,7 @@ public struct ClosureShorthandParameterSyntax: SyntaxProtocol, SyntaxHashable {
34193419
///
34203420
/// - ``ClosureExprSyntax``.``ClosureExprSyntax/signature``
34213421
public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable {
3422-
public enum ParameterClause: SyntaxChildChoices {
3422+
public enum ParameterClause: SyntaxChildChoices, SyntaxHashable {
34233423
case `simpleInput`(ClosureShorthandParameterListSyntax)
34243424
case `parameterClause`(ClosureParameterClauseSyntax)
34253425

@@ -3717,7 +3717,7 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable {
37173717
///
37183718
/// - ``CodeBlockItemListSyntax``
37193719
public struct CodeBlockItemSyntax: SyntaxProtocol, SyntaxHashable {
3720-
public enum Item: SyntaxChildChoices {
3720+
public enum Item: SyntaxChildChoices, SyntaxHashable {
37213721
case `decl`(DeclSyntax)
37223722
case `stmt`(StmtSyntax)
37233723
case `expr`(ExprSyntax)
@@ -4217,7 +4217,7 @@ public struct CompositionTypeElementSyntax: SyntaxProtocol, SyntaxHashable {
42174217
///
42184218
/// - ``ConditionElementListSyntax``
42194219
public struct ConditionElementSyntax: SyntaxProtocol, SyntaxHashable {
4220-
public enum Condition: SyntaxChildChoices {
4220+
public enum Condition: SyntaxChildChoices, SyntaxHashable {
42214221
case `expression`(ExprSyntax)
42224222
case `availability`(AvailabilityConditionSyntax)
42234223
case `matchingPattern`(MatchingPatternConditionSyntax)
@@ -6630,7 +6630,7 @@ public struct DifferentiabilityArgumentsSyntax: SyntaxProtocol, SyntaxHashable {
66306630
/// - ``DerivativeAttributeArgumentsSyntax``.``DerivativeAttributeArgumentsSyntax/arguments``
66316631
/// - ``DifferentiableAttributeArgumentsSyntax``.``DifferentiableAttributeArgumentsSyntax/arguments``
66326632
public struct DifferentiabilityWithRespectToArgumentSyntax: SyntaxProtocol, SyntaxHashable {
6633-
public enum Arguments: SyntaxChildChoices {
6633+
public enum Arguments: SyntaxChildChoices, SyntaxHashable {
66346634
case `argument`(DifferentiabilityArgumentSyntax)
66356635
case `argumentList`(DifferentiabilityArgumentsSyntax)
66366636

@@ -7045,7 +7045,7 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash
70457045
///
70467046
/// - ``DocumentationAttributeArgumentListSyntax``
70477047
public struct DocumentationAttributeArgumentSyntax: SyntaxProtocol, SyntaxHashable {
7048-
public enum Value: SyntaxChildChoices {
7048+
public enum Value: SyntaxChildChoices, SyntaxHashable {
70497049
case `token`(TokenSyntax)
70507050
case `string`(StringLiteralExprSyntax)
70517051

@@ -10085,7 +10085,7 @@ public struct GenericParameterSyntax: SyntaxProtocol, SyntaxHashable {
1008510085
///
1008610086
/// - ``GenericRequirementListSyntax``
1008710087
public struct GenericRequirementSyntax: SyntaxProtocol, SyntaxHashable {
10088-
public enum Requirement: SyntaxChildChoices {
10088+
public enum Requirement: SyntaxChildChoices, SyntaxHashable {
1008910089
case `sameTypeRequirement`(SameTypeRequirementSyntax)
1009010090
case `conformanceRequirement`(ConformanceRequirementSyntax)
1009110091
case `layoutRequirement`(LayoutRequirementSyntax)
@@ -10435,7 +10435,7 @@ public struct GenericWhereClauseSyntax: SyntaxProtocol, SyntaxHashable {
1043510435
///
1043610436
/// - ``IfConfigClauseListSyntax``
1043710437
public struct IfConfigClauseSyntax: SyntaxProtocol, SyntaxHashable {
10438-
public enum Elements: SyntaxChildChoices {
10438+
public enum Elements: SyntaxChildChoices, SyntaxHashable {
1043910439
case `statements`(CodeBlockItemListSyntax)
1044010440
case `switchCases`(SwitchCaseListSyntax)
1044110441
case `decls`(MemberBlockItemListSyntax)
@@ -11398,7 +11398,7 @@ public struct InitializerClauseSyntax: SyntaxProtocol, SyntaxHashable {
1139811398
///
1139911399
/// - ``KeyPathComponentListSyntax``
1140011400
public struct KeyPathComponentSyntax: SyntaxProtocol, SyntaxHashable {
11401-
public enum Component: SyntaxChildChoices {
11401+
public enum Component: SyntaxChildChoices, SyntaxHashable {
1140211402
case `property`(KeyPathPropertyComponentSyntax)
1140311403
case `subscript`(KeyPathSubscriptComponentSyntax)
1140411404
case `optional`(KeyPathOptionalComponentSyntax)
@@ -14274,7 +14274,7 @@ public struct OriginallyDefinedInAttributeArgumentsSyntax: SyntaxProtocol, Synta
1427414274
///
1427514275
/// - ``PatternBindingListSyntax``
1427614276
public struct PatternBindingSyntax: SyntaxProtocol, SyntaxHashable {
14277-
public enum Accessors: SyntaxChildChoices {
14277+
public enum Accessors: SyntaxChildChoices, SyntaxHashable {
1427814278
case `accessors`(AccessorBlockSyntax)
1427914279
case `getter`(CodeBlockSyntax)
1428014280

@@ -17402,7 +17402,7 @@ public struct SwitchCaseLabelSyntax: SyntaxProtocol, SyntaxHashable {
1740217402
///
1740317403
/// - ``SwitchCaseListSyntax``
1740417404
public struct SwitchCaseSyntax: SyntaxProtocol, SyntaxHashable {
17405-
public enum Label: SyntaxChildChoices {
17405+
public enum Label: SyntaxChildChoices, SyntaxHashable {
1740617406
case `default`(SwitchDefaultLabelSyntax)
1740717407
case `case`(SwitchCaseLabelSyntax)
1740817408

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxStmtNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ public struct WhileStmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
22152215
/// - `yieldKeyword`: `'yield'`
22162216
/// - `yieldedExpressions`: (``YieldedExpressionsClauseSyntax`` | ``ExprSyntax``)
22172217
public struct YieldStmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
2218-
public enum YieldedExpressions: SyntaxChildChoices {
2218+
public enum YieldedExpressions: SyntaxChildChoices, SyntaxHashable {
22192219
case `multiple`(YieldedExpressionsClauseSyntax)
22202220
case `single`(ExprSyntax)
22212221

0 commit comments

Comments
 (0)