File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
test/SourceKit/CodeFormat Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -575,8 +575,12 @@ class FormatWalker : public SourceEntityWalker {
575
575
};
576
576
577
577
if (auto AE = dyn_cast_or_null<ApplyExpr>(Node.dyn_cast <Expr *>())) {
578
- collect (AE->getArg ());
579
- return ;
578
+ // PrefixUnaryExpr shouldn't be syntacticly considered as a funtion call
579
+ // for sibling alignment.
580
+ if (!isa<PrefixUnaryExpr>(AE)) {
581
+ collect (AE->getArg ());
582
+ return ;
583
+ }
580
584
}
581
585
582
586
if (auto PE = dyn_cast_or_null<ParenExpr>(Node.dyn_cast <Expr *>())) {
Original file line number Diff line number Diff line change
1
+ if condition,
2
+ !condition,
3
+ condition,
4
+ condition,
5
+ !condition,
6
+ condition {
7
+ }
8
+
9
+
10
+ // RUN: %sourcekitd-test -req=format -line=2 -length=1 %s >%t.response
11
+ // RUN: %sourcekitd-test -req=format -line=3 -length=1 %s >>%t.response
12
+ // RUN: %sourcekitd-test -req=format -line=4 -length=1 %s >>%t.response
13
+ // RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >>%t.response
14
+ // RUN: %sourcekitd-test -req=format -line=6 -length=1 %s >>%t.response
15
+
16
+ // RUN: %FileCheck --strict-whitespace %s <%t.response
17
+
18
+ // CHECK: key.sourcetext: " !condition,"
19
+ // CHECK: key.sourcetext: " condition,"
20
+ // CHECK: key.sourcetext: " condition,"
21
+ // CHECK: key.sourcetext: " !condition,"
22
+ // CHECK: key.sourcetext: " condition {"
You can’t perform that action at this time.
0 commit comments