Skip to content

Commit b6f4595

Browse files
committed
Ensure there are no optional syntax collection in the syntax tree
All syntax collections should be non-optional, which makes it easier to work with them. Also, the semantics of what an empty collection vs. a `nil` collection have not been clear.
1 parent b173512 commit b6f4595

File tree

14 files changed

+75
-61
lines changed

14 files changed

+75
-61
lines changed

CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ public let AVAILABILITY_NODES: [Node] = [
180180
Child(
181181
name: "Components",
182182
kind: .collection(kind: .versionComponentList, collectionElementName: "VersionComponent"),
183-
documentation: "Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0`",
184-
isOptional: true
183+
documentation: "Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0`"
185184
),
186185
]
187186
),

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ public let EXPR_NODES: [Node] = [
354354
),
355355
Child(
356356
name: "Items",
357-
kind: .collection(kind: .closureCaptureList, collectionElementName: "Item"),
358-
isOptional: true
357+
kind: .collection(kind: .closureCaptureList, collectionElementName: "Item")
359358
),
360359
Child(
361360
name: "RightSquare",

CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ public let STMT_NODES: [Node] = [
8686
),
8787
Child(
8888
name: "CatchItems",
89-
kind: .collection(kind: .catchItemList, collectionElementName: "CatchItem"),
90-
isOptional: true
89+
kind: .collection(kind: .catchItemList, collectionElementName: "CatchItem", defaultsToEmpty: true)
9190
),
9291
Child(
9392
name: "Body",
@@ -240,8 +239,7 @@ public let STMT_NODES: [Node] = [
240239
),
241240
Child(
242241
name: "CatchClauses",
243-
kind: .collection(kind: .catchClauseList, collectionElementName: "CatchClause"),
244-
isOptional: true
242+
kind: .collection(kind: .catchClauseList, collectionElementName: "CatchClause", defaultsToEmpty: true)
245243
),
246244
]
247245
),

CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,4 +760,23 @@ class ValidateSyntaxNodes: XCTestCase {
760760

761761
assertFailuresMatchXFails(failures, expectedFailures: [])
762762
}
763+
764+
func testNoOptionalSyntaxCollections() {
765+
var failures: [ValidationFailure] = []
766+
767+
for node in SYNTAX_NODES.compactMap(\.layoutNode) {
768+
for child in node.children {
769+
if case .collection = child.kind, child.isOptional, !child.isUnexpectedNodes {
770+
failures.append(
771+
ValidationFailure(
772+
node: node.kind,
773+
message: "child '\(child.name)' is an optional syntax collection. All syntax collections should be non-optional."
774+
)
775+
)
776+
}
777+
}
778+
}
779+
780+
assertFailuresMatchXFails(failures, expectedFailures: [])
781+
}
763782
}

