File tree 2 files changed +37
-7
lines changed
CodeGeneration/Tests/ValidateSyntaxNodes
2 files changed +37
-7
lines changed Original file line number Diff line number Diff line change @@ -317,12 +317,6 @@ class ValidateSyntaxNodes: XCTestCase {
317
317
) ,
318
318
319
319
// MARK: Tokens that contain underscores
320
- ValidationFailure (
321
- node: . borrowExpr,
322
- message:
323
- " child 'borrowKeyword' has a single keyword as its only token choice and should thus be named '_borrowKeyword' "
324
- // _borrow is underscored and thus BorrowKeyword is the correct spelling
325
- ) ,
326
320
ValidationFailure (
327
321
node: . conventionWitnessMethodAttributeArguments,
328
322
message:
@@ -410,7 +404,11 @@ class ValidateSyntaxNodes: XCTestCase {
410
404
message: " child 'consumeKeyword' only has keywords as its token choices and should thus end with 'Specifier' "
411
405
// ConsumeKeyword can be 'consume' or '_move' and '_move' is deprecated
412
406
) ,
413
-
407
+ ValidationFailure (
408
+ node: . borrowExpr,
409
+ message: " child 'borrowKeyword' only has keywords as its token choices and should thus end with 'Specifier' "
410
+ // BorrowKeyword can be 'borrow' or '_borrow', eventually '_borrow' will be deprecated
411
+ ) ,
414
412
// MARK: Conceptually a value, not a specifier
415
413
ValidationFailure (
416
414
node: . booleanLiteralExpr,
Original file line number Diff line number Diff line change @@ -1210,6 +1210,38 @@ final class ExpressionTests: ParserTestCase {
1210
1210
assertParse ( " use(_borrow msg) " )
1211
1211
assertParse ( " _borrow msg " )
1212
1212
assertParse ( " let b = (_borrow self).buffer " )
1213
+ assertParse ( " borrow msg " )
1214
+ assertParse ( " use(borrow msg) " )
1215
+ assertParse ( " borrow(msg) " )
1216
+ assertParse ( " borrow (msg) " )
1217
+ }
1218
+
1219
+ func testBorrowNameFunctionCallStructure1( ) {
1220
+ assertParse (
1221
+ """
1222
+ borrow(msg)
1223
+ """ ,
1224
+ substructure: FunctionCallExprSyntax (
1225
+ calledExpression: DeclReferenceExprSyntax ( baseName: . identifier( " borrow " ) ) ,
1226
+ leftParen: . leftParenToken( ) ,
1227
+ arguments: LabeledExprListSyntax ( [ LabeledExprSyntax ( expression: ExprSyntax ( " msg " ) ) ] ) ,
1228
+ rightParen: . rightParenToken( )
1229
+ )
1230
+ )
1231
+ }
1232
+
1233
+ func testBorrowNameFunctionCallStructure2( ) {
1234
+ assertParse (
1235
+ """
1236
+ borrow (msg)
1237
+ """ ,
1238
+ substructure: FunctionCallExprSyntax (
1239
+ calledExpression: DeclReferenceExprSyntax ( baseName: . identifier( " borrow " ) ) ,
1240
+ leftParen: . leftParenToken( ) ,
1241
+ arguments: LabeledExprListSyntax ( [ LabeledExprSyntax ( expression: ExprSyntax ( " msg " ) ) ] ) ,
1242
+ rightParen: . rightParenToken( )
1243
+ )
1244
+ )
1213
1245
}
1214
1246
1215
1247
func testCodeCompletionExpressions( ) {
You can’t perform that action at this time.
0 commit comments