-
Notifications
You must be signed in to change notification settings - Fork 79
/
indent-test-failed.ml
241 lines (208 loc) · 4.79 KB
/
indent-test-failed.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
(* This fail contains code samples that are currently not indented
properly.
As indentation bugs are fixed, the corresponding samples should
be moved to the file indent-test.ml. *)
let quux list = List.map list ~f:(fun item ->
print_item item
)
let h x =
try ff a b
c d;
gg 1 2
3 4;
with e -> raise e
let x = foo ~f:(fun _ -> 0 (* Comment. *)
)
let () =
foo (sprintf ("a: %s"
^ " b: %s")
a
b)
let () =
Hashtbl.iter times ~f:(fun ~key:time ~data:azot ->
Clock.at time
>>> fun () ->
Db.iter t.db ~f:(fun dbo ->
if S.mem azot (Dbo.azo dbo) then
Dbo.dont dbo))
let w f =
List.map f ~f:(fun (a, b) ->
L.r a
>>= function
| Ok s -> `Fst (b, s)
| Error e -> `Snd (b, a, e))
let a =
B.c d ~e:f [
"g";
"h";
]
let a =
foo
~f:(fun () -> a
)
let () =
(* Comment. *)
bar a b
c d;
foo ~size
(* Comment. *)
~min:foo
?reduce
?override
()
let foo =
(* Comment. *)
List.map z
~f:(fun m ->
M.q m
|! T.u ~pr ~verbose:false
~p:H.P.US ~is_bar:false)
|! List.sort ~cmp:(fun a b ->
compare
(I.r a.T.s)
(I.r b.T.s))
let () =
snoo ~f:(fun foo ->
foo = bar
&& snoo)
let () =
snoo ~f:(fun foo ->
foo + bar
&& snoo)
let () =
snoo ~f:(fun foo ->
foo
&& snoo)
let variants a =
match String.split a ~on:'-' with
| [ s1; s2; s3 ] ->
let a0 = String.concat ~sep:"" [ s1; s2] in
let a1 = String.concat ~sep:"-" [ s1; s2; s3; "055" ] in (* Comment. *)
List.map [ a0; a1; a]
~f:(fun a_s -> lookup a_s)
|! List.flatten
| _ -> failwith "bad"
let optional_sci_float =
do_something ~a:1e-7
~b:(fun x -> x + 1)
let array_args =
fold s multi_sms.(0).message_number folder
more_args (* FIXME *)
let () =
match var with
| <:expr< $lid:f$ >> ->
KO
| <:expr< $lid:f$ >> when f x ->
KO
| y when f y ->
OK
| long_pattern
when f long_pattern -> (* Should be more indented than the clause body *)
z
let subscribe_impl dir topic ~aborted =
return (
match Directory.subscribe dir topic with
| None -> Error ()
| Some pipe ->
whenever (aborted >>| fun () -> Pipe.close_read pipe);
Ok pipe
)
next_argument (* should be indented correctly, given the braces *)
let command =
Command.Spec.(
empty
+> flag "-hello" (optional_with_default "Hello" string)
~doc:" The 'hello' of 'hello world'"
+> flag "-world" (optional_with_default "World" string)
~doc:" The 'world' of 'hello world'"
)
let server_comments request t =
t >>= Grep.server_comments
lazy
parser
every
let x = match y, z with
| A, (B | C)
| X, Y -> do_something() (* Issue #78 *)
type t = a
and typey = 4
and x = b
type 'a v = id:O.t ->
ssss:Ssss.t ->
dddd:ddd.t ->
t:S_m.t ->
mmm:Safe_float.t ->
qqq:int ->
c:C.t ->
uuuu:string option ->
aaaaaa:Aaaaaa.t ->
a:A.t ->
rrrrr:Rrrrr.t ->
time:Time.t ->
typ:[ `L_p of Safe_float.t ] ->
bazonk:present option ->
o_p_e:O_m.t option ->
only_hjkl:present option ->
show_junk:int option ->
d_p_o: Safe_float.t option ->
asdf:present option ->
generic:Sexp.t list ->
'a
let () =
try f a
with A () ->
()
| B () ->
()
| C () ->
()
let () =
match _ with
| foo ->
bar
>>| function _ ->
_
let foo x =
f1 x >= f2 x
&& f3
(f4 x)
let foo x =
(>=)
(f1 x) (f2 x)
&& f3
(f4 x)
let splitting_long_expression =
quad.{band, i3} <- quad.{band, i3} +. g +.
area_12 *. (P.potential x13 y13 +. P.potential x23 y23)
let x =
try a
with Not_found ->
b
| _ ->
c
let x =
try a
with Not_found ->
if a then b
| flag when String.is_prefix flag ~prefix:"-" ->
a
| _ ->
c
let () =
match var with
| <:expr< $lid:f$ >> ->
KO
| <:expr< $lid:f$ >> when f x ->
KO
| y when f y ->
OK
| long_pattern
when f long_pattern -> (* Should be more indented than the clause body *)
z
let _ =
List.map
(function x ->
blabla (* FIXME: indentation afer "(function" *)
blabla
blabla)
l