Sources/SwiftParser/Availability.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ extension Parser {
298298
let unexpectedAfterComponents = self.parseUnexpectedVersionTokens()
299299
return RawVersionTupleSyntax(
300300
major: major,
301-
components: nil,
301+
components: RawVersionComponentListSyntax(elements: [], arena: self.arena),
302302
unexpectedAfterComponents,
303303
arena: self.arena
304304
)

Sources/SwiftParser/Expressions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ extension Parser {
17331733

17341734
captures = RawClosureCaptureClauseSyntax(
17351735
leftSquare: lsquare,
1736-
items: elements.isEmpty ? nil : RawClosureCaptureListSyntax(elements: elements, arena: self.arena),
1736+
items: RawClosureCaptureListSyntax(elements: elements, arena: self.arena),
17371737
RawUnexpectedNodesSyntax(unexpectedNodes, arena: self.arena),
17381738
rightSquare: rsquare,
17391739
arena: self.arena

Sources/SwiftParser/Statements.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ extension Parser {
384384
unexpectedBeforeDoKeyword,
385385
doKeyword: doKeyword,
386386
body: body,
387-
catchClauses: elements.isEmpty ? nil : RawCatchClauseListSyntax(elements: elements, arena: self.arena),
387+
catchClauses: RawCatchClauseListSyntax(elements: elements, arena: self.arena),
388388
arena: self.arena
389389
)
390390
}
@@ -416,7 +416,7 @@ extension Parser {
416416
return RawCatchClauseSyntax(
417417
unexpectedBeforeCatchKeyword,
418418
catchKeyword: catchKeyword,
419-
catchItems: catchItems.isEmpty ? nil : RawCatchItemListSyntax(elements: catchItems, arena: self.arena),
419+
catchItems: RawCatchItemListSyntax(elements: catchItems, arena: self.arena),
420420
body: body,
421421
arena: self.arena
422422
)

Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,19 +1986,17 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
19861986
}
19871987

19881988
if let unexpectedAfterComponents = node.unexpectedAfterComponents {
1989-
if let components = node.components,
1990-
unexpectedAfterComponents.allSatisfy({ $0.is(VersionComponentSyntax.self) })
1991-
{
1989+
if unexpectedAfterComponents.allSatisfy({ $0.is(VersionComponentSyntax.self) }) {
19921990
addDiagnostic(
19931991
unexpectedAfterComponents,
1994-
TrailingVersionAreIgnored(major: node.major, components: components),
1992+
TrailingVersionAreIgnored(major: node.major, components: node.components),
19951993
handledNodes: [unexpectedAfterComponents.id]
19961994
)
19971995
} else {
19981996
addDiagnostic(
19991997
unexpectedAfterComponents,
20001998
CannotParseVersionTuple(versionTuple: unexpectedAfterComponents),
2001-
handledNodes: [node.major.id, node.components?.id, unexpectedAfterComponents.id].compactMap { $0 }
1999+
handledNodes: [node.major.id, node.components.id, unexpectedAfterComponents.id]
20022000
)
20032001
}
20042002
}

Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,7 +2715,7 @@ public struct RawCatchClauseSyntax: RawSyntaxNodeProtocol {
27152715
_ unexpectedBeforeCatchKeyword: RawUnexpectedNodesSyntax? = nil,
27162716
catchKeyword: RawTokenSyntax,
27172717
_ unexpectedBetweenCatchKeywordAndCatchItems: RawUnexpectedNodesSyntax? = nil,
2718-
catchItems: RawCatchItemListSyntax?,
2718+
catchItems: RawCatchItemListSyntax,
27192719
_ unexpectedBetweenCatchItemsAndBody: RawUnexpectedNodesSyntax? = nil,
27202720
body: RawCodeBlockSyntax,
27212721
_ unexpectedAfterBody: RawUnexpectedNodesSyntax? = nil,
@@ -2727,7 +2727,7 @@ public struct RawCatchClauseSyntax: RawSyntaxNodeProtocol {
27272727
layout[0] = unexpectedBeforeCatchKeyword?.raw
27282728
layout[1] = catchKeyword.raw
27292729
layout[2] = unexpectedBetweenCatchKeywordAndCatchItems?.raw
2730-
layout[3] = catchItems?.raw
2730+
layout[3] = catchItems.raw
27312731
layout[4] = unexpectedBetweenCatchItemsAndBody?.raw
27322732
layout[5] = body.raw
27332733
layout[6] = unexpectedAfterBody?.raw
@@ -2747,8 +2747,8 @@ public struct RawCatchClauseSyntax: RawSyntaxNodeProtocol {
27472747
layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:))
27482748
}
27492749

2750-
public var catchItems: RawCatchItemListSyntax? {
2751-
layoutView.children[3].map(RawCatchItemListSyntax.init(raw:))
2750+
public var catchItems: RawCatchItemListSyntax {
2751+
layoutView.children[3].map(RawCatchItemListSyntax.init(raw:))!
27522752
}
27532753

27542754
public var unexpectedBetweenCatchItemsAndBody: RawUnexpectedNodesSyntax? {
@@ -3129,7 +3129,7 @@ public struct RawClosureCaptureClauseSyntax: RawSyntaxNodeProtocol {
31293129
_ unexpectedBeforeLeftSquare: RawUnexpectedNodesSyntax? = nil,
31303130
leftSquare: RawTokenSyntax,
31313131
_ unexpectedBetweenLeftSquareAndItems: RawUnexpectedNodesSyntax? = nil,
3132-
items: RawClosureCaptureListSyntax?,
3132+
items: RawClosureCaptureListSyntax,
31333133
_ unexpectedBetweenItemsAndRightSquare: RawUnexpectedNodesSyntax? = nil,
31343134
rightSquare: RawTokenSyntax,
31353135
_ unexpectedAfterRightSquare: RawUnexpectedNodesSyntax? = nil,
@@ -3141,7 +3141,7 @@ public struct RawClosureCaptureClauseSyntax: RawSyntaxNodeProtocol {
31413141
layout[0] = unexpectedBeforeLeftSquare?.raw
31423142
layout[1] = leftSquare.raw
31433143
layout[2] = unexpectedBetweenLeftSquareAndItems?.raw
3144-
layout[3] = items?.raw
3144+
layout[3] = items.raw
31453145
layout[4] = unexpectedBetweenItemsAndRightSquare?.raw
31463146
layout[5] = rightSquare.raw
31473147
layout[6] = unexpectedAfterRightSquare?.raw
@@ -3161,8 +3161,8 @@ public struct RawClosureCaptureClauseSyntax: RawSyntaxNodeProtocol {
31613161
layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:))
31623162
}
31633163

3164-
public var items: RawClosureCaptureListSyntax? {
3165-
layoutView.children[3].map(RawClosureCaptureListSyntax.init(raw:))
3164+
public var items: RawClosureCaptureListSyntax {
3165+
layoutView.children[3].map(RawClosureCaptureListSyntax.init(raw:))!
31663166
}
31673167

31683168
public var unexpectedBetweenItemsAndRightSquare: RawUnexpectedNodesSyntax? {
@@ -7067,7 +7067,7 @@ public struct RawDoStmtSyntax: RawStmtSyntaxNodeProtocol {
70677067
_ unexpectedBetweenDoKeywordAndBody: RawUnexpectedNodesSyntax? = nil,
70687068
body: RawCodeBlockSyntax,
70697069
_ unexpectedBetweenBodyAndCatchClauses: RawUnexpectedNodesSyntax? = nil,
7070-
catchClauses: RawCatchClauseListSyntax?,
7070+
catchClauses: RawCatchClauseListSyntax,
70717071
_ unexpectedAfterCatchClauses: RawUnexpectedNodesSyntax? = nil,
70727072
arena: __shared SyntaxArena
70737073
) {
@@ -7079,7 +7079,7 @@ public struct RawDoStmtSyntax: RawStmtSyntaxNodeProtocol {
70797079
layout[2] = unexpectedBetweenDoKeywordAndBody?.raw
70807080
layout[3] = body.raw
70817081
layout[4] = unexpectedBetweenBodyAndCatchClauses?.raw
7082-
layout[5] = catchClauses?.raw
7082+
layout[5] = catchClauses.raw
70837083
layout[6] = unexpectedAfterCatchClauses?.raw
70847084
}
70857085
self.init(unchecked: raw)
@@ -7105,8 +7105,8 @@ public struct RawDoStmtSyntax: RawStmtSyntaxNodeProtocol {
71057105
layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:))
71067106
}
71077107

7108-
public var catchClauses: RawCatchClauseListSyntax? {
7109-
layoutView.children[5].map(RawCatchClauseListSyntax.init(raw:))
7108+
public var catchClauses: RawCatchClauseListSyntax {
7109+
layoutView.children[5].map(RawCatchClauseListSyntax.init(raw:))!
71107110
}
71117111

71127112
public var unexpectedAfterCatchClauses: RawUnexpectedNodesSyntax? {
@@ -22261,7 +22261,7 @@ public struct RawVersionTupleSyntax: RawSyntaxNodeProtocol {
2226122261
_ unexpectedBeforeMajor: RawUnexpectedNodesSyntax? = nil,
2226222262
major: RawTokenSyntax,
2226322263
_ unexpectedBetweenMajorAndComponents: RawUnexpectedNodesSyntax? = nil,
22264-
components: RawVersionComponentListSyntax?,
22264+
components: RawVersionComponentListSyntax,
2226522265
_ unexpectedAfterComponents: RawUnexpectedNodesSyntax? = nil,
2226622266
arena: __shared SyntaxArena
2226722267
) {
@@ -22271,7 +22271,7 @@ public struct RawVersionTupleSyntax: RawSyntaxNodeProtocol {
2227122271
layout[0] = unexpectedBeforeMajor?.raw
2227222272
layout[1] = major.raw
2227322273
layout[2] = unexpectedBetweenMajorAndComponents?.raw
22274-
layout[3] = components?.raw
22274+
layout[3] = components.raw
2227522275
layout[4] = unexpectedAfterComponents?.raw
2227622276
}
2227722277
self.init(unchecked: raw)
@@ -22289,8 +22289,8 @@ public struct RawVersionTupleSyntax: RawSyntaxNodeProtocol {
2228922289
layoutView.children[2].map(RawUnexpectedNodesSyntax.init(raw:))
2229022290
}
2229122291

22292-
public var components: RawVersionComponentListSyntax? {
22293-
layoutView.children[3].map(RawVersionComponentListSyntax.init(raw:))
22292+
public var components: RawVersionComponentListSyntax {
22293+
layoutView.children[3].map(RawVersionComponentListSyntax.init(raw:))!
2229422294
}
2229522295

2229622296
public var unexpectedAfterComponents: RawUnexpectedNodesSyntax? {

Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
501501
assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self))
502502
assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax.self, tokenChoices: [.keyword("catch")]))
503503
assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self))
504-
assertNoError(kind, 3, verify(layout[3], as: RawCatchItemListSyntax?.self))
504+
assertNoError(kind, 3, verify(layout[3], as: RawCatchItemListSyntax.self))
505505
assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self))
506506
assertNoError(kind, 5, verify(layout[5], as: RawCodeBlockSyntax.self))
507507
assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self))
@@ -547,7 +547,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
547547
assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self))
548548
assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.leftSquare)]))
549549
assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self))
550-
assertNoError(kind, 3, verify(layout[3], as: RawClosureCaptureListSyntax?.self))
550+
assertNoError(kind, 3, verify(layout[3], as: RawClosureCaptureListSyntax.self))
551551
assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self))
552552
assertNoError(kind, 5, verify(layout[5], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.rightSquare)]))
553553
assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self))
@@ -994,7 +994,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
994994
assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self))
995995
assertNoError(kind, 3, verify(layout[3], as: RawCodeBlockSyntax.self))
996996
assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self))
997-
assertNoError(kind, 5, verify(layout[5], as: RawCatchClauseListSyntax?.self))
997+
assertNoError(kind, 5, verify(layout[5], as: RawCatchClauseListSyntax.self))
998998
assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self))
999999
case .documentationAttributeArgumentList:
10001000
for (index, element) in layout.enumerated() {
@@ -2651,7 +2651,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
26512651
assertNoError(kind, 0, verify(layout[0], as: RawUnexpectedNodesSyntax?.self))
26522652
assertNoError(kind, 1, verify(layout[1], as: RawTokenSyntax.self, tokenChoices: [.tokenKind(.integerLiteral)]))
26532653
assertNoError(kind, 2, verify(layout[2], as: RawUnexpectedNodesSyntax?.self))
2654-
assertNoError(kind, 3, verify(layout[3], as: RawVersionComponentListSyntax?.self))
2654+
assertNoError(kind, 3, verify(layout[3], as: RawVersionComponentListSyntax.self))
26552655
assertNoError(kind, 4, verify(layout[4], as: RawUnexpectedNodesSyntax?.self))
26562656
case .whereClause:
26572657
assert(layout.count == 5)

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodes.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,7 +1925,7 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable {
19251925
_ unexpectedBeforeCatchKeyword: UnexpectedNodesSyntax? = nil,
19261926
catchKeyword: TokenSyntax = .keyword(.catch),
19271927
_ unexpectedBetweenCatchKeywordAndCatchItems: UnexpectedNodesSyntax? = nil,
1928-
catchItems: CatchItemListSyntax? = nil,
1928+
catchItems: CatchItemListSyntax = [],
19291929
_ unexpectedBetweenCatchItemsAndBody: UnexpectedNodesSyntax? = nil,
19301930
body: CodeBlockSyntax,
19311931
_ unexpectedAfterBody: UnexpectedNodesSyntax? = nil,
@@ -1947,7 +1947,7 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable {
19471947
unexpectedBeforeCatchKeyword?.raw,
19481948
catchKeyword.raw,
19491949
unexpectedBetweenCatchKeywordAndCatchItems?.raw,
1950-
catchItems?.raw,
1950+
catchItems.raw,
19511951
unexpectedBetweenCatchItemsAndBody?.raw,
19521952
body.raw,
19531953
unexpectedAfterBody?.raw
@@ -1992,12 +1992,12 @@ public struct CatchClauseSyntax: SyntaxProtocol, SyntaxHashable {
19921992
}
19931993
}
19941994

1995-
public var catchItems: CatchItemListSyntax? {
1995+
public var catchItems: CatchItemListSyntax {
19961996
get {
1997-
return data.child(at: 3, parent: Syntax(self)).map(CatchItemListSyntax.init)
1997+
return CatchItemListSyntax(data.child(at: 3, parent: Syntax(self))!)
19981998
}
19991999
set(value) {
2000-
self = CatchClauseSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena()))
2000+
self = CatchClauseSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena()))
20012001
}
20022002
}
20032003

