Skip to content

Commit edbe3ec

Browse files
authored
Merge pull request #609 from NathanReb/update-ocamlformat
Update to ocamlformat 0.28.1 for 5.4 compat
2 parents c0106e8 + 3f64154 commit edbe3ec

File tree

15 files changed

+149
-152
lines changed

15 files changed

+149
-152
lines changed

.ocamlformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=0.27.0
1+
version=0.28.1
22
profile=conventional
33
parse-docstrings=true

bench/drivers/identity/inputs/bap_knowledge.ml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,11 @@ module Domain = struct
754754
try
755755
Result.return
756756
@@ Map.merge x y ~f:(fun ~key:_ -> function
757-
| `Left v | `Right v -> Some v
758-
| `Both (x, y) -> (
759-
match join x y with
760-
| Error conflict -> raise @@ Join.Conflict conflict
761-
| Ok z -> Some z))
757+
| `Left v | `Right v -> Some v
758+
| `Both (x, y) -> (
759+
match join x y with
760+
| Error conflict -> raise @@ Join.Conflict conflict
761+
| Ok z -> Some z))
762762
with Join.Conflict err -> Error err
763763
in
764764
let inspect xs =
@@ -767,9 +767,9 @@ module Domain = struct
767767
let order x y =
768768
Map.symmetric_diff x y ~data_equal:equal
769769
|> Sequence.fold ~init:(0, 0, 0) ~f:(fun (l, m, r) -> function
770-
| _, `Left _ -> (l + 1, m, r)
771-
| _, `Right _ -> (l, m, r + 1)
772-
| _, `Unequal _ -> (l, m + 1, r))
770+
| _, `Left _ -> (l + 1, m, r)
771+
| _, `Right _ -> (l, m, r + 1)
772+
| _, `Unequal _ -> (l, m + 1, r))
773773
|> function
774774
| 0, 0, 0 -> Order.EQ
775775
| 0, 0, _ -> LT
@@ -1077,9 +1077,8 @@ module Documentation = struct
10771077
let classes () =
10781078
Hashtbl.to_alist Registry.public
10791079
|> List.map ~f:(fun (cls, slots) ->
1080-
( (cls, Registry.(find classes) cls),
1081-
List.map slots ~f:(fun slot -> (slot, Registry.(find slots) slot))
1082-
))
1080+
( (cls, Registry.(find classes) cls),
1081+
List.map slots ~f:(fun slot -> (slot, Registry.(find slots) slot)) ))
10831082

