Skip to content

Commit d796fb7

Browse files
committed
Rename remainging syntax collections to hava a List suffix
1 parent 1d01285 commit d796fb7

35 files changed

+564
-532
lines changed

CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public let ATTRIBUTE_NODES: [Node] = [
7979
),
8080
Child(
8181
name: "ObjCName",
82-
kind: .node(kind: .objCSelector)
82+
kind: .node(kind: .objCSelectorPieceList)
8383
),
8484
Child(
8585
name: "ImplementsArguments",
@@ -131,11 +131,11 @@ public let ATTRIBUTE_NODES: [Node] = [
131131
),
132132
Child(
133133
name: "EffectsArguments",
134-
kind: .node(kind: .effectsArguments)
134+
kind: .node(kind: .effectsArgumentList)
135135
),
136136
Child(
137137
name: "DocumentationArguments",
138-
kind: .node(kind: .documentationAttributeArguments)
138+
kind: .node(kind: .documentationAttributeArgumentList)
139139
),
140140
]),
141141
documentation: "The arguments of the attribute. In case the attribute takes multiple arguments, they are gather in the appropriate takes first.",
@@ -561,7 +561,7 @@ public let ATTRIBUTE_NODES: [Node] = [
561561
),
562562

563563
Node(
564-
kind: .documentationAttributeArguments,
564+
kind: .documentationAttributeArgumentList,
565565
base: .syntaxCollection,
566566
nameForDiagnostics: "@_documentation arguments",
567567
documentation: "The arguments of the '@_documentation' attribute",
@@ -590,7 +590,7 @@ public let ATTRIBUTE_NODES: [Node] = [
590590
),
591591

592592
Node(
593-
kind: .effectsArguments,
593+
kind: .effectsArgumentList,
594594
base: .syntaxCollection,
595595
nameForDiagnostics: "@_effects arguments",
596596
documentation: "The arguments of the '@_effect' attribute. These will be parsed during the SIL stage.",
@@ -717,7 +717,7 @@ public let ATTRIBUTE_NODES: [Node] = [
717717

718718
// objc-selector -> objc-selector-piece objc-selector?
719719
Node(
720-
kind: .objCSelector,
720+
kind: .objCSelectorPieceList,
721721
base: .syntaxCollection,
722722
nameForDiagnostics: "Objective-C selector",
723723
elementChoices: [.objCSelectorPiece]

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public let DECL_NODES: [Node] = [
3636
),
3737

3838
Node(
39-
kind: .importPath,
39+
kind: .importPathComponentList,
4040
base: .syntaxCollection,
4141
nameForDiagnostics: nil,
4242
elementChoices: [.importPathComponent]
@@ -1237,7 +1237,7 @@ public let DECL_NODES: [Node] = [
12371237
),
12381238
Child(
12391239
name: "Path",
1240-
kind: .collection(kind: .importPath, collectionElementName: "PathComponent"),
1240+
kind: .collection(kind: .importPathComponentList, collectionElementName: "PathComponent"),
12411241
documentation: "The path to the module, submodule or symbol being imported."
12421242
),
12431243
]

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ public let EXPR_NODES: [Node] = [
14731473
),
14741474
Child(
14751475
name: "Segments",
1476-
kind: .collection(kind: .stringLiteralSegments, collectionElementName: "Segment")
1476+
kind: .collection(kind: .stringLiteralSegmentList, collectionElementName: "Segment")
14771477
),
14781478
Child(
14791479
name: "CloseQuote",
@@ -1488,7 +1488,7 @@ public let EXPR_NODES: [Node] = [
14881488
),
14891489

14901490
Node(
1491-
kind: .stringLiteralSegments,
1491+
kind: .stringLiteralSegmentList,
14921492
base: .syntaxCollection,
14931493
nameForDiagnostics: nil,
14941494
elementChoices: [.stringSegment, .expressionSegment]

CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ public enum SyntaxNodeKind: String, CaseIterable {
114114
case discardStmt
115115
case doStmt
116116
case documentationAttributeArgument
117-
case documentationAttributeArguments
117+
case documentationAttributeArgumentList
118118
case dynamicReplacementArguments
119119
case editorPlaceholderDecl
120120
case editorPlaceholderExpr
121-
case effectsArguments
121+
case effectsArgumentList
122122
case enumCaseDecl
123123
case enumCaseElementList
124124
case enumCaseElement
@@ -164,7 +164,7 @@ public enum SyntaxNodeKind: String, CaseIterable {
164164
case implicitlyUnwrappedOptionalType
165165
case importDecl
166166
case importPathComponent
167-
case importPath
167+
case importPathComponentList
168168
case inOutExpr
169169
case infixOperatorExpr
170170
case inheritedTypeList
@@ -207,7 +207,7 @@ public enum SyntaxNodeKind: String, CaseIterable {
207207
case namedOpaqueReturnType
208208
case nilLiteralExpr
209209
case objCSelectorPiece
210-
case objCSelector
210+
case objCSelectorPieceList
211211
case opaqueReturnTypeOfAttributeArguments
212212
case operatorDecl
213213
case operatorPrecedenceAndTypes
@@ -252,7 +252,7 @@ public enum SyntaxNodeKind: String, CaseIterable {
252252
case specializeExpr
253253
case stmt
254254
case stringLiteralExpr
255-
case stringLiteralSegments
255+
case stringLiteralSegmentList
256256
case stringSegment
257257
case structDecl
258258
case subscriptDecl

CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,7 @@ class ValidateSyntaxNodes: XCTestCase {
146146
assertFailuresMatchXFails(
147147
failures,
148148
expectedFailures: [
149-
ValidationFailure(node: .documentationAttributeArguments, message: "is a collection but does not end with ListSyntax"),
150-
ValidationFailure(node: .unexpectedNodes, message: "is a collection but does not end with ListSyntax"),
151-
ValidationFailure(node: .effectsArguments, message: "is a collection but does not end with ListSyntax"),
152-
ValidationFailure(node: .importPath, message: "is a collection but does not end with ListSyntax"),
153-
ValidationFailure(node: .objCSelector, message: "is a collection but does not end with ListSyntax"),
154-
ValidationFailure(node: .stringLiteralSegments, message: "is a collection but does not end with ListSyntax"),
149+
ValidationFailure(node: .unexpectedNodes, message: "is a collection but does not end with ListSyntax")
155150
]
156151
)
157152
}

Sources/SwiftParser/Attributes.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ extension Parser {
290290
while !parser.at(.rightParen, .endOfFile) {
291291
tokens.append(parser.consumeAnyToken())
292292
}
293-
return .effectsArguments(RawEffectsArgumentsSyntax(elements: tokens, arena: parser.arena))
293+
return .effectsArguments(RawEffectsArgumentListSyntax(elements: tokens, arena: parser.arena))
294294
}
295295
case ._cdecl:
296296
return parseAttribute(argumentMode: .required) { parser in
@@ -591,7 +591,7 @@ extension Parser {
591591
}
592592

593593
extension Parser {
594-
mutating func parseObjectiveCSelector() -> RawObjCSelectorSyntax {
594+
mutating func parseObjectiveCSelector() -> RawObjCSelectorPieceListSyntax {
595595
var elements = [RawObjCSelectorPieceSyntax]()
596596
var loopProgress = LoopProgressCondition()
597597
while loopProgress.evaluate(currentToken) {
@@ -633,7 +633,7 @@ extension Parser {
633633
break
634634
}
635635
}
636-
return RawObjCSelectorSyntax(elements: elements, arena: self.arena)
636+
return RawObjCSelectorPieceListSyntax(elements: elements, arena: self.arena)
637637
}
638638
}
639639

@@ -1069,7 +1069,7 @@ extension Parser {
10691069
}
10701070

10711071
extension Parser {
1072-
mutating func parseDocumentationAttributeArguments() -> RawDocumentationAttributeArgumentsSyntax {
1072+
mutating func parseDocumentationAttributeArguments() -> RawDocumentationAttributeArgumentListSyntax {
10731073
var arguments: [RawDocumentationAttributeArgumentSyntax] = []
10741074

10751075
var keepGoing: RawTokenSyntax? = nil
@@ -1138,7 +1138,7 @@ extension Parser {
11381138
)
11391139
} while keepGoing != nil
11401140

1141-
return RawDocumentationAttributeArgumentsSyntax(elements: arguments, arena: self.arena)
1141+
return RawDocumentationAttributeArgumentListSyntax(elements: arguments, arena: self.arena)
11421142
}
11431143
}
11441144

Sources/SwiftParser/Declarations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ extension Parser {
342342
return self.consume(ifAnyIn: ImportDeclSyntax.ImportKindSpecifierOptions.self)
343343
}
344344

345-
mutating func parseImportPath() -> RawImportPathSyntax {
345+
mutating func parseImportPath() -> RawImportPathComponentListSyntax {
346346
var elements = [RawImportPathComponentSyntax]()
347347
var keepGoing: RawTokenSyntax? = nil
348348
var loopProgress = LoopProgressCondition()
@@ -357,7 +357,7 @@ extension Parser {
357357
)
358358
)
359359
} while keepGoing != nil && loopProgress.evaluate(currentToken)
360-
return RawImportPathSyntax(elements: elements, arena: self.arena)
360+
return RawImportPathComponentListSyntax(elements: elements, arena: self.arena)
361361
}
362362
}
363363

Sources/SwiftParser/StringLiterals.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ extension Parser {
164164
private func reclassifyNewlineOfLastSegmentAsTrivia(
165165
rawStringDelimitersToken: RawTokenSyntax?,
166166
openQuoteHasTrailingNewline: Bool,
167-
middleSegments: inout [RawStringLiteralSegmentsSyntax.Element]
167+
middleSegments: inout [RawStringLiteralSegmentListSyntax.Element]
168168
) -> Bool {
169169
switch middleSegments.last {
170170
case .stringSegment(let lastMiddleSegment):
@@ -229,7 +229,7 @@ extension Parser {
229229
/// attached to the string segment token.
230230
private func postProcessIndentationAndEscapedNewlineOfMiddleSegments(
231231
rawStringDelimitersToken: RawTokenSyntax?,
232-
middleSegments: inout [RawStringLiteralSegmentsSyntax.Element],
232+
middleSegments: inout [RawStringLiteralSegmentListSyntax.Element],
233233
isFirstSegmentOnNewLine: Bool,
234234
indentation: SyntaxText
235235
) {
@@ -303,12 +303,12 @@ extension Parser {
303303
private func postProcessMultilineStringLiteral(
304304
rawStringDelimitersToken: RawTokenSyntax?,
305305
openQuote: RawTokenSyntax,
306-
segments allSegments: [RawStringLiteralSegmentsSyntax.Element],
306+
segments allSegments: [RawStringLiteralSegmentListSyntax.Element],
307307
closeQuote: RawTokenSyntax
308308
) -> (
309309
unexpectedBeforeOpenQuote: [RawTokenSyntax],
310310
openQuote: RawTokenSyntax,
311-
segments: [RawStringLiteralSegmentsSyntax.Element],
311+
segments: [RawStringLiteralSegmentListSyntax.Element],
312312
unexpectedBeforeCloseQuote: [RawTokenSyntax],
313313
closeQuote: RawTokenSyntax
314314
) {
@@ -485,7 +485,7 @@ extension Parser {
485485
}
486486

487487
/// Parse segments.
488-
var segments: [RawStringLiteralSegmentsSyntax.Element] = []
488+
var segments: [RawStringLiteralSegmentListSyntax.Element] = []
489489
var loopProgress = LoopProgressCondition()
490490
while loopProgress.evaluate(self.currentToken) {
491491
// If we encounter a token with leading trivia, we're no longer in the
@@ -574,7 +574,7 @@ extension Parser {
574574
openDelimiter: openDelimiter,
575575
RawUnexpectedNodesSyntax(combining: unexpectedBeforeOpenQuote, postProcessed.unexpectedBeforeOpenQuote, arena: self.arena),
576576
openQuote: postProcessed.openQuote,
577-
segments: RawStringLiteralSegmentsSyntax(elements: postProcessed.segments, arena: self.arena),
577+
segments: RawStringLiteralSegmentListSyntax(elements: postProcessed.segments, arena: self.arena),
578578
RawUnexpectedNodesSyntax(combining: postProcessed.unexpectedBeforeCloseQuote, unexpectedBeforeCloseQuote, arena: self.arena),
579579
closeQuote: postProcessed.closeQuote,
580580
unexpectedBeforeCloseDelimiter,
@@ -586,7 +586,7 @@ extension Parser {
586586
openDelimiter: openDelimiter,
587587
unexpectedBeforeOpenQuote,
588588
openQuote: openQuote,
589-
segments: RawStringLiteralSegmentsSyntax(elements: segments, arena: self.arena),
589+
segments: RawStringLiteralSegmentListSyntax(elements: segments, arena: self.arena),
590590
unexpectedBeforeCloseQuote,
591591
closeQuote: closeQuote,
592592
unexpectedBeforeCloseDelimiter,

Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public struct MissingAttributeArgument: ParserError {
407407
}
408408

409409
public struct MissingBothStringQuotesOfStringSegments: ParserError {
410-
public let stringSegments: StringLiteralSegmentsSyntax
410+
public let stringSegments: StringLiteralSegmentListSyntax
411411

412412
public var message: String {
413413
return #"expected \#(stringSegments.shortSingleLineContentDescription) to be surrounded by '"'"#

Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,17 @@ extension SyntaxKind {
147147
return "'discard' statement"
148148
case .doStmt:
149149
return "'do' statement"
150+
case .documentationAttributeArgumentList:
151+
return "@_documentation arguments"
150152
case .documentationAttributeArgument:
151153
return "@_documentation argument"
152-
case .documentationAttributeArguments:
153-
return "@_documentation arguments"
154154
case .dynamicReplacementArguments:
155155
return "@_dynamicReplacement argument"
156156
case .editorPlaceholderDecl:
157157
return "editor placeholder"
158158
case .editorPlaceholderExpr:
159159
return "editor placeholder"
160-
case .effectsArguments:
160+
case .effectsArgumentList:
161161
return "@_effects arguments"
162162
case .enumCaseDecl:
163163
return "enum case"
@@ -287,10 +287,10 @@ extension SyntaxKind {
287287
return "trailing closure"
288288
case .namedOpaqueReturnType:
289289
return "named opaque return type"
290+
case .objCSelectorPieceList:
291+
return "Objective-C selector"
290292
case .objCSelectorPiece:
291293
return "Objective-C selector piece"
292-
case .objCSelector:
293-
return "Objective-C selector"
294294
case .opaqueReturnTypeOfAttributeArguments:
295295
return "opaque return type arguments"
296296
case .operatorDecl:

Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
239239
- <doc:SwiftSyntax/DictionaryElementSyntax>
240240
- <doc:SwiftSyntax/DifferentiabilityParamListSyntax>
241241
- <doc:SwiftSyntax/DifferentiabilityParamSyntax>
242-
- <doc:SwiftSyntax/DocumentationAttributeArgumentsSyntax>
242+
- <doc:SwiftSyntax/DocumentationAttributeArgumentListSyntax>
243243
- <doc:SwiftSyntax/DocumentationAttributeArgumentSyntax>
244-
- <doc:SwiftSyntax/EffectsArgumentsSyntax>
244+
- <doc:SwiftSyntax/EffectsArgumentListSyntax>
245245
- <doc:SwiftSyntax/EnumCaseElementListSyntax>
246246
- <doc:SwiftSyntax/EnumCaseElementSyntax>
247247
- <doc:SwiftSyntax/EnumCaseParameterListSyntax>
@@ -257,7 +257,7 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
257257
- <doc:SwiftSyntax/GenericRequirementSyntax>
258258
- <doc:SwiftSyntax/IfConfigClauseListSyntax>
259259
- <doc:SwiftSyntax/IfConfigClauseSyntax>
260-
- <doc:SwiftSyntax/ImportPathSyntax>
260+
- <doc:SwiftSyntax/ImportPathComponentListSyntax>
261261
- <doc:SwiftSyntax/ImportPathComponentSyntax>
262262
- <doc:SwiftSyntax/InheritedTypeListSyntax>
263263
- <doc:SwiftSyntax/InheritedTypeSyntax>
@@ -269,7 +269,7 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
269269
- <doc:SwiftSyntax/DeclModifierSyntax>
270270
- <doc:SwiftSyntax/MultipleTrailingClosureElementListSyntax>
271271
- <doc:SwiftSyntax/MultipleTrailingClosureElementSyntax>
272-
- <doc:SwiftSyntax/ObjCSelectorSyntax>
272+
- <doc:SwiftSyntax/ObjCSelectorPieceListSyntax>
273273
- <doc:SwiftSyntax/ObjCSelectorPieceSyntax>
274274
- <doc:SwiftSyntax/PatternBindingListSyntax>
275275
- <doc:SwiftSyntax/PatternBindingSyntax>
@@ -286,7 +286,7 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
286286
- <doc:SwiftSyntax/AvailabilityEntrySyntax>
287287
- <doc:SwiftSyntax/TargetFunctionEntrySyntax>
288288
- <doc:SwiftSyntax/GenericWhereClauseSyntax>
289-
- <doc:SwiftSyntax/StringLiteralSegmentsSyntax>
289+
- <doc:SwiftSyntax/StringLiteralSegmentListSyntax>
290290
- <doc:SwiftSyntax/StringSegmentSyntax>
291291
- <doc:SwiftSyntax/ExpressionSegmentSyntax>
292292
- <doc:SwiftSyntax/SwitchCaseListSyntax>

Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public extension DeclGroupSyntax {
4646
}
4747
}
4848

49+
@available(*, deprecated, renamed: "DocumentationAttributeArgumentListSyntax")
50+
public typealias DocumentationAttributeArgumentsSyntax = DocumentationAttributeArgumentListSyntax
51+
52+
@available(*, deprecated, renamed: "EffectsArgumentListSyntax")
53+
public typealias EffectsArgumentsSyntax = EffectsArgumentListSyntax
54+
4955
public extension FreestandingMacroExpansionSyntax {
5056
@available(*, deprecated, renamed: "genericArgumentClause")
5157
var genericArguments: GenericArgumentClauseSyntax? {
@@ -58,6 +64,37 @@ public extension FreestandingMacroExpansionSyntax {
5864
}
5965
}
6066

67+
@available(*, deprecated, renamed: "ImportPathComponentListSyntax")
68+
public typealias ImportPathSyntax = ImportPathComponentListSyntax
69+
70+
@available(*, deprecated, renamed: "ObjCSelectorPieceListSyntax")
71+
public typealias ObjCSelector = ObjCSelectorPieceListSyntax
72+
73+
@available(*, deprecated, renamed: "StringLiteralSegmentListSyntax")
74+
public typealias StringLiteralSegmentsSyntax = StringLiteralSegmentListSyntax
75+
76+
public extension SyntaxKind {
77+
static var documentationAttributeArguments: Self {
78+
return .documentationAttributeArgumentList
79+
}
80+
81+
static var effectsArguments: Self {
82+
return .effectsArgumentList
83+
}
84+
85+
static var importPath: Self {
86+
return .importPathComponentList
87+
}
88+
89+
static var objCSelector: Self {
90+
return .objCSelectorPieceList
91+
}
92+
93+
static var stringLiteralSegments: Self {
94+
return .stringLiteralSegmentList
95+
}
96+
}
97+
6198
public extension SyntaxProtocol {
6299
@available(*, deprecated, message: "Use detached computed property instead.")
63100
func detach() -> Self {

0 commit comments

Comments
 (0)