@@ -2259,7 +2259,7 @@ public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable {
22592259
_ unexpectedBeforeLeftSquare: UnexpectedNodesSyntax? = nil,
22602260
leftSquare: TokenSyntax = .leftSquareToken(),
22612261
_ unexpectedBetweenLeftSquareAndItems: UnexpectedNodesSyntax? = nil,
2262-
items: ClosureCaptureListSyntax? = nil,
2262+
items: ClosureCaptureListSyntax,
22632263
_ unexpectedBetweenItemsAndRightSquare: UnexpectedNodesSyntax? = nil,
22642264
rightSquare: TokenSyntax = .rightSquareToken(),
22652265
_ unexpectedAfterRightSquare: UnexpectedNodesSyntax? = nil,
@@ -2281,7 +2281,7 @@ public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable {
22812281
unexpectedBeforeLeftSquare?.raw,
22822282
leftSquare.raw,
22832283
unexpectedBetweenLeftSquareAndItems?.raw,
2284-
items?.raw,
2284+
items.raw,
22852285
unexpectedBetweenItemsAndRightSquare?.raw,
22862286
rightSquare.raw,
22872287
unexpectedAfterRightSquare?.raw
@@ -2326,12 +2326,12 @@ public struct ClosureCaptureClauseSyntax: SyntaxProtocol, SyntaxHashable {
23262326
}
23272327
}
23282328

2329-
public var items: ClosureCaptureListSyntax? {
2329+
public var items: ClosureCaptureListSyntax {
23302330
get {
2331-
return data.child(at: 3, parent: Syntax(self)).map(ClosureCaptureListSyntax.init)
2331+
return ClosureCaptureListSyntax(data.child(at: 3, parent: Syntax(self))!)
23322332
}
23332333
set(value) {
2334-
self = ClosureCaptureClauseSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena()))
2334+
self = ClosureCaptureClauseSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena()))
23352335
}
23362336
}
23372337

