File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed 
Sources/SwiftFormat/PrettyPrint 
Tests/SwiftFormatTests/PrettyPrint Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -2737,6 +2737,13 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
27372737    return  . visitChildren
27382738  } 
27392739
2740+   override func  visit( _ node:  BorrowExprSyntax )  ->  SyntaxVisitorContinueKind  { 
2741+     // The `borrow` keyword cannot be separated from the following token or it will be parsed as
2742+     // an identifier.
2743+     after ( node. borrowKeyword,  tokens:  . space) 
2744+     return  . visitChildren
2745+   } 
2746+ 
27402747  override func  visit( _ node:  ConsumeExprSyntax )  ->  SyntaxVisitorContinueKind  { 
27412748    // The `consume` keyword cannot be separated from the following token or it will be parsed as
27422749    // an identifier.
Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
6+ // Licensed under Apache License v2.0 with Runtime Library Exception
7+ //
8+ // See https://swift.org/LICENSE.txt for license information
9+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+ //
11+ //===----------------------------------------------------------------------===//
12+ 
13+ final  class  BorrowExprTests :  PrettyPrintTestCase  { 
14+   func  testBorrow( )  { 
15+     assertPrettyPrintEqual ( 
16+       input:  """ 
17+         @lifetime(borrow self) 
18+         init() {} 
19+          """ , 
20+       expected:  """ 
21+         @lifetime( 
22+           borrow self) 
23+         init() {} 
24+ 
25+          """ , 
26+       linelength:  21 
27+     ) 
28+   } 
29+ } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments