File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
test/SourceKit/CodeFormat Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,10 @@ bool SemaAnnotator::walkToDeclPre(Decl *D) {
107
107
if (!handleImports (Import))
108
108
return false ;
109
109
110
+ } else if (auto OpD = dyn_cast<OperatorDecl>(D)) {
111
+ Loc = OpD->getLoc ();
112
+ if (Loc.isValid ())
113
+ NameLen = OpD->getName ().getLength ();
110
114
} else {
111
115
return true ;
112
116
}
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ foo(a: [
13
13
3 : 3
14
14
] )
15
15
16
+ operator <> {
17
+ x
18
+ }
19
+
16
20
// RUN: %sourcekitd-test -req=format -line=1 -length=1 %s >%t.response
17
21
// RUN: %sourcekitd-test -req=format -line=2 -length=1 %s >>%t.response
18
22
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s >>%t.response
@@ -23,6 +27,7 @@ foo(a: [
23
27
// RUN: %sourcekitd-test -req=format -line=8 -length=1 %s >>%t.response
24
28
// RUN: %sourcekitd-test -req=format -line=9 -length=1 %s >>%t.response
25
29
// RUN: %sourcekitd-test -req=format -line=13 -length=1 %s >>%t.response
30
+ // RUN: %sourcekitd-test -req=format -line=17 -length=1 %s >>%t.response
26
31
// RUN: FileCheck --strict-whitespace %s <%t.response
27
32
28
33
// CHECK: key.sourcetext: "class Foo {"
@@ -36,3 +41,4 @@ foo(a: [
36
41
// CHECK: key.sourcetext: "}"
37
42
// "foo(a: ["
38
43
// CHECK: key.sourcetext: " 3: 3"
44
+ // CHECK: key.sourcetext: " x"
You can’t perform that action at this time.
0 commit comments