Skip to content

Commit 7b453ea

Browse files
committed
ocamlformat 0.27.0
1 parent 3b271e7 commit 7b453ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+328
-273
lines changed

.ocamlformat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
profile = default
2-
version = 0.26.2
2+
version = 0.27.0
33

44
field-space = tight-decl
55
break-cases = toplevel
@@ -9,3 +9,4 @@ space-around-arrays = false
99
space-around-lists = false
1010
space-around-records = false
1111
space-around-variants = false
12+
parse-docstrings = false

analysis/reanalyze/src/DeadCommon.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,8 @@ module Decl = struct
555555
let refIsBelow (pos : Lexing.position) =
556556
decl.pos.pos_fname <> pos.pos_fname
557557
|| decl.pos.pos_cnum < pos.pos_cnum
558-
&& (* not a function defined inside a function, e.g. not a callback *)
558+
&&
559+
(* not a function defined inside a function, e.g. not a callback *)
559560
decl.posEnd.pos_cnum < pos.pos_cnum
560561
in
561562
refs |> PosSet.exists refIsBelow

analysis/src/SignatureHelp.ml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -553,44 +553,44 @@ let signatureHelp ~path ~pos ~currentFile ~debug ~allowForConstructorPayloads =
553553
let offset = ref 0 in
554554
Some
555555
(`InlineRecord
556-
(fields
557-
|> List.map (fun (field : field) ->
558-
let startOffset = !offset in
559-
let argText =
560-
Printf.sprintf "%s%s: %s" field.fname.txt
561-
(if field.optional then "?" else "")
562-
(Shared.typeToString
563-
(if field.optional then
564-
Utils.unwrapIfOption field.typ
565-
else field.typ))
566-
in
567-
let endOffset =
568-
startOffset + String.length argText
569-
in
570-
offset := endOffset + String.length ", ";
571-
(argText, field, (startOffset, endOffset)))))
556+
(fields
557+
|> List.map (fun (field : field) ->
558+
let startOffset = !offset in
559+
let argText =
560+
Printf.sprintf "%s%s: %s" field.fname.txt
561+
(if field.optional then "?" else "")
562+
(Shared.typeToString
563+
(if field.optional then
564+
Utils.unwrapIfOption field.typ
565+
else field.typ))
566+
in
567+
let endOffset =
568+
startOffset + String.length argText
569+
in
570+
offset := endOffset + String.length ", ";
571+
(argText, field, (startOffset, endOffset)))))
572572
| Args [(typ, _)] ->
573573
Some
574574
(`SingleArg
575-
( typ |> Shared.typeToString,
576-
docsForLabel ~file:full.file ~package:full.package
577-
~supportsMarkdownLinks typ ))
575+
( typ |> Shared.typeToString,
576+
docsForLabel ~file:full.file ~package:full.package
577+
~supportsMarkdownLinks typ ))
578578
| Args args ->
579579
let offset = ref 0 in
580580
Some
581581
(`TupleArg
582-
(args
583-
|> List.map (fun (typ, _) ->
584-
let startOffset = !offset in
585-
let argText = typ |> Shared.typeToString in
586-
let endOffset =
587-
startOffset + String.length argText
588-
in
589-
offset := endOffset + String.length ", ";
590-
( argText,
591-
docsForLabel ~file:full.file ~package:full.package
592-
~supportsMarkdownLinks typ,
593-
(startOffset, endOffset) ))))
582+
(args
583+
|> List.map (fun (typ, _) ->
584+
let startOffset = !offset in
585+
let argText = typ |> Shared.typeToString in
586+
let endOffset =
587+
startOffset + String.length argText
588+
in
589+
offset := endOffset + String.length ", ";
590+
( argText,
591+
docsForLabel ~file:full.file ~package:full.package
592+
~supportsMarkdownLinks typ,
593+
(startOffset, endOffset) ))))
594594
in
595595
let label =
596596
constructor.name ^ "("

compiler/bsb/bsb_exception.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ let print (fmt : Format.formatter) (x : error) =
4040
| Conflict_module (modname, dir1, dir2) ->
4141
Format.fprintf fmt
4242
"@{<error>Error:@} %s found in two directories: (%s, %s)\n\
43-
File names must be unique per project" modname dir1 dir2
43+
File names must be unique per project"
44+
modname dir1 dir2
4445
| No_implementation modname ->
4546
Format.fprintf fmt "@{<error>Error:@} %s does not have implementation file"
4647
modname
@@ -51,12 +52,14 @@ let print (fmt : Format.formatter) (x : error) =
5152
"File \"bsconfig.json\", line 1\n\
5253
@{<error>Error:@} package @{<error>%s@} is not found\n\
5354
It's the basic, required package. If you have it installed globally,\n\
54-
Please run `npm link rescript` to make it available" name
55+
Please run `npm link rescript` to make it available"
56+
name
5557
else
5658
Format.fprintf fmt
5759
"File \"bsconfig.json\", line 1\n\
5860
@{<error>Error:@} package @{<error>%s@} not found or built\n\
59-
- Did you install it?" name
61+
- Did you install it?"
62+
name
6063
| Json_config (pos, s) ->
6164
Format.fprintf fmt
6265
"File %S, line %d:\n\

compiler/bsb/bsb_ninja_check.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ let record ~(package_kind : Bsb_package_kind.t) ~per_proj_dir ~file
114114
record_global_atime buf Sys.executable_name;
115115
Ext_list.iter config.ppx_files (fun {name; args = _} ->
116116
try record_global_atime buf name
117-
with _ -> (* record the ppx files as a best effort *)
118-
());
117+
with _ ->
118+
(* record the ppx files as a best effort *)
119+
());
119120
let oc = open_out_bin file in
120121
Ext_buffer.output_buffer oc buf;
121122
close_out oc

compiler/bsb/bsb_ninja_gen.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ let emit_bsc_lib_includes (bs_dependencies : Bsb_config_types.dependencies)
4040
let all_includes source_dirs =
4141
source_dirs
4242
@ Ext_list.map bs_dependencies (fun x -> x.package_install_path)
43-
@ (* for external includes, if it is absolute path, leave it as is
43+
@
44+
(* for external includes, if it is absolute path, leave it as is
4445
for relative path './xx', we need '../.././x' since we are in
4546
[lib/bs], [build] is different from merlin though
4647
*)

compiler/bsb/bsb_parse_sources.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ and parse_sources (cxt : cxt) (sources : Ext_json_types.t) =
322322
| Arr file_groups -> parsing_arr_sources cxt file_groups.content
323323
| _ -> parsing_single_source cxt sources
324324

325-
let scan ~package_kind ~root ~cut_generators ~(* ~namespace *)
326-
ignored_dirs x : t =
325+
let scan ~package_kind ~root ~cut_generators
326+
~(* ~namespace *)
327+
ignored_dirs x : t =
327328
parse_sources
328329
{
329330
ignored_dirs;

compiler/bsb_helper/bsb_db_decode.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ and decode_single (x : string) (offset : cursor) : group =
5151
let modules = decode_modules x offset module_number in
5252
let dir_info_offset = !offset in
5353
let module_info_offset = String.index_from x dir_info_offset '\n' + 1 in
54-
let dir_length = Char.code x.[module_info_offset] - 48 (* Char.code '0'*) in
54+
let dir_length =
55+
Char.code x.[module_info_offset] - 48
56+
(* Char.code '0'*)
57+
in
5558
offset := module_info_offset + 1 + (dir_length * module_number) + 1;
5659
Group {modules; dir_info_offset; module_info_offset; dir_length})
5760
else Dummy

compiler/core/js_analyzer.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ let free_variables (stats : idents_stats) =
5858
| Fun {env}
5959
(* a optimization to avoid walking into function again
6060
if it's already comuted
61-
*) ->
61+
*)
62+
->
6263
stats.used_idents <-
6364
Set_ident.union (Js_fun_env.get_unbounded env) stats.used_idents
6465
| _ -> super.expression self exp);

compiler/core/js_cmj_format.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ let get_result mid_val =
113113
match mid_val.persistent_closed_lambda with
114114
| Some
115115
(Lconst
116-
(Const_js_null | Const_js_undefined _ | Const_js_true | Const_js_false))
116+
(Const_js_null | Const_js_undefined _ | Const_js_true | Const_js_false))
117117
| None ->
118118
mid_val
119119
| Some _ ->
@@ -131,8 +131,10 @@ let rec binary_search_aux arr lo hi (key : string) =
131131
let lo_val = Array.unsafe_get arr lo in
132132
if lo_val.name = key then get_result lo_val else not_found key
133133
else binary_search_aux arr lo mid key
134-
else if (* a[lo] =< a[mid] < key <= a[hi] *)
135-
lo = mid then
134+
else if
135+
(* a[lo] =< a[mid] < key <= a[hi] *)
136+
lo = mid
137+
then
136138
let hi_val = Array.unsafe_get arr hi in
137139
if hi_val.name = key then get_result hi_val else not_found key
138140
else binary_search_aux arr mid hi key

0 commit comments

Comments
 (0)