10841083
let rules () = Hash_set.to_list Registry.rules
10851084
end
@@ -2882,22 +2881,22 @@ module Knowledge = struct
28822881
fun cls ->
28832882
Oid.Tree.to_sequence cls.vals
28842883
|> Knowledge.Seq.fold ~init:cls ~f:(fun cls (obj, (info : Env.info)) ->
2885-
match info.name with
2886-
| None -> Knowledge.return cls
2887-
| Some sym ->
2888-
if not (needs_import cls sym obj) then Knowledge.return cls
2889-
else
2890-
let obj' =
2891-
match Map.find cls.objs { package; name = sym.name } with
2892-
| None -> Oid.zero
2893-
| Some obj' -> obj'
2894-
in
2895-
if (not strict) || Oid.(obj' = zero || obj' = obj) then
2896-
intern_symbol sym obj cls
2897-
else
2898-
let info = Oid.Tree.find_exn cls.vals obj' in
2899-
let sym' = Option.value_exn info.name in
2900-
Knowledge.fail (Import (sym, sym')))
2884+
match info.name with
2885+
| None -> Knowledge.return cls
2886+
| Some sym ->
2887+
if not (needs_import cls sym obj) then Knowledge.return cls
2888+
else
2889+
let obj' =
2890+
match Map.find cls.objs { package; name = sym.name } with
2891+
| None -> Oid.zero
2892+
| Some obj' -> obj'
2893+
in
2894+
if (not strict) || Oid.(obj' = zero || obj' = obj) then
2895+
intern_symbol sym obj cls
2896+
else
2897+
let info = Oid.Tree.find_exn cls.vals obj' in
2898+
let sym' = Option.value_exn info.name in
2899+
Knowledge.fail (Import (sym, sym')))
29012900

29022901
let package_exists package =
29032902
Map.exists ~f:(fun { Env.objs } ->
@@ -3021,7 +3020,7 @@ module Knowledge = struct
30213020
fun cls obj ->
30223021
Slot.enum cls
30233022
|> Base.List.filter ~f:(function Slot.Pack { promises } ->
3024-
not (Hashtbl.is_empty promises))
3023+
not (Hashtbl.is_empty promises))
30253024
|> List.iter ~f:(fun (Slot.Pack s) -> ignore_m @@ collect s obj)
30263025

30273026
let get_value cls obj =
@@ -3154,15 +3153,15 @@ module Knowledge = struct
31543153
let payload =
31553154
Map.to_alist classes
31563155
|> List.map ~f:(fun (cid, { Env.vals; last }) ->
3157-
let data =
3158-
Oid.Tree.to_list vals
3159-
|> List.filter_map ~f:(fun (oid, { Env.data; name; comp }) ->
3160-
let data = serialize_record data in
3161-
let comp = Map.keys comp in
3162-
if Array.is_empty data && Option.is_none name then None
3163-
else Some { key = oid; sym = name; data; comp })
3164-
in
3165-
(cid, (last, data)))
3156+
let data =
3157+
Oid.Tree.to_list vals
3158+
|> List.filter_map ~f:(fun (oid, { Env.data; name; comp }) ->
3159+
let data = serialize_record data in
3160+
let comp = Map.keys comp in
3161+
if Array.is_empty data && Option.is_none name then None
3162+
else Some { key = oid; sym = name; data; comp })
3163+
in
3164+
(cid, (last, data)))
31663165
in
31673166
{ version = V2; payload }
31683167

bench/drivers/identity/inputs/market_data.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ module T = struct
307307
| `Auction_indicative_price ->
308308
Auction_indicative_price_event.of_yojson json'
309309
|> Result.map ~f:(fun event ->
310-
`Auction_indicative_price event)
310+
`Auction_indicative_price event)
311311
| `Auction_outcome ->
312312
Auction_outcome_event.of_yojson json'
313313
|> Result.map ~f:(fun event -> `Auction_outcome event))))
@@ -400,12 +400,12 @@ module T = struct
400400
"socket_sequence" )
401401
in
402402
(match message_type with
403-
| `Heartbeat ->
404-
heartbeat_of_yojson json'
405-
|> Result.map ~f:(fun event -> `Heartbeat event)
406-
| `Update ->
407-
Update.of_yojson json'
408-
|> Result.map ~f:(fun event -> `Update event))
403+
| `Heartbeat ->
404+
heartbeat_of_yojson json'
405+
|> Result.map ~f:(fun event -> `Heartbeat event)
406+
| `Update ->
407+
Update.of_yojson json'
408+
|> Result.map ~f:(fun event -> `Update event))
409409
|> Result.map ~f:(fun message -> { socket_sequence; message })))
410410
| #Yojson.Safe.t as json ->
411411
Result.failf

bench/drivers/ppx_sexp_conv/inputs/bap_knowledge.ml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,11 @@ module Domain = struct
754754
try
755755
Result.return
756756
@@ Map.merge x y ~f:(fun ~key:_ -> function
757-
| `Left v | `Right v -> Some v
758-
| `Both (x, y) -> (
759-
match join x y with
760-
| Error conflict -> raise @@ Join.Conflict conflict
761-
| Ok z -> Some z))
757+
| `Left v | `Right v -> Some v
758+
| `Both (x, y) -> (
759+
match join x y with
760+
| Error conflict -> raise @@ Join.Conflict conflict
761+
| Ok z -> Some z))
762762
with Join.Conflict err -> Error err
763763
in
764764
let inspect xs =
@@ -767,9 +767,9 @@ module Domain = struct
767767
let order x y =
768768
Map.symmetric_diff x y ~data_equal:equal
769769
|> Sequence.fold ~init:(0, 0, 0) ~f:(fun (l, m, r) -> function
770-
| _, `Left _ -> (l + 1, m, r)
771-
| _, `Right _ -> (l, m, r + 1)
772-
| _, `Unequal _ -> (l, m + 1, r))
770+
| _, `Left _ -> (l + 1, m, r)
771+
| _, `Right _ -> (l, m, r + 1)
772+
| _, `Unequal _ -> (l, m + 1, r))
773773
|> function
774774
| 0, 0, 0 -> Order.EQ
775775
| 0, 0, _ -> LT
@@ -1077,9 +1077,8 @@ module Documentation = struct
10771077
let classes () =
10781078
Hashtbl.to_alist Registry.public
10791079
|> List.map ~f:(fun (cls, slots) ->
1080-
( (cls, Registry.(find classes) cls),
1081-
List.map slots ~f:(fun slot -> (slot, Registry.(find slots) slot))
1082-
))
1080+
( (cls, Registry.(find classes) cls),
1081+
List.map slots ~f:(fun slot -> (slot, Registry.(find slots) slot)) ))
10831082

10841083
let rules () = Hash_set.to_list Registry.rules
10851084
end
@@ -2882,22 +2881,22 @@ module Knowledge = struct
28822881
fun cls ->
28832882
Oid.Tree.to_sequence cls.vals
28842883
|> Knowledge.Seq.fold ~init:cls ~f:(fun cls (obj, (info : Env.info)) ->
2885-
match info.name with
2886-
| None -> Knowledge.return cls
2887-
| Some sym ->
2888-
if not (needs_import cls sym obj) then Knowledge.return cls
2889-
else
2890-
let obj' =
2891-
match Map.find cls.objs { package; name = sym.name } with
2892-
| None -> Oid.zero
2893-
| Some obj' -> obj'
2894-
in
2895-
if (not strict) || Oid.(obj' = zero || obj' = obj) then
2896-
intern_symbol sym obj cls
2897-
else
2898-
let info = Oid.Tree.find_exn cls.vals obj' in
2899-
let sym' = Option.value_exn info.name in
2900-
Knowledge.fail (Import (sym, sym')))
2884+
match info.name with
2885+
| None -> Knowledge.return cls
2886+
| Some sym ->
2887+
if not (needs_import cls sym obj) then Knowledge.return cls
2888+
else
2889+
let obj' =
2890+
match Map.find cls.objs { package; name = sym.name } with
2891+
| None -> Oid.zero
2892+
| Some obj' -> obj'
2893+
in
2894+
if (not strict) || Oid.(obj' = zero || obj' = obj) then
2895+
intern_symbol sym obj cls
2896+
else
2897+
let info = Oid.Tree.find_exn cls.vals obj' in
2898+
let sym' = Option.value_exn info.name in
2899+
Knowledge.fail (Import (sym, sym')))
29012900

29022901
let package_exists package =
29032902
Map.exists ~f:(fun { Env.objs } ->
@@ -3021,7 +3020,7 @@ module Knowledge = struct
30213020
fun cls obj ->
30223021
Slot.enum cls
30233022
|> Base.List.filter ~f:(function Slot.Pack { promises } ->
3024-
not (Hashtbl.is_empty promises))
3023+
not (Hashtbl.is_empty promises))
30253024
|> List.iter ~f:(fun (Slot.Pack s) -> ignore_m @@ collect s obj)
30263025

30273026
let get_value cls obj =
@@ -3154,15 +3153,15 @@ module Knowledge = struct
31543153
let payload =
31553154
Map.to_alist classes
31563155
|> List.map ~f:(fun (cid, { Env.vals; last }) ->
3157-
let data =
3158-
Oid.Tree.to_list vals
3159-
|> List.filter_map ~f:(fun (oid, { Env.data; name; comp }) ->
3160-
let data = serialize_record data in
3161-
let comp = Map.keys comp in
3162-
if Array.is_empty data && Option.is_none name then None
3163-
else Some { key = oid; sym = name; data; comp })
3164-
in
3165-
(cid, (last, data)))
3156+
let data =
3157+
Oid.Tree.to_list vals
3158+
|> List.filter_map ~f:(fun (oid, { Env.data; name; comp }) ->
3159+
let data = serialize_record data in
3160+
let comp = Map.keys comp in
3161+
if Array.is_empty data && Option.is_none name then None
3162+
else Some { key = oid; sym = name; data; comp })
3163+
in
3164+
(cid, (last, data)))
31663165
in
31673166
{ version = V2; payload }
31683167

bench/drivers/ppx_sexp_conv/inputs/market_data.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ module T = struct
307307
| `Auction_indicative_price ->
308308
Auction_indicative_price_event.of_yojson json'
309309
|> Result.map ~f:(fun event ->
310-
`Auction_indicative_price event)
310+
`Auction_indicative_price event)
311311
| `Auction_outcome ->
312312
Auction_outcome_event.of_yojson json'
313313
|> Result.map ~f:(fun event -> `Auction_outcome event))))
@@ -400,12 +400,12 @@ module T = struct
400400
"socket_sequence" )
401401
in
402402
(match message_type with
403-
| `Heartbeat ->
404-
heartbeat_of_yojson json'
405-
|> Result.map ~f:(fun event -> `Heartbeat event)
406-
| `Update ->
407-
Update.of_yojson json'
408-
|> Result.map ~f:(fun event -> `Update event))
403+
| `Heartbeat ->
404+
heartbeat_of_yojson json'
405+
|> Result.map ~f:(fun event -> `Heartbeat event)
406+
| `Update ->
407+
Update.of_yojson json'
408+
|> Result.map ~f:(fun event -> `Update event))
409409
|> Result.map ~f:(fun message -> { socket_sequence; message })))
410410
| #Yojson.Safe.t as json ->
411411
Result.failf

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
(ocamlfind :with-test)
2626
(re (and :with-test (>= 1.9.0)))
2727
(cinaps (and :with-test (>= v0.12.1)))
28-
(ocamlformat (and :with-dev-setup (= 0.26.2))))
28+
(ocamlformat (and :with-dev-setup (= 0.28.1))))
2929
(conflicts
3030
(ocaml-migrate-parsetree (< 2.0.0))
3131
(ocaml-base-compiler (= 5.1.0~alpha1))

ppxlib.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ depends: [
3030
"ocamlfind" {with-test}
3131
"re" {with-test & >= "1.9.0"}
3232
"cinaps" {with-test & >= "v0.12.1"}
33-
"ocamlformat" {with-dev-setup & = "0.26.2"}
33+
"ocamlformat" {with-dev-setup & = "0.28.1"}
3434
"odoc" {with-doc}
3535
]
3636
conflicts: [

src/common.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ let strip_gen_symbol_suffix =
2424
if
2525
chop 1 ~or_more:false string pos (Char.equal '_')
2626
&& chop 3 ~or_more:true string pos (function
27-
| '0' .. '9' -> true
28-
| _ -> false)
27+
| '0' .. '9' -> true
28+
| _ -> false)
2929
&& chop 2 ~or_more:false string pos (Char.equal '_')
3030
then String.prefix string !pos
3131
else string
@@ -46,17 +46,17 @@ let name_type_params_in_td_res (td : type_declaration) :
4646
in
4747
let name_param i (tp, variance) =
4848
(match tp.ptyp_desc with
49-
| Ptyp_any -> Ok (Ptyp_var (gen_symbol ~prefix:(prefix_string i) ()))
50-
| Ptyp_var _ as v -> Ok v
51-
| _ ->
52-
Error (Location.Error.createf ~loc:tp.ptyp_loc "not a type parameter"))
49+
| Ptyp_any -> Ok (Ptyp_var (gen_symbol ~prefix:(prefix_string i) ()))
50+
| Ptyp_var _ as v -> Ok v
51+
| _ ->
52+
Error (Location.Error.createf ~loc:tp.ptyp_loc "not a type parameter"))
5353
>>| fun ptyp_desc -> ({ tp with ptyp_desc }, variance)
5454
in
5555
let ptype_params, errors =
5656
td.ptype_params |> List.mapi ~f:name_param
5757
|> List.partition_map (function
58-
| Ok o -> Either.Left o
59-
| Error e -> Either.Right e)
58+
| Ok o -> Either.Left o
59+
| Error e -> Either.Right e)
6060
in
6161
match errors with [] -> Ok { td with ptype_params } | t :: q -> Error (t, q)
6262

0 commit comments

Comments
 (0)