Skip to content

Commit cd0a58b

Browse files
committed
Regnerate gyb-files to support 'any' types
1 parent 103d677 commit cd0a58b

File tree

14 files changed

+91
-91
lines changed

14 files changed

+91
-91
lines changed

Sources/SwiftSyntax/gyb_generated/Misc.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,10 +1297,10 @@ extension SyntaxNode {
12971297
return OptionalTypeSyntax(asSyntaxData)
12981298
}
12991299

1300-
public var isSomeType: Bool { return raw.kind == .someType }
1301-
public var asSomeType: SomeTypeSyntax? {
1302-
guard isSomeType else { return nil }
1303-
return SomeTypeSyntax(asSyntaxData)
1300+
public var isSomeOrAnyType: Bool { return raw.kind == .someOrAnyType }
1301+
public var asSomeOrAnyType: SomeOrAnyTypeSyntax? {
1302+
guard isSomeOrAnyType else { return nil }
1303+
return SomeOrAnyTypeSyntax(asSyntaxData)
13041304
}
13051305

13061306
public var isImplicitlyUnwrappedOptionalType: Bool { return raw.kind == .implicitlyUnwrappedOptionalType }
@@ -1931,7 +1931,7 @@ extension Syntax {
19311931
return node
19321932
case .optionalType(let node):
19331933
return node
1934-
case .someType(let node):
1934+
case .someOrAnyType(let node):
19351935
return node
19361936
case .implicitlyUnwrappedOptionalType(let node):
19371937
return node

Sources/SwiftSyntax/gyb_generated/SyntaxAnyVisitor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,11 +1555,11 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
15551555
override open func visitPost(_ node: OptionalTypeSyntax) {
15561556
visitAnyPost(node._syntaxNode)
15571557
}
1558-
override open func visit(_ node: SomeTypeSyntax) -> SyntaxVisitorContinueKind {
1558+
override open func visit(_ node: SomeOrAnyTypeSyntax) -> SyntaxVisitorContinueKind {
15591559
return visitAny(node._syntaxNode)
15601560
}
15611561

1562-
override open func visitPost(_ node: SomeTypeSyntax) {
1562+
override open func visitPost(_ node: SomeOrAnyTypeSyntax) {
15631563
visitAnyPost(node._syntaxNode)
15641564
}
15651565
override open func visit(_ node: ImplicitlyUnwrappedOptionalTypeSyntax) -> SyntaxVisitorContinueKind {

Sources/SwiftSyntax/gyb_generated/SyntaxBaseNodes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
380380
/// `nil` if the conversion is not possible.
381381
public init?(_ syntax: Syntax) {
382382
switch syntax.raw.kind {
383-
case .unknownType, .simpleTypeIdentifier, .memberTypeIdentifier, .classRestrictionType, .arrayType, .dictionaryType, .metatypeType, .optionalType, .someType, .implicitlyUnwrappedOptionalType, .compositionType, .tupleType, .functionType, .attributedType:
383+
case .unknownType, .simpleTypeIdentifier, .memberTypeIdentifier, .classRestrictionType, .arrayType, .dictionaryType, .metatypeType, .optionalType, .someOrAnyType, .implicitlyUnwrappedOptionalType, .compositionType, .tupleType, .functionType, .attributedType:
384384
self._syntaxNode = syntax
385385
default:
386386
return nil
@@ -394,7 +394,7 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
394394
// Assert that the kind of the given data matches in debug builds.
395395
#if DEBUG
396396
switch data.raw.kind {
397-
case .unknownType, .simpleTypeIdentifier, .memberTypeIdentifier, .classRestrictionType, .arrayType, .dictionaryType, .metatypeType, .optionalType, .someType, .implicitlyUnwrappedOptionalType, .compositionType, .tupleType, .functionType, .attributedType:
397+
case .unknownType, .simpleTypeIdentifier, .memberTypeIdentifier, .classRestrictionType, .arrayType, .dictionaryType, .metatypeType, .optionalType, .someOrAnyType, .implicitlyUnwrappedOptionalType, .compositionType, .tupleType, .functionType, .attributedType:
398398
break
399399
default:
400400
fatalError("Unable to create TypeSyntax from \(data.raw.kind)")

Sources/SwiftSyntax/gyb_generated/SyntaxBuilders.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9613,19 +9613,19 @@ extension OptionalTypeSyntax {
96139613
}
96149614
}
96159615

9616-
public struct SomeTypeSyntaxBuilder {
9616+
public struct SomeOrAnyTypeSyntaxBuilder {
96179617
private var layout =
96189618
Array<RawSyntax?>(repeating: nil, count: 2)
96199619

96209620
internal init() {}
96219621

9622-
public mutating func useSomeSpecifier(_ node: TokenSyntax) {
9623-
let idx = SomeTypeSyntax.Cursor.someSpecifier.rawValue
9622+
public mutating func useSomeOrAnySpecifier(_ node: TokenSyntax) {
9623+
let idx = SomeOrAnyTypeSyntax.Cursor.someOrAnySpecifier.rawValue
96249624
layout[idx] = node.raw
96259625
}
96269626

96279627
public mutating func useBaseType(_ node: TypeSyntax) {
9628-
let idx = SomeTypeSyntax.Cursor.baseType.rawValue
9628+
let idx = SomeOrAnyTypeSyntax.Cursor.baseType.rawValue
96299629
layout[idx] = node.raw
96309630
}
96319631

@@ -9637,22 +9637,22 @@ public struct SomeTypeSyntaxBuilder {
96379637
layout[1] = RawSyntax.missing(SyntaxKind.type)
96389638
}
96399639

9640-
return .forRoot(RawSyntax.createAndCalcLength(kind: .someType,
9640+
return .forRoot(RawSyntax.createAndCalcLength(kind: .someOrAnyType,
96419641
layout: layout, presence: .present))
96429642
}
96439643
}
96449644

9645-
extension SomeTypeSyntax {
9646-
/// Creates a `SomeTypeSyntax` using the provided build function.
9645+
extension SomeOrAnyTypeSyntax {
9646+
/// Creates a `SomeOrAnyTypeSyntax` using the provided build function.
96479647
/// - Parameter:
96489648
/// - build: A closure that will be invoked in order to initialize
96499649
/// the fields of the syntax node.
9650-
/// This closure is passed a `SomeTypeSyntaxBuilder` which you can use to
9650+
/// This closure is passed a `SomeOrAnyTypeSyntaxBuilder` which you can use to
96519651
/// incrementally build the structure of the node.
9652-
/// - Returns: A `SomeTypeSyntax` with all the fields populated in the builder
9652+
/// - Returns: A `SomeOrAnyTypeSyntax` with all the fields populated in the builder
96539653
/// closure.
9654-
public init(_ build: (inout SomeTypeSyntaxBuilder) -> Void) {
9655-
var builder = SomeTypeSyntaxBuilder()
9654+
public init(_ build: (inout SomeOrAnyTypeSyntaxBuilder) -> Void) {
9655+
var builder = SomeOrAnyTypeSyntaxBuilder()
96569656
build(&builder)
96579657
let data = builder.buildData()
96589658
self.init(data)

Sources/SwiftSyntax/gyb_generated/SyntaxClassification.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ extension SyntaxClassification {
9595
return (.typeIdentifier, false)
9696
case (.memberTypeIdentifier, 2):
9797
return (.typeIdentifier, false)
98-
case (.someType, 0):
98+
case (.someOrAnyType, 0):
9999
return (.keyword, false)
100100
case (.functionType, 3):
101101
return (.keyword, false)

Sources/SwiftSyntax/gyb_generated/SyntaxEnum.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public enum SyntaxEnum {
234234
case dictionaryType(DictionaryTypeSyntax)
235235
case metatypeType(MetatypeTypeSyntax)
236236
case optionalType(OptionalTypeSyntax)
237-
case someType(SomeTypeSyntax)
237+
case someOrAnyType(SomeOrAnyTypeSyntax)
238238
case implicitlyUnwrappedOptionalType(ImplicitlyUnwrappedOptionalTypeSyntax)
239239
case compositionTypeElement(CompositionTypeElementSyntax)
240240
case compositionTypeElementList(CompositionTypeElementListSyntax)
@@ -710,8 +710,8 @@ public extension Syntax {
710710
return .metatypeType(MetatypeTypeSyntax(self)!)
711711
case .optionalType:
712712
return .optionalType(OptionalTypeSyntax(self)!)
713-
case .someType:
714-
return .someType(SomeTypeSyntax(self)!)
713+
case .someOrAnyType:
714+
return .someOrAnyType(SomeOrAnyTypeSyntax(self)!)
715715
case .implicitlyUnwrappedOptionalType:
716716
return .implicitlyUnwrappedOptionalType(ImplicitlyUnwrappedOptionalTypeSyntax(self)!)
717717
case .compositionTypeElement:

Sources/SwiftSyntax/gyb_generated/SyntaxFactory.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4322,24 +4322,24 @@ public enum SyntaxFactory {
43224322
], length: .zero, presence: .present))
43234323
return OptionalTypeSyntax(data)
43244324
}
4325-
public static func makeSomeType(someSpecifier: TokenSyntax, baseType: TypeSyntax) -> SomeTypeSyntax {
4325+
public static func makeSomeOrAnyType(someOrAnySpecifier: TokenSyntax, baseType: TypeSyntax) -> SomeOrAnyTypeSyntax {
43264326
let layout: [RawSyntax?] = [
4327-
someSpecifier.raw,
4327+
someOrAnySpecifier.raw,
43284328
baseType.raw,
43294329
]
4330-
let raw = RawSyntax.createAndCalcLength(kind: SyntaxKind.someType,
4330+
let raw = RawSyntax.createAndCalcLength(kind: SyntaxKind.someOrAnyType,
43314331
layout: layout, presence: SourcePresence.present)
43324332
let data = SyntaxData.forRoot(raw)
4333-
return SomeTypeSyntax(data)
4333+
return SomeOrAnyTypeSyntax(data)
43344334
}
43354335

4336-
public static func makeBlankSomeType() -> SomeTypeSyntax {
4337-
let data = SyntaxData.forRoot(RawSyntax.create(kind: .someType,
4336+
public static func makeBlankSomeOrAnyType() -> SomeOrAnyTypeSyntax {
4337+
let data = SyntaxData.forRoot(RawSyntax.create(kind: .someOrAnyType,
43384338
layout: [
43394339
RawSyntax.missingToken(TokenKind.identifier("")),
43404340
RawSyntax.missing(SyntaxKind.type),
43414341
], length: .zero, presence: .present))
4342-
return SomeTypeSyntax(data)
4342+
return SomeOrAnyTypeSyntax(data)
43434343
}
43444344
public static func makeImplicitlyUnwrappedOptionalType(wrappedType: TypeSyntax, exclamationMark: TokenSyntax) -> ImplicitlyUnwrappedOptionalTypeSyntax {
43454345
let layout: [RawSyntax?] = [

Sources/SwiftSyntax/gyb_generated/SyntaxKind.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ internal enum SyntaxKind: CSyntaxKind {
234234
case dictionaryType = 216
235235
case metatypeType = 217
236236
case optionalType = 218
237-
case someType = 230
237+
case someOrAnyType = 230
238238
case implicitlyUnwrappedOptionalType = 219
239239
case compositionTypeElement = 153
240240
case compositionTypeElementList = 196

Sources/SwiftSyntax/gyb_generated/SyntaxRewriter.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,10 +1514,10 @@ open class SyntaxRewriter {
15141514
return TypeSyntax(visitChildren(node))
15151515
}
15161516

1517-
/// Visit a `SomeTypeSyntax`.
1517+
/// Visit a `SomeOrAnyTypeSyntax`.
15181518
/// - Parameter node: the node that is being visited
15191519
/// - Returns: the rewritten node
1520-
open func visit(_ node: SomeTypeSyntax) -> TypeSyntax {
1520+
open func visit(_ node: SomeOrAnyTypeSyntax) -> TypeSyntax {
15211521
return TypeSyntax(visitChildren(node))
15221522
}
15231523

@@ -3946,8 +3946,8 @@ open class SyntaxRewriter {
39463946
}
39473947

39483948
/// Implementation detail of visit(_:). Do not call directly.
3949-
private func visitImplSomeTypeSyntax(_ data: SyntaxData) -> Syntax {
3950-
let node = SomeTypeSyntax(data)
3949+
private func visitImplSomeOrAnyTypeSyntax(_ data: SyntaxData) -> Syntax {
3950+
let node = SomeOrAnyTypeSyntax(data)
39513951
// Accessing _syntaxNode directly is faster than calling Syntax(node)
39523952
visitPre(node._syntaxNode)
39533953
defer { visitPost(node._syntaxNode) }
@@ -4733,8 +4733,8 @@ open class SyntaxRewriter {
47334733
return visitImplMetatypeTypeSyntax
47344734
case .optionalType:
47354735
return visitImplOptionalTypeSyntax
4736-
case .someType:
4737-
return visitImplSomeTypeSyntax
4736+
case .someOrAnyType:
4737+
return visitImplSomeOrAnyTypeSyntax
47384738
case .implicitlyUnwrappedOptionalType:
47394739
return visitImplImplicitlyUnwrappedOptionalTypeSyntax
47404740
case .compositionTypeElement:
@@ -5244,8 +5244,8 @@ open class SyntaxRewriter {
52445244
return visitImplMetatypeTypeSyntax(data)
52455245
case .optionalType:
52465246
return visitImplOptionalTypeSyntax(data)
5247-
case .someType:
5248-
return visitImplSomeTypeSyntax(data)
5247+
case .someOrAnyType:
5248+
return visitImplSomeOrAnyTypeSyntax(data)
52495249
case .implicitlyUnwrappedOptionalType:
52505250
return visitImplImplicitlyUnwrappedOptionalTypeSyntax(data)
52515251
case .compositionTypeElement:

Sources/SwiftSyntax/gyb_generated/SyntaxVisitor.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,16 +2162,16 @@ open class SyntaxVisitor {
21622162
/// The function called after visiting `OptionalTypeSyntax` and its descendents.
21632163
/// - node: the node we just finished visiting.
21642164
open func visitPost(_ node: OptionalTypeSyntax) {}
2165-
/// Visiting `SomeTypeSyntax` specifically.
2165+
/// Visiting `SomeOrAnyTypeSyntax` specifically.
21662166
/// - Parameter node: the node we are visiting.
21672167
/// - Returns: how should we continue visiting.
2168-
open func visit(_ node: SomeTypeSyntax) -> SyntaxVisitorContinueKind {
2168+
open func visit(_ node: SomeOrAnyTypeSyntax) -> SyntaxVisitorContinueKind {
21692169
return .visitChildren
21702170
}
21712171

2172-
/// The function called after visiting `SomeTypeSyntax` and its descendents.
2172+
/// The function called after visiting `SomeOrAnyTypeSyntax` and its descendents.
21732173
/// - node: the node we just finished visiting.
2174-
open func visitPost(_ node: SomeTypeSyntax) {}
2174+
open func visitPost(_ node: SomeOrAnyTypeSyntax) {}
21752175
/// Visiting `ImplicitlyUnwrappedOptionalTypeSyntax` specifically.
21762176
/// - Parameter node: the node we are visiting.
21772177
/// - Returns: how should we continue visiting.
@@ -4884,8 +4884,8 @@ open class SyntaxVisitor {
48844884
}
48854885

48864886
/// Implementation detail of doVisit(_:_:). Do not call directly.
4887-
private func visitImplSomeTypeSyntax(_ data: SyntaxData) {
4888-
let node = SomeTypeSyntax(data)
4887+
private func visitImplSomeOrAnyTypeSyntax(_ data: SyntaxData) {
4888+
let node = SomeOrAnyTypeSyntax(data)
48894889
let needsChildren = (visit(node) == .visitChildren)
48904890
// Avoid calling into visitChildren if possible.
48914891
if needsChildren && node.raw.numberOfChildren > 0 {
@@ -5669,8 +5669,8 @@ open class SyntaxVisitor {
56695669
visitImplMetatypeTypeSyntax(data)
56705670
case .optionalType:
56715671
visitImplOptionalTypeSyntax(data)
5672-
case .someType:
5673-
visitImplSomeTypeSyntax(data)
5672+
case .someOrAnyType:
5673+
visitImplSomeOrAnyTypeSyntax(data)
56745674
case .implicitlyUnwrappedOptionalType:
56755675
visitImplImplicitlyUnwrappedOptionalTypeSyntax(data)
56765676
case .compositionTypeElement:

Sources/SwiftSyntax/gyb_generated/syntax_nodes/SyntaxTypeNodes.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -979,54 +979,54 @@ extension OptionalTypeSyntax: CustomReflectable {
979979
}
980980
}
981981

982-
// MARK: - SomeTypeSyntax
982+
// MARK: - SomeOrAnyTypeSyntax
983983

984-
public struct SomeTypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
984+
public struct SomeOrAnyTypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
985985
enum Cursor: Int {
986-
case someSpecifier
986+
case someOrAnySpecifier
987987
case baseType
988988
}
989989

990990
public let _syntaxNode: Syntax
991991

992-
/// Converts the given `Syntax` node to a `SomeTypeSyntax` if possible. Returns
992+
/// Converts the given `Syntax` node to a `SomeOrAnyTypeSyntax` if possible. Returns
993993
/// `nil` if the conversion is not possible.
994994
public init?(_ syntax: Syntax) {
995-
guard syntax.raw.kind == .someType else { return nil }
995+
guard syntax.raw.kind == .someOrAnyType else { return nil }
996996
self._syntaxNode = syntax
997997
}
998998

999-
/// Creates a `SomeTypeSyntax` node from the given `SyntaxData`. This assumes
999+
/// Creates a `SomeOrAnyTypeSyntax` node from the given `SyntaxData`. This assumes
10001000
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
10011001
/// is undefined.
10021002
internal init(_ data: SyntaxData) {
1003-
assert(data.raw.kind == .someType)
1003+
assert(data.raw.kind == .someOrAnyType)
10041004
self._syntaxNode = Syntax(data)
10051005
}
10061006

10071007
public var syntaxNodeType: SyntaxProtocol.Type {
10081008
return Swift.type(of: self)
10091009
}
10101010

1011-
public var someSpecifier: TokenSyntax {
1011+
public var someOrAnySpecifier: TokenSyntax {
10121012
get {
1013-
let childData = data.child(at: Cursor.someSpecifier,
1013+
let childData = data.child(at: Cursor.someOrAnySpecifier,
10141014
parent: Syntax(self))
10151015
return TokenSyntax(childData!)
10161016
}
10171017
set(value) {
1018-
self = withSomeSpecifier(value)
1018+
self = withSomeOrAnySpecifier(value)
10191019
}
10201020
}
10211021

1022-
/// Returns a copy of the receiver with its `someSpecifier` replaced.
1023-
/// - param newChild: The new `someSpecifier` to replace the node's
1024-
/// current `someSpecifier`, if present.
1025-
public func withSomeSpecifier(
1026-
_ newChild: TokenSyntax?) -> SomeTypeSyntax {
1022+
/// Returns a copy of the receiver with its `someOrAnySpecifier` replaced.
1023+
/// - param newChild: The new `someOrAnySpecifier` to replace the node's
1024+
/// current `someOrAnySpecifier`, if present.
1025+
public func withSomeOrAnySpecifier(
1026+
_ newChild: TokenSyntax?) -> SomeOrAnyTypeSyntax {
10271027
let raw = newChild?.raw ?? RawSyntax.missingToken(TokenKind.identifier(""))
1028-
let newData = data.replacingChild(raw, at: Cursor.someSpecifier)
1029-
return SomeTypeSyntax(newData)
1028+
let newData = data.replacingChild(raw, at: Cursor.someOrAnySpecifier)
1029+
return SomeOrAnyTypeSyntax(newData)
10301030
}
10311031

10321032
public var baseType: TypeSyntax {
@@ -1044,10 +1044,10 @@ public struct SomeTypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
10441044
/// - param newChild: The new `baseType` to replace the node's
10451045
/// current `baseType`, if present.
10461046
public func withBaseType(
1047-
_ newChild: TypeSyntax?) -> SomeTypeSyntax {
1047+
_ newChild: TypeSyntax?) -> SomeOrAnyTypeSyntax {
10481048
let raw = newChild?.raw ?? RawSyntax.missing(SyntaxKind.type)
10491049
let newData = data.replacingChild(raw, at: Cursor.baseType)
1050-
return SomeTypeSyntax(newData)
1050+
return SomeOrAnyTypeSyntax(newData)
10511051
}
10521052

10531053

@@ -1075,10 +1075,10 @@ public struct SomeTypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
10751075
}
10761076
}
10771077

1078-
extension SomeTypeSyntax: CustomReflectable {
1078+
extension SomeOrAnyTypeSyntax: CustomReflectable {
10791079
public var customMirror: Mirror {
10801080
return Mirror(self, children: [
1081-
"someSpecifier": Syntax(someSpecifier).asProtocol(SyntaxProtocol.self),
1081+
"someOrAnySpecifier": Syntax(someOrAnySpecifier).asProtocol(SyntaxProtocol.self),
10821082
"baseType": Syntax(baseType).asProtocol(SyntaxProtocol.self),
10831083
])
10841084
}

0 commit comments

Comments
 (0)