Skip to content

Commit 8d09b73

Browse files
committed
Make TypeBuildable expressible as TypeAnnotation
1 parent 6eee38b commit 8d09b73

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

Sources/SwiftSyntaxBuilder/generated/ExpressibleAsProtocols.swift

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public extension ExpressibleAsSyntaxBuildable {
8181
return SwitchCaseList([self])
8282
}
8383
}
84-
public protocol ExpressibleAsTypeBuildable: ExpressibleAsReturnClause, ExpressibleAsTypeInitializerClause {
84+
public protocol ExpressibleAsTypeBuildable: ExpressibleAsReturnClause, ExpressibleAsTypeInitializerClause, ExpressibleAsTypeAnnotation {
8585
func createTypeBuildable() -> TypeBuildable
8686
}
8787
public extension ExpressibleAsTypeBuildable {
@@ -93,6 +93,10 @@ public extension ExpressibleAsTypeBuildable {
9393
func createTypeInitializerClause() -> TypeInitializerClause {
9494
return TypeInitializerClause(value: self)
9595
}
96+
/// Conformance to ExpressibleAsTypeAnnotation
97+
func createTypeAnnotation() -> TypeAnnotation {
98+
return TypeAnnotation(type: self)
99+
}
96100
}
97101
public protocol ExpressibleAsCodeBlockItem: ExpressibleAsCodeBlockItemList {
98102
func createCodeBlockItem() -> CodeBlockItem
@@ -1724,14 +1728,10 @@ public extension ExpressibleAsPrimaryAssociatedTypeClause {
17241728
return createPrimaryAssociatedTypeClause()
17251729
}
17261730
}
1727-
public protocol ExpressibleAsSimpleTypeIdentifier: ExpressibleAsTypeAnnotation, ExpressibleAsTypeExpr, ExpressibleAsTypeBuildable {
1731+
public protocol ExpressibleAsSimpleTypeIdentifier: ExpressibleAsTypeExpr, ExpressibleAsTypeBuildable {
17281732
func createSimpleTypeIdentifier() -> SimpleTypeIdentifier
17291733
}
17301734
public extension ExpressibleAsSimpleTypeIdentifier {
1731-
/// Conformance to ExpressibleAsTypeAnnotation
1732-
func createTypeAnnotation() -> TypeAnnotation {
1733-
return TypeAnnotation(type: self)
1734-
}
17351735
/// Conformance to ExpressibleAsTypeExpr
17361736
func createTypeExpr() -> TypeExpr {
17371737
return TypeExpr(type: self)
@@ -1756,26 +1756,18 @@ public extension ExpressibleAsClassRestrictionType {
17561756
return createClassRestrictionType()
17571757
}
17581758
}
1759-
public protocol ExpressibleAsArrayType: ExpressibleAsTypeAnnotation, ExpressibleAsTypeBuildable {
1759+
public protocol ExpressibleAsArrayType: ExpressibleAsTypeBuildable {
17601760
func createArrayType() -> ArrayType
17611761
}
17621762
public extension ExpressibleAsArrayType {
1763-
/// Conformance to ExpressibleAsTypeAnnotation
1764-
func createTypeAnnotation() -> TypeAnnotation {
1765-
return TypeAnnotation(type: self)
1766-
}
17671763
func createTypeBuildable() -> TypeBuildable {
17681764
return createArrayType()
17691765
}
17701766
}
1771-
public protocol ExpressibleAsDictionaryType: ExpressibleAsTypeAnnotation, ExpressibleAsTypeBuildable {
1767+
public protocol ExpressibleAsDictionaryType: ExpressibleAsTypeBuildable {
17721768
func createDictionaryType() -> DictionaryType
17731769
}
17741770
public extension ExpressibleAsDictionaryType {
1775-
/// Conformance to ExpressibleAsTypeAnnotation
1776-
func createTypeAnnotation() -> TypeAnnotation {
1777-
return TypeAnnotation(type: self)
1778-
}
17791771
func createTypeBuildable() -> TypeBuildable {
17801772
return createDictionaryType()
17811773
}

Sources/SwiftSyntaxBuilder/gyb_helpers/ExpressibleAsConformances.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@
22
'AccessorList': [
33
'AccessorBlock'
44
],
5-
'ArrayType': [
6-
'TypeAnnotation'
7-
],
85
'CodeBlockItemList': [
96
'CodeBlock'
107
],
118
'DeclBuildable': [
129
'CodeBlockItem',
1310
'MemberDeclListItem'
1411
],
15-
'DictionaryType': [
16-
'TypeAnnotation'
17-
],
1812
'ExprBuildable': [
1913
'CodeBlockItem',
2014
'InitializerClause'
@@ -36,7 +30,6 @@
3630
'TupleExprElement'
3731
],
3832
'SimpleTypeIdentifier': [
39-
'TypeAnnotation',
4033
'TypeExpr'
4134
],
4235
'StmtBuildable': [
@@ -49,7 +42,8 @@
4942
],
5043
'TypeBuildable': [
5144
'ReturnClause',
52-
'TypeInitializerClause'
45+
'TypeInitializerClause',
46+
'TypeAnnotation'
5347
]
5448
}
5549

Sources/SwiftSyntaxBuilderGeneration/gyb_generated/ExpressibleAsConformances.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,13 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
1616
"AccessorList": [
1717
"AccessorBlock",
1818
],
19-
"ArrayType": [
20-
"TypeAnnotation",
21-
],
2219
"CodeBlockItemList": [
2320
"CodeBlock",
2421
],
2522
"DeclBuildable": [
2623
"CodeBlockItem",
2724
"MemberDeclListItem",
2825
],
29-
"DictionaryType": [
30-
"TypeAnnotation",
31-
],
3226
"ExprBuildable": [
3327
"CodeBlockItem",
3428
"InitializerClause",
@@ -50,7 +44,6 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
5044
"TupleExprElement",
5145
],
5246
"SimpleTypeIdentifier": [
53-
"TypeAnnotation",
5447
"TypeExpr",
5548
],
5649
"StmtBuildable": [
@@ -64,5 +57,6 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
6457
"TypeBuildable": [
6558
"ReturnClause",
6659
"TypeInitializerClause",
60+
"TypeAnnotation",
6761
],
6862
]

0 commit comments

Comments
 (0)