Skip to content

Commit cb20470

Browse files
committed
Make TypeBuildable expressible as TypeAnnotation
1 parent 2ff1171 commit cb20470

File tree

4 files changed

+12
-32
lines changed

4 files changed

+12
-32
lines changed

Sources/SwiftSyntaxBuilder/generated/ExpressibleAsProtocols.swift

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public extension ExpressibleAsSyntaxBuildable {
8585
return SwitchCaseList([self])
8686
}
8787
}
88-
public protocol ExpressibleAsTypeBuildable: ExpressibleAsReturnClause, ExpressibleAsTypeInitializerClause {
88+
public protocol ExpressibleAsTypeBuildable: ExpressibleAsReturnClause, ExpressibleAsTypeInitializerClause, ExpressibleAsTypeAnnotation {
8989
func createTypeBuildable() -> TypeBuildable
9090
}
9191
public extension ExpressibleAsTypeBuildable {
@@ -97,6 +97,10 @@ public extension ExpressibleAsTypeBuildable {
9797
func createTypeInitializerClause() -> TypeInitializerClause {
9898
return TypeInitializerClause(value: self)
9999
}
100+
/// Conformance to ExpressibleAsTypeAnnotation
101+
func createTypeAnnotation() -> TypeAnnotation {
102+
return TypeAnnotation(type: self)
103+
}
100104
}
101105
public protocol ExpressibleAsCodeBlockItem: ExpressibleAsCodeBlockItemList {
102106
func createCodeBlockItem() -> CodeBlockItem
@@ -1737,14 +1741,10 @@ public extension ExpressibleAsPrimaryAssociatedTypeClause {
17371741
return createPrimaryAssociatedTypeClause()
17381742
}
17391743
}
1740-
public protocol ExpressibleAsSimpleTypeIdentifier: ExpressibleAsTypeAnnotation, ExpressibleAsTypeExpr, ExpressibleAsTypeBuildable {
1744+
public protocol ExpressibleAsSimpleTypeIdentifier: ExpressibleAsTypeExpr, ExpressibleAsTypeBuildable {
17411745
func createSimpleTypeIdentifier() -> SimpleTypeIdentifier
17421746
}
17431747
public extension ExpressibleAsSimpleTypeIdentifier {
1744-
/// Conformance to ExpressibleAsTypeAnnotation
1745-
func createTypeAnnotation() -> TypeAnnotation {
1746-
return TypeAnnotation(type: self)
1747-
}
17481748
/// Conformance to ExpressibleAsTypeExpr
17491749
func createTypeExpr() -> TypeExpr {
17501750
return TypeExpr(type: self)
@@ -1769,26 +1769,18 @@ public extension ExpressibleAsClassRestrictionType {
17691769
return createClassRestrictionType()
17701770
}
17711771
}
1772-
public protocol ExpressibleAsArrayType: ExpressibleAsTypeAnnotation, ExpressibleAsTypeBuildable {
1772+
public protocol ExpressibleAsArrayType: ExpressibleAsTypeBuildable {
17731773
func createArrayType() -> ArrayType
17741774
}
17751775
public extension ExpressibleAsArrayType {
1776-
/// Conformance to ExpressibleAsTypeAnnotation
1777-
func createTypeAnnotation() -> TypeAnnotation {
1778-
return TypeAnnotation(type: self)
1779-
}
17801776
func createTypeBuildable() -> TypeBuildable {
17811777
return createArrayType()
17821778
}
17831779
}
1784-
public protocol ExpressibleAsDictionaryType: ExpressibleAsTypeAnnotation, ExpressibleAsTypeBuildable {
1780+
public protocol ExpressibleAsDictionaryType: ExpressibleAsTypeBuildable {
17851781
func createDictionaryType() -> DictionaryType
17861782
}
17871783
public extension ExpressibleAsDictionaryType {
1788-
/// Conformance to ExpressibleAsTypeAnnotation
1789-
func createTypeAnnotation() -> TypeAnnotation {
1790-
return TypeAnnotation(type: self)
1791-
}
17921784
func createTypeBuildable() -> TypeBuildable {
17931785
return createDictionaryType()
17941786
}

Sources/SwiftSyntaxBuilder/gyb_helpers/ExpressibleAsConformances.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@
55
'ArrayElementList': [
66
'ArrayExpr'
77
],
8-
'ArrayType': [
9-
'TypeAnnotation'
10-
],
118
'CodeBlockItemList': [
129
'CodeBlock'
1310
],
1411
'DeclBuildable': [
1512
'CodeBlockItem',
1613
'MemberDeclListItem'
1714
],
18-
'DictionaryType': [
19-
'TypeAnnotation'
20-
],
2115
'ExprBuildable': [
2216
'CodeBlockItem',
2317
'InitializerClause'
@@ -39,7 +33,6 @@
3933
'TupleExprElement'
4034
],
4135
'SimpleTypeIdentifier': [
42-
'TypeAnnotation',
4336
'TypeExpr'
4437
],
4538
'StmtBuildable': [
@@ -52,7 +45,8 @@
5245
],
5346
'TypeBuildable': [
5447
'ReturnClause',
55-
'TypeInitializerClause'
48+
'TypeInitializerClause',
49+
'TypeAnnotation'
5650
]
5751
}
5852

Sources/SwiftSyntaxBuilderGeneration/SyntaxBuildableChild.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extension Child {
4747
SequenceExpr {
4848
MemberAccessExpr(base: varName, name: "leadingTrivia")
4949
BinaryOperatorExpr("??")
50-
ArrayExpr(elements: [])
50+
ArrayExpr {}
5151
}
5252
}
5353
}

Sources/SwiftSyntaxBuilderGeneration/gyb_generated/ExpressibleAsConformances.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,13 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
1919
"ArrayElementList": [
2020
"ArrayExpr",
2121
],
22-
"ArrayType": [
23-
"TypeAnnotation",
24-
],
2522
"CodeBlockItemList": [
2623
"CodeBlock",
2724
],
2825
"DeclBuildable": [
2926
"CodeBlockItem",
3027
"MemberDeclListItem",
3128
],
32-
"DictionaryType": [
33-
"TypeAnnotation",
34-
],
3529
"ExprBuildable": [
3630
"CodeBlockItem",
3731
"InitializerClause",
@@ -53,7 +47,6 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
5347
"TupleExprElement",
5448
],
5549
"SimpleTypeIdentifier": [
56-
"TypeAnnotation",
5750
"TypeExpr",
5851
],
5952
"StmtBuildable": [
@@ -67,5 +60,6 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
6760
"TypeBuildable": [
6861
"ReturnClause",
6962
"TypeInitializerClause",
63+
"TypeAnnotation",
7064
],
7165
]

0 commit comments

Comments
 (0)