File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
test/SourceKit/CodeFormat Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -366,7 +366,8 @@ class FormatContext {
366366 Expr *AtExprEnd = End.getAsExpr ();
367367 if (AtExprEnd && (isa<ClosureExpr>(AtExprEnd) ||
368368 isa<ParenExpr>(AtExprEnd) ||
369- isa<TupleExpr>(AtExprEnd))) {
369+ isa<TupleExpr>(AtExprEnd) ||
370+ isa<CaptureListExpr>(AtExprEnd))) {
370371
371372 if (auto *Paren = dyn_cast_or_null<ParenExpr>(Cursor->getAsExpr ())) {
372373 auto *SubExpr = Paren->getSubExpr ();
Original file line number Diff line number Diff line change @@ -32,6 +32,16 @@ func foo4() {
3232 } ( )
3333}
3434
35+ func foo5( input: Int , block: ( Int ) -> ( ) ) -> Int {
36+ return 0
37+ }
38+
39+ func foo6( ) {
40+ _ = foo5 ( input: 0 , block: { [ unowned self] blockInput in
41+ foo4 ( )
42+ } )
43+ }
44+
3545// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s >%t.response
3646// RUN: %sourcekitd-test -req=format -line=4 -length=1 %s >>%t.response
3747// RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >>%t.response
@@ -46,6 +56,7 @@ func foo4() {
4656// RUN: %sourcekitd-test -req=format -line=30 -length=1 %s >>%t.response
4757// RUN: %sourcekitd-test -req=format -line=31 -length=1 %s >>%t.response
4858// RUN: %sourcekitd-test -req=format -line=32 -length=1 %s >>%t.response
59+ // RUN: %sourcekitd-test -req=format -line=42 -length=1 %s >>%t.response
4960// RUN: %FileCheck --strict-whitespace %s <%t.response
5061
5162// CHECK: key.sourcetext: " var abc = 1"
@@ -68,3 +79,5 @@ func foo4() {
6879// CHECK: key.sourcetext: " let test = {"
6980// CHECK: key.sourcetext: " return 0"
7081// CHECK: key.sourcetext: " }()"
82+
83+ // CHECK: key.sourcetext: " })"
You can’t perform that action at this time.
0 commit comments