File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
CodeGeneration/Sources/generate-swiftbasicformat
Sources/SwiftBasicFormat/generated
Tests/SwiftSyntaxBuilderTest Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,8 @@ let basicFormatFile = SourceFile {
128
128
(.rightAngle, .identifier(_)),
129
129
(.rightAngle, .postfixQuestionMark):
130
130
return false
131
+ case (.spacedBinaryOperator(let `operator`), .leftParen):
132
+ return `operator` != " * "
131
133
default:
132
134
break
133
135
}
@@ -155,10 +157,13 @@ let basicFormatFile = SourceFile {
155
157
(.initKeyword, .leftParen),
156
158
(.initKeyword, .postfixQuestionMark),
157
159
(.leftAngle, .identifier(_)),
160
+ (.rightAngle, .leftParen),
158
161
(.rightAngle, .postfixQuestionMark),
159
162
(.tryKeyword, .exclamationMark),
160
163
(.tryKeyword, .postfixQuestionMark):
161
164
return false
165
+ case (.spacedBinaryOperator(let `operator`), .comma):
166
+ return `operator` != " * "
162
167
default:
163
168
break
164
169
}
Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ open class BasicFormat: SyntaxRewriter {
129
129
( . rightAngle, . identifier( _ ) ) ,
130
130
( . rightAngle, . postfixQuestionMark) :
131
131
return false
132
+ case ( . spacedBinaryOperator( let `operator`) , . leftParen) :
133
+ return `operator` != " * "
132
134
default :
133
135
break
134
136
}
@@ -161,10 +163,13 @@ open class BasicFormat: SyntaxRewriter {
161
163
( . initKeyword, . leftParen) ,
162
164
( . initKeyword, . postfixQuestionMark) ,
163
165
( . leftAngle, . identifier( _ ) ) ,
166
+ ( . rightAngle, . leftParen) ,
164
167
( . rightAngle, . postfixQuestionMark) ,
165
168
( . tryKeyword, . exclamationMark) ,
166
169
( . tryKeyword, . postfixQuestionMark) :
167
170
return false
171
+ case ( . spacedBinaryOperator( let `operator`) , . comma) :
172
+ return `operator` != " * "
168
173
default :
169
174
break
170
175
}
Original file line number Diff line number Diff line change @@ -37,6 +37,25 @@ final class FunctionTests: XCTestCase {
37
37
)
38
38
}
39
39
40
+ func testFunctionDeclEnsurePropperSpacing( ) {
41
+ let buildable = FunctionDecl (
42
+ """
43
+ @available(*, deprecated, message: " Use function on Baz " )
44
+ private func visitChildren<SyntaxType: SyntaxProtocol>(_ node: SyntaxType) {
45
+ }
46
+ """
47
+ )
48
+
49
+ AssertBuildResult (
50
+ buildable,
51
+ """
52
+ @available(*, deprecated, message: " Use function on Baz " )
53
+ private func visitChildren<SyntaxType: SyntaxProtocol>(_ node: SyntaxType) {
54
+ }
55
+ """
56
+ )
57
+ }
58
+
40
59
func testArguments( ) {
41
60
let buildable = FunctionCallExpr ( callee: ExprSyntax ( " test " ) ) {
42
61
for param in ( 1 ... 5 ) {
You can’t perform that action at this time.
0 commit comments