@@ -124,7 +124,7 @@ let basicFormatFile = SourceFile {
124
124
FunctionDecl ( " open func requiresLeadingSpace(_ token: TokenSyntax) -> Bool " ) {
125
125
SwitchStmt ( """
126
126
switch (token.previousToken(viewMode: .sourceAccurate)?.tokenKind, token.tokenKind) {
127
- case (.postfixQuestionMark, .rightAngle):
127
+ case (.postfixQuestionMark, .rightAngle): // Ensures there is not space in `?>`
128
128
return false
129
129
case (.leftParen, .spacedBinaryOperator( " * " )):
130
130
return false
@@ -150,17 +150,17 @@ let basicFormatFile = SourceFile {
150
150
FunctionDecl ( " open func requiresTrailingSpace(_ token: TokenSyntax) -> Bool " ) {
151
151
SwitchStmt ( """
152
152
switch (token.tokenKind, token.nextToken(viewMode: .sourceAccurate)?.tokenKind) {
153
- case (.asKeyword, .exclamationMark),
154
- (.asKeyword, .postfixQuestionMark),
155
- (.exclamationMark, .leftParen),
156
- (.exclamationMark, .period),
157
- (.initKeyword, .leftParen),
158
- (.initKeyword, .postfixQuestionMark),
159
- (.postfixQuestionMark, .leftParen),
160
- (.postfixQuestionMark, .rightAngle),
161
- (.postfixQuestionMark, .rightParen),
162
- (.tryKeyword, .exclamationMark),
163
- (.tryKeyword, .postfixQuestionMark):
153
+ case (.asKeyword, .exclamationMark), // Ensures there is not space in `as!`
154
+ (.asKeyword, .postfixQuestionMark), // Ensures there is not space in `as?`
155
+ (.exclamationMark, .leftParen), // Ensures there is not space in `!(`
156
+ (.exclamationMark, .period), // Ensures there is not space in `!.`
157
+ (.initKeyword, .leftParen), // Ensures there is not space in `init(`
158
+ (.initKeyword, .postfixQuestionMark), // Ensures there is not space in `init?`
159
+ (.postfixQuestionMark, .leftParen), // Ensures there is not space in `?(`
160
+ (.postfixQuestionMark, .rightAngle), // Ensures there is not space in `?<`
161
+ (.postfixQuestionMark, .rightParen), // Ensures there is not space in `?(`
162
+ (.tryKeyword, .exclamationMark), // Ensures there is not space in `try!`
163
+ (.tryKeyword, .postfixQuestionMark): // Ensures there is not space in `try?`
164
164
return false
165
165
case (.spacedBinaryOperator( " * " ), .comma):
166
166
return false
0 commit comments