@@ -19003,7 +19003,7 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable {
1900319003
_ unexpectedBeforeMajor: UnexpectedNodesSyntax? = nil,
1900419004
major: TokenSyntax,
1900519005
_ unexpectedBetweenMajorAndComponents: UnexpectedNodesSyntax? = nil,
19006-
components: VersionComponentListSyntax? = nil,
19006+
components: VersionComponentListSyntax,
1900719007
_ unexpectedAfterComponents: UnexpectedNodesSyntax? = nil,
1900819008
trailingTrivia: Trivia? = nil
1900919009

@@ -19021,7 +19021,7 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable {
1902119021
unexpectedBeforeMajor?.raw,
1902219022
major.raw,
1902319023
unexpectedBetweenMajorAndComponents?.raw,
19024-
components?.raw,
19024+
components.raw,
1902519025
unexpectedAfterComponents?.raw
1902619026
]
1902719027
let raw = RawSyntax.makeLayout(
@@ -19066,12 +19066,12 @@ public struct VersionTupleSyntax: SyntaxProtocol, SyntaxHashable {
1906619066
}
1906719067

1906819068
/// Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0`
19069-
public var components: VersionComponentListSyntax? {
19069+
public var components: VersionComponentListSyntax {
1907019070
get {
19071-
return data.child(at: 3, parent: Syntax(self)).map(VersionComponentListSyntax.init)
19071+
return VersionComponentListSyntax(data.child(at: 3, parent: Syntax(self))!)
1907219072
}
1907319073
set(value) {
19074-
self = VersionTupleSyntax(data.replacingChild(at: 3, with: value?.data, arena: SyntaxArena()))
19074+
self = VersionTupleSyntax(data.replacingChild(at: 3, with: value.data, arena: SyntaxArena()))
1907519075
}
1907619076
}
1907719077

0 commit comments

Comments
 (0)