-
Notifications
You must be signed in to change notification settings - Fork 102
Upgrade to OCamlformat 0.27.0 #1227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to OCamlformat 0.27.0 #1227
Conversation
panglesd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to have a release of ocamlformat with support for 5.2!
Most of the changes are related to the parse-docstrings being true by default. Making two commits (one setting parse-docstrings=false and version=0.27.0 and the second one removing parse-docstrings=false) would make it easier to see what part of the code change.
I left some very minor comments, it looks good to me.
Julow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! I'll split the commits for the final version, for now this is generated by a script.
d87a81d to
faa2b77
Compare
faa2b77 to
2a50637
Compare
|
OCamlformat 0.27.0 as been released 🎉 This is ready to be merged. |
2a50637 to
106ef91
Compare
|
I pushed again, this is ready to be merged. I've done all the formatting in one commit to make updating the 29 files changed, 173 insertions(+), 158 deletions(-)
diff --git a/.ocamlformat b/.ocamlformat
index 5626d8362..0274bdea4 100644
--- a/.ocamlformat
+++ b/.ocamlformat
@@ -1,3 +1,4 @@
module-item-spacing=preserve
-version=0.26.1
+version=0.27.0
ocaml-version=4.02
+parse-docstrings=false
diff --git a/src/document/comment.ml b/src/document/comment.ml
index 532472979..7f0375b82 100644
--- a/src/document/comment.ml
+++ b/src/document/comment.ml
@@ -117,7 +117,9 @@ module Reference = struct
| Some s -> s
and tooltip =
(* Add a tooltip if the content is not the rendered reference. *)
- match text with None -> None | Some _ -> Some rendered
+ match text with
+ | None -> None
+ | Some _ -> Some rendered
in
let url = Url.from_identifier ~stop_before:false id in
let target = Target.Internal (Resolved url) in
diff --git a/src/document/generator.ml b/src/document/generator.ml
index 5f165855a..14f8c662f 100644
--- a/src/document/generator.ml
+++ b/src/document/generator.ml
@@ -754,10 +754,10 @@ module Make (Syntax : SYNTAX) = struct
intro @ variants @ ending
let format_params :
- 'row.
- ?delim:[ `parens | `brackets ] ->
- Odoc_model.Lang.TypeDecl.param list ->
- text =
+ 'row.
+ ?delim:[ `parens | `brackets ] ->
+ Odoc_model.Lang.TypeDecl.param list ->
+ text =
fun ?(delim = `parens) params ->
let format_param { Odoc_model.Lang.TypeDecl.desc; variance; injectivity }
=
@@ -795,11 +795,11 @@ module Make (Syntax : SYNTAX) = struct
++ O.box_hv_no_indent (type_expr t2)))
let format_manifest :
- 'inner_row 'outer_row.
- ?is_substitution:bool ->
- ?compact_variants:bool ->
- Odoc_model.Lang.TypeDecl.Equation.t ->
- text * bool =
+ 'inner_row 'outer_row.
+ ?is_substitution:bool ->
+ ?compact_variants:bool ->
+ Odoc_model.Lang.TypeDecl.Equation.t ->
+ text * bool =
fun ?(is_substitution = false) ?(compact_variants = true) equation ->
let _ = compact_variants in
(* TODO *)
diff --git a/src/driver/odoc_unit.ml b/src/driver/odoc_unit.ml
index 3305285ac..2f2926080 100644
--- a/src/driver/odoc_unit.ml
+++ b/src/driver/odoc_unit.ml
@@ -46,7 +46,8 @@ module Pkg_args = struct
odocl_dir: %a@;\
includes: %a@;\
pages: [%a]@;\
- libs: [%a]@]" Fpath.pp x.odoc_dir Fpath.pp x.odocl_dir
+ libs: [%a]@]"
+ Fpath.pp x.odoc_dir Fpath.pp x.odocl_dir
Fmt.Dump.(list Fpath.pp)
(Fpath.Set.to_list x.includes)
sfp_pp
diff --git a/src/driver/packages.ml b/src/driver/packages.ml
index 03db4ed5e..befb60b8a 100644
--- a/src/driver/packages.ml
+++ b/src/driver/packages.ml
@@ -80,7 +80,8 @@ let pp_libty fmt l =
lib_deps: %a;@,\
modules: %a@,\
id_override: %a@,\n\
- \ }@]" l.lib_name Fpath.pp l.dir
+ \ }@]"
+ l.lib_name Fpath.pp l.dir
(Fmt.Dump.option Fmt.string)
l.archive_name
(Fmt.list ~sep:Fmt.comma Fmt.string)
diff --git a/src/driver/stats.ml b/src/driver/stats.ml
index 3cf13cdd0..f40074d73 100644
--- a/src/driver/stats.ml
+++ b/src/driver/stats.ml
@@ -93,8 +93,18 @@ let render_stats env ~generate_json nprocs =
++ dline "HTML" total_generate
++ line (procs nprocs)
++ descriptions)
- (fun comp compimpl compmld compassets link linkimpl linkmld indexes html
- procs descr ->
+ (fun comp
+ compimpl
+ compmld
+ compassets
+ link
+ linkimpl
+ linkmld
+ indexes
+ html
+ procs
+ descr
+ ->
let rec inner (a, b, c, j, d, e, f, i, g, h) =
Eio.Time.sleep clock 0.1;
let a' = Atomic.get stats.compiled_units in
diff --git a/src/html/html_fragment_json.ml b/src/html/html_fragment_json.ml
index 3c7d822bb..7fac891bb 100644
--- a/src/html/html_fragment_json.ml
+++ b/src/html/html_fragment_json.ml
@@ -53,15 +53,15 @@ let make ~config ~preamble ~url ~breadcrumbs ~toc ~uses_katex ~source_anchor
Format.pp_print_string ppf
(json_to_string
(`Object
- [
- ("type", `String "documentation");
- ("uses_katex", `Bool uses_katex);
- ("breadcrumbs", json_of_breadcrumbs config breadcrumbs);
- ("toc", json_of_toc toc);
- ("source_anchor", source_anchor);
- ("preamble", `String (json_of_html config preamble));
- ("content", `String (json_of_html config content));
- ]))
+ [
+ ("type", `String "documentation");
+ ("uses_katex", `Bool uses_katex);
+ ("breadcrumbs", json_of_breadcrumbs config breadcrumbs);
+ ("toc", json_of_toc toc);
+ ("source_anchor", source_anchor);
+ ("preamble", `String (json_of_html config preamble));
+ ("content", `String (json_of_html config content));
+ ]))
in
{ Odoc_document.Renderer.filename; content; children; path = url }
@@ -75,14 +75,14 @@ let make_src ~config ~url ~breadcrumbs ~sidebar content =
Format.pp_print_string ppf
(json_to_string
(`Object
- [
- ("type", `String "source");
- ("breadcrumbs", json_of_breadcrumbs config breadcrumbs);
- ("global_toc", global_toc);
- ( "content",
- `String
- (String.concat ~sep:""
- (List.map (Format.asprintf "%a" htmlpp) content)) );
- ]))
+ [
+ ("type", `String "source");
+ ("breadcrumbs", json_of_breadcrumbs config breadcrumbs);
+ ("global_toc", global_toc);
+ ( "content",
+ `String
+ (String.concat ~sep:""
+ (List.map (Format.asprintf "%a" htmlpp) content)) );
+ ]))
in
{ Odoc_document.Renderer.filename; content; children = []; path = url }
diff --git a/src/markdown/doc_of_md.ml b/src/markdown/doc_of_md.ml
index 29d98b1b9..b91dfa9f4 100644
--- a/src/markdown/doc_of_md.ml
+++ b/src/markdown/doc_of_md.ml
@@ -507,7 +507,10 @@ let thematic_break_to_nestable_block_element ~locator m (bs, warns) =
let rec list_to_nestable_block_element ~locator defs l m (bs, warns) =
let loc = meta_to_loc ~locator m in
- let style = `Heavy (* Note this is a layout property of ocamldoc *) in
+ let style =
+ `Heavy
+ (* Note this is a layout property of ocamldoc *)
+ in
let kind, warns =
match Block.List'.type' l with
| `Unordered _ -> (`Unordered, warns)
@@ -529,7 +532,10 @@ let rec list_to_nestable_block_element ~locator defs l m (bs, warns) =
and table_to_nestable_block_element ~locator defs tbl m (bs, warns) =
let loc = meta_to_loc ~locator m in
- let style = `Light (* Note this is a layout property of ocamldoc *) in
+ let style =
+ `Light
+ (* Note this is a layout property of ocamldoc *)
+ in
let col_count = Block.Table.col_count tbl in
let add_cell typ (n_cell, acc, warns) (cell, _) =
let content, warns =
diff --git a/src/model/semantics.ml b/src/model/semantics.ml
index f96ddd07a..ecf3fdb57 100644
--- a/src/model/semantics.ml
+++ b/src/model/semantics.ml
@@ -12,8 +12,8 @@ type internal_tags_removed =
(** {!Ast.block_element} without internal tags. *)
type _ handle_internal_tags =
- | Expect_status
- : [ `Default | `Inline | `Open | `Closed ] handle_internal_tags
+ | Expect_status :
+ [ `Default | `Inline | `Open | `Closed ] handle_internal_tags
| Expect_canonical : Reference.path option handle_internal_tags
| Expect_none : unit handle_internal_tags
| Expect_page_tags : Frontmatter.t handle_internal_tags
diff --git a/src/model/semantics.mli b/src/model/semantics.mli
index 0649948ac..09d750da9 100644
--- a/src/model/semantics.mli
+++ b/src/model/semantics.mli
@@ -1,7 +1,7 @@
(** How to handle internal tags. *)
type _ handle_internal_tags =
- | Expect_status
- : [ `Default | `Inline | `Open | `Closed ] handle_internal_tags
+ | Expect_status :
+ [ `Default | `Inline | `Open | `Closed ] handle_internal_tags
| Expect_canonical : Reference.path option handle_internal_tags
| Expect_none : unit handle_internal_tags
| Expect_page_tags : Frontmatter.t handle_internal_tags
diff --git a/src/model_desc/comment_desc.ml b/src/model_desc/comment_desc.ml
index 99981e115..7e65d7826 100644
--- a/src/model_desc/comment_desc.ml
+++ b/src/model_desc/comment_desc.ml
@@ -161,7 +161,9 @@ and tag : general_tag t =
let url_kind =
Variant
(function
- | `Url -> C0 "`Url" | `File -> C0 "`File" | `Document -> C0 "`Document")
+ | `Url -> C0 "`Url"
+ | `File -> C0 "`File"
+ | `Document -> C0 "`Document")
in
Variant
(function
diff --git a/src/model_desc/lang_desc.ml b/src/model_desc/lang_desc.ml
index d794b83a7..2ecdf45ea 100644
--- a/src/model_desc/lang_desc.ml
+++ b/src/model_desc/lang_desc.ml
@@ -58,7 +58,8 @@ and functorparameter_t =
let open Lang.FunctorParameter in
Variant
(function
- | Unit -> C0 "Unit" | Named x -> C ("Named", x, functorparameter_parameter))
+ | Unit -> C0 "Unit"
+ | Named x -> C ("Named", x, functorparameter_parameter))
(** {3 ModuleType} *)
@@ -420,7 +421,8 @@ and value_t =
let value_value_t =
Variant
(function
- | Abstract -> C0 "Abstract" | External x -> C ("External", x, List string))
+ | Abstract -> C0 "Abstract"
+ | External x -> C ("External", x, List string))
in
Record
[
diff --git a/src/odoc/bin/main.ml b/src/odoc/bin/main.ml
index db5d7dc31..269ee541c 100644
--- a/src/odoc/bin/main.ml
+++ b/src/odoc/bin/main.ml
@@ -484,14 +484,14 @@ module Indexing = struct
|| Fpath.has_ext "js" (Fpath.v file)) ->
Error
(`Msg
- "When generating a json index, the output must have a .json or .js \
- file extension")
+ "When generating a json index, the output must have a .json or \
+ .js file extension")
| Some file, `Marshall when not (Fpath.has_ext "odoc-index" (Fpath.v file))
->
Error
(`Msg
- "When generating a binary index, the output must have a \
- .odoc-index file extension")
+ "When generating a binary index, the output must have a \
+ .odoc-index file extension")
| Some file, _ -> Ok (Fs.File.of_string file)
| None, `JSON -> Ok (Fs.File.of_string "index.json")
| None, `Marshall -> Ok (Fs.File.of_string "index.odoc-index")
@@ -583,14 +583,14 @@ module Sidebar = struct
| Some file, `JSON when not (Fpath.has_ext "json" (Fpath.v file)) ->
Error
(`Msg
- "When generating a sidebar with --json, the output must have a \
- .json file extension")
+ "When generating a sidebar with --json, the output must have a \
+ .json file extension")
| Some file, `Marshall
when not (Fpath.has_ext "odoc-sidebar" (Fpath.v file)) ->
Error
(`Msg
- "When generating sidebar, the output must have a .odoc-sidebar \
- file extension")
+ "When generating sidebar, the output must have a .odoc-sidebar \
+ file extension")
| Some file, _ -> Ok (Fs.File.of_string file)
| None, `JSON -> Ok (Fs.File.of_string "sidebar.json")
| None, `Marshall -> Ok (Fs.File.of_string "sidebar.odoc-sidebar")
@@ -697,8 +697,8 @@ end = struct
when detected_package <> curpkgnane ->
Error
(`Msg
- "The package name specified with --current-package is not \
- consistent with the packages passed as a -P")
+ "The package name specified with --current-package is not \
+ consistent with the packages passed as a -P")
| _, (Some _ as r) (* we have equality or only detected package *) -> Ok r
| None, None -> Ok None
| Some given, None -> (
@@ -706,8 +706,8 @@ end = struct
with Not_found ->
Error
(`Msg
- "The package name specified with --current-package do not match \
- any package passed as a -P"))
+ "The package name specified with --current-package do not match \
+ any package passed as a -P"))
let find_current_package ~current_package page_roots input =
let detected_package = find_root_of_input page_roots input in
@@ -1588,8 +1588,8 @@ module Occurrences = struct
| [], [] ->
Error
(`Msg
- "At least one of --file-list or a path to a file must be passed \
- to odoc aggregate-occurrences")
+ "At least one of --file-list or a path to a file must be passed \
+ to odoc aggregate-occurrences")
| _ ->
dst_of_string dst >>= fun dst ->
Occurrences.aggregate ~dst ~warnings_options files file_list
diff --git a/src/odoc/compile.ml b/src/odoc/compile.ml
index 9767c8398..6250f567b 100644
--- a/src/odoc/compile.ml
+++ b/src/odoc/compile.ml
@@ -264,14 +264,14 @@ let mld ~parent_id ~parents_children ~output ~children ~warnings_options
| `Styled (s, es) ->
Some
(`Styled
- ( s,
- List.filter_map
- (function
- | { Location_.location; value } -> (
- match conv value with
- | Some value -> Some { Location_.location; value }
- | None -> None))
- es ))
+ ( s,
+ List.filter_map
+ (function
+ | { Location_.location; value } -> (
+ match conv value with
+ | Some value -> Some { Location_.location; value }
+ | None -> None))
+ es ))
| `Reference _ | `Link _ -> None
in
let frontmatter =
diff --git a/src/odoc/fs.ml b/src/odoc/fs.ml
index 4594542e8..73bcebf4a 100644
--- a/src/odoc/fs.ml
+++ b/src/odoc/fs.ml
@@ -79,7 +79,10 @@ module File = struct
Result.Ok (Bytes.unsafe_to_string buf)
in
let input_stream file ic =
- let bsize = 65536 (* IO_BUFFER_SIZE *) in
+ let bsize =
+ 65536
+ (* IO_BUFFER_SIZE *)
+ in
let buf = Buffer.create bsize in
let rec loop () =
match Buffer.add_channel buf ic bsize with
diff --git a/src/odoc/indexing.ml b/src/odoc/indexing.ml
index 9ba99d1fc..0443978da 100644
--- a/src/odoc/indexing.ml
+++ b/src/odoc/indexing.ml
@@ -113,7 +113,9 @@ let compile out_format ~output ~warnings_options ~occurrences ~roots
List.sort (fun (i, _) (j, _) -> compare i j) groups |> List.map snd
in
(* Files given without [--root] are grouped together *)
- match files with _ :: _ -> files :: root_groups | [] -> root_groups
+ match files with
+ | _ :: _ -> files :: root_groups
+ | [] -> root_groups
in
let hierarchies =
(* For each group, we create a hierarchy. *)
diff --git a/src/odoc/odoc_link.ml b/src/odoc/odoc_link.ml
index 9c27b4a5e..fcc3785aa 100644
--- a/src/odoc/odoc_link.ml
+++ b/src/odoc/odoc_link.ml
@@ -37,10 +37,10 @@ let content_for_hidden_modules =
[
Comment
(`Docs
- {
- elements = [ with_loc @@ `Paragraph (List.map with_loc sentence) ];
- suppress_warnings = true;
- });
+ {
+ elements = [ with_loc @@ `Paragraph (List.map with_loc sentence) ];
+ suppress_warnings = true;
+ });
]
let link_unit ~resolver ~filename m =
diff --git a/src/odoc/rendering.ml b/src/odoc/rendering.ml
index bda6a4718..eb29f199b 100644
--- a/src/odoc/rendering.ml
+++ b/src/odoc/rendering.ml
@@ -23,13 +23,13 @@ let document_of_odocl ~syntax input =
| Impl_content _ ->
Error
(`Msg
- "Wrong kind of unit: Expected a page or module unit, got an \
- implementation. Use the dedicated command for implementation.")
+ "Wrong kind of unit: Expected a page or module unit, got an \
+ implementation. Use the dedicated command for implementation.")
| Asset_content _ ->
Error
(`Msg
- "Wrong kind of unit: Expected a page or module unit, got an asset \
- unit. Use the dedicated command for assets.")
+ "Wrong kind of unit: Expected a page or module unit, got an asset \
+ unit. Use the dedicated command for assets.")
let document_of_input ~resolver ~warnings_options ~syntax input =
let output = Fs.File.(set_ext ".odocl" input) in
@@ -39,13 +39,13 @@ let document_of_input ~resolver ~warnings_options ~syntax input =
| `Impl _ ->
Error
(`Msg
- "Wrong kind of unit: Expected a page or module unit, got an \
- implementation. Use the dedicated command for implementation.")
+ "Wrong kind of unit: Expected a page or module unit, got an \
+ implementation. Use the dedicated command for implementation.")
| `Asset _ ->
Error
(`Msg
- "Wrong kind of unit: Expected a page or module unit, got an asset \
- unit. Use the dedicated command for assets.")
+ "Wrong kind of unit: Expected a page or module unit, got an asset \
+ unit. Use the dedicated command for assets.")
let render_document renderer ~sidebar ~output:root_dir ~extra_suffix ~extra doc
=
diff --git a/src/odoc/resolver.ml b/src/odoc/resolver.ml
index 2d90f8177..4bfa55def 100644
--- a/src/odoc/resolver.ml
+++ b/src/odoc/resolver.ml
@@ -135,7 +135,7 @@ end = struct
| None -> Error NoPackage
end
-let () = (ignore Named_roots.find_by_name [@warning "-5"])
+let () = ignore Named_roots.find_by_name [@warning "-5"]
module Accessible_paths : sig
type t
diff --git a/src/odoc/source.ml b/src/odoc/source.ml
index cd6ba6d35..fa1d79418 100644
--- a/src/odoc/source.ml
+++ b/src/odoc/source.ml
@@ -36,7 +36,7 @@ let compile ~resolver ~output ~warnings_options ~source_id input =
| None ->
Error
(`Msg
- "parent-id cannot be empty when compiling implementations.")
+ "parent-id cannot be empty when compiling implementations.")
in
parent >>= fun parent ->
let source_id =
diff --git a/src/parser/syntax.ml b/src/parser/syntax.ml
index 74ecf88a3..454aa20c9 100644
--- a/src/parser/syntax.ml
+++ b/src/parser/syntax.ml
@@ -325,7 +325,8 @@ and delimited_inline_element_list :
requires_leading_whitespace:bool ->
input ->
Ast.inline_element with_location list * Loc.span =
- fun ~parent_markup ~parent_markup_location ~requires_leading_whitespace input ->
+ fun ~parent_markup ~parent_markup_location ~requires_leading_whitespace
+ input ->
(* [~at_start_of_line] is used to interpret [`Minus] and [`Plus]. These are
word tokens if not the first non-whitespace tokens on their line. Then,
they are allowed in a non-link element list. *)
@@ -585,8 +586,7 @@ type ('block, 'stops_at_which_tokens) context =
(* This is a no-op. It is needed to prove to the type system that nestable block
elements are acceptable block elements in all contexts. *)
-let accepted_in_all_contexts :
- type block stops_at_which_tokens.
+let accepted_in_all_contexts : type block stops_at_which_tokens.
(block, stops_at_which_tokens) context ->
Ast.nestable_block_element ->
block =
@@ -632,8 +632,7 @@ let tag_to_words = function
- tables,
- lists, and
- section headings. *)
-let rec block_element_list :
- type block stops_at_which_tokens.
+let rec block_element_list : type block stops_at_which_tokens.
(block, stops_at_which_tokens) context ->
parent_markup:[< Token.t | `Comment ] ->
input ->
@@ -937,12 +936,12 @@ let rec block_element_list :
let block =
accepted_in_all_contexts context
(`Code_block
- {
- Ast.meta;
- delimiter;
- content = { value = s; location = v_loc };
- output;
- })
+ {
+ Ast.meta;
+ delimiter;
+ content = { value = s; location = v_loc };
+ output;
+ })
in
let block = Loc.at location block in
let acc = block :: acc in
diff --git a/src/parser/token.ml b/src/parser/token.ml
index ac23cd76b..495a15c82 100644
--- a/src/parser/token.ml
+++ b/src/parser/token.ml
@@ -55,8 +55,7 @@ type t =
tokens are emitted by the lexer. Otherwise, there would be the need for
unbounded lookahead, a (co-?)ambiguity between
[Single_newline Single_newline] and [Blank_line], and other problems. *)
- `Space of
- string
+ `Space of string
| `Single_newline of string
| `Blank_line of string
| (* A right curly brace ([}]), i.e. end of markup. *)
@@ -69,8 +68,7 @@ type t =
and [Minus] tokens. The parser combines plus and minus into words, except
when they appear first on a line, in which case the tokens are list item
bullets. *)
- `Word of
- string
+ `Word of string
| `Code_span of string
| `Raw_markup of string option * string
| `Math_span of string
diff --git a/src/search/html.ml b/src/search/html.ml
index 54763bdd5..0053a6a85 100644
--- a/src/search/html.ml
+++ b/src/search/html.ml
@@ -17,7 +17,9 @@ let url { Entry.id; kind; doc = _ } =
Values, types, ... are not sensitive to [stop_before], allowing us to
shorten the match. *)
- match kind with Doc -> false | _ -> true
+ match kind with
+ | Doc -> false
+ | _ -> true
in
let url = Odoc_document.Url.from_identifier ~stop_before id in
let config =
diff --git a/src/xref2/component.ml b/src/xref2/component.ml
index 8ae86aefa..095265b68 100644
--- a/src/xref2/component.ml
+++ b/src/xref2/component.ml
@@ -595,8 +595,7 @@ module Fmt = struct
and in [wrap2r] we pick [p2]. If [short_paths] is not set, we
print a string representing the constructor, and one or both paths
with brackets. *)
- let wrap :
- type a.
+ let wrap : type a.
config ->
string ->
(config -> Format.formatter -> a -> unit) ->
@@ -607,8 +606,7 @@ module Fmt = struct
if c.short_paths then Format.fprintf ppf "%a" (fn c) x
else Format.fprintf ppf "%s(%a)" txt (fn c) x
- let wrap2 :
- type a b.
+ let wrap2 : type a b.
config ->
string ->
(config -> Format.formatter -> a -> unit) ->
@@ -621,8 +619,7 @@ module Fmt = struct
if c.short_paths then Format.fprintf ppf "%a" (fn1 c) x
else Format.fprintf ppf "%s(%a,%a)" txt (fn1 c) x (fn2 c) y
- let wrap2r :
- type a b.
+ let wrap2r : type a b.
config ->
string ->
(config -> Format.formatter -> a -> unit) ->
@@ -784,8 +781,7 @@ module Fmt = struct
in
Format.fprintf ppf "%a%a" inner sg.items removed_fmt sg.removed
- and option :
- type a.
+ and option : type a.
config ->
(config -> Format.formatter -> a -> unit) ->
Format.formatter ->
@@ -1014,7 +1010,8 @@ module Fmt = struct
and type_decl_constructor_arg c ppf =
let open TypeDecl.Constructor in
function
- | Tuple ts -> type_tuple c ppf ts | Record fs -> type_decl_fields c ppf fs
+ | Tuple ts -> type_tuple c ppf ts
+ | Record fs -> type_decl_fields c ppf fs
and type_decl_field c ppf t =
let open TypeDecl.Field in
diff --git a/src/xref2/env.ml b/src/xref2/env.ml
index 0bff1246a..0feebe36b 100644
--- a/src/xref2/env.ml
+++ b/src/xref2/env.ml
@@ -534,8 +534,7 @@ let lookup_root_module_fallback name t =
match lookup_root_module (ModuleName.make_std name) t with
| Some (Resolved (_, id, m)) ->
Some
- (`Module
- ((id :> Identifier.Path.Module.t), Component.Delayed.put_val m))
+ (`Module ((id :> Identifier.Path.Module.t), Component.Delayed.put_val m))
| Some Forward | None -> None
let lookup_page_or_root_module_fallback name t =
diff --git a/src/xref2/errors.ml b/src/xref2/errors.ml
index 007ba83e9..9cebe4ee7 100644
--- a/src/xref2/errors.ml
+++ b/src/xref2/errors.ml
@@ -5,8 +5,7 @@ module Tools_error = struct
(** Errors raised by Tools *)
type handle_subs_error =
- [ `UnresolvedPath of
- [ `Module of Cpath.module_ ]
+ [ `UnresolvedPath of [ `Module of Cpath.module_ ]
(* Failed to resolve a module path when applying a fragment item *) ]
type reference_kind =
@@ -36,13 +35,11 @@ module Tools_error = struct
| `UnresolvedOriginalPath of Cpath.module_ * simple_module_lookup_error ]
and simple_module_lookup_error =
- [ `Local of
- Env.t * Ident.module_
+ [ `Local of Env.t * Ident.module_
(* Internal error: Found local path during lookup *)
| `Find_failure
| (* Internal error: the module was not found in the parent signature *)
- `Lookup_failure of
- Identifier.Path.Module.t
+ `Lookup_failure of Identifier.Path.Module.t
(* Could not find the module in the environment *)
| `Lookup_failure_root of ModuleName.t (* Could not find the root module *)
| `Parent of parent_lookup_error ]
@@ -59,19 +56,16 @@ module Tools_error = struct
| `Parent of parent_lookup_error ]
and simple_module_type_lookup_error =
- [ `LocalMT of
- Env.t * Ident.module_type
+ [ `LocalMT of Env.t * Ident.module_type
(* Internal error: Found local path during lookup *)
| `Find_failure
(* Internal error: the module was not found in the parent signature *)
- | `Lookup_failureMT of
- Identifier.ModuleType.t
+ | `Lookup_failureMT of Identifier.ModuleType.t
(* Could not find the module in the environment *)
| `Parent of parent_lookup_error ]
and simple_type_lookup_error =
- [ `LocalType of
- Env.t * Ident.type_
+ [ `LocalType of Env.t * Ident.type_
(* Internal error: Found local path during lookup *)
| `Class_replaced
(* Class was replaced with a destructive substitution and we're not sure
@@ -79,34 +73,27 @@ module Tools_error = struct
| `OpaqueClass (* Couldn't resolve class signature. *)
| `Find_failure
(* Internal error: the type was not found in the parent signature *)
- | `Lookup_failureT of
- Identifier.Path.Type.t
+ | `Lookup_failureT of Identifier.Path.Type.t
(* Could not find the module in the environment *)
| `Parent of parent_lookup_error ]
and simple_value_lookup_error =
- [ `LocalValue of
- Env.t * Ident.value
+ [ `LocalValue of Env.t * Ident.value
(* Internal error: Found local path during lookup *)
| `Find_failure
(* Internal error: the type was not found in the parent signature *)
- | `Lookup_failureV of
- Identifier.Path.Value.t
+ | `Lookup_failureV of Identifier.Path.Value.t
(* Could not find the module in the environment *)
| `Parent of parent_lookup_error ]
and parent_lookup_error =
- [ `Parent_sig of
- expansion_of_module_error
+ [ `Parent_sig of expansion_of_module_error
(* Error found while calculating the parent signature *)
- | `Parent_module_type of
- simple_module_type_lookup_error
+ | `Parent_module_type of simple_module_type_lookup_error
(* Error found while looking up parent module type *)
- | `Parent_expr of
- simple_module_type_expr_of_module_error
+ | `Parent_expr of simple_module_type_expr_of_module_error
(* Error found while evaluating parent module expression *)
- | `Parent_module of
- simple_module_lookup_error
+ | `Parent_module of simple_module_lookup_error
(* Error found while looking up parent module *)
| `Parent_type of simple_type_lookup_error
| `Fragment_root (* Encountered unexpected fragment root *)
diff --git a/src/xref2/link.ml b/src/xref2/link.ml
index cc42c4f21..6de5d80aa 100644
--- a/src/xref2/link.ml
+++ b/src/xref2/link.ml
@@ -408,8 +408,7 @@ and comment_block_element env suppress_warnings parent ~loc
`Heading h
| `Tag t -> `Tag (comment_tag env suppress_warnings parent ~loc t)
-and with_location :
- type a.
+and with_location : type a.
(loc:_ -> a -> a) -> a Location_.with_location -> a Location_.with_location
=
fun fn { value; location = loc } ->
diff --git a/src/xref2/ref_tools.ml b/src/xref2/ref_tools.ml
index 12b919d03..b00b73d44 100644
--- a/src/xref2/ref_tools.ml
+++ b/src/xref2/ref_tools.ml
@@ -223,7 +223,7 @@ module M = struct
| Error _ ->
Error
(`Parent
- (`Parent_module (`Lookup_failure_root (ModuleName.make_std name))))
+ (`Parent_module (`Lookup_failure_root (ModuleName.make_std name))))
end
module Path = struct
@@ -457,9 +457,10 @@ module ED = struct
let id_parent = match id.iv with `Extension (p, _) -> p in
Ok
(`Identifier
- (Identifier.Mk.extension_decl
- ( id_parent,
- (ExtensionName.make_std c.name, ExtensionName.make_std name) )))
+ (Identifier.Mk.extension_decl
+ ( id_parent,
+ (ExtensionName.make_std c.name, ExtensionName.make_std name)
+ )))
let in_signature _env ((parent', parent_cp, sg) : signature_lookup_result)
name =
@@ -533,7 +534,7 @@ module CS = struct
| `In_type (typ_name, _, `FPoly cs) ->
Ok
(`PolyConstructor
- (`Type (parent', typ_name), ConstructorName.make_std cs.name))
+ (`Type (parent', typ_name), ConstructorName.make_std cs.name))
| `In_type (typ_name, _, `FConstructor _) ->
Ok (`Constructor (`Type (parent', typ_name), name)))
| `T (parent', t) -> (
@@ -542,20 +543,20 @@ module CS = struct
| `FPoly cs ->
Ok
(`PolyConstructor
- ( (parent' : Resolved.DataType.t),
- ConstructorName.make_std cs.name ))
+ ( (parent' : Resolved.DataType.t),
+ ConstructorName.make_std cs.name ))
| `FConstructor _ ->
Ok (`Constructor ((parent' : Resolved.DataType.t), name)))
let of_component _env parent name =
Ok
(`Constructor
- ((parent : Resolved.DataType.t), ConstructorName.make_std name))
+ ((parent : Resolved.DataType.t), ConstructorName.make_std name))
let poly_of_component _env parent name =
Ok
(`PolyConstructor
- ((parent : Resolved.DataType.t), ConstructorName.make_std name))
+ ((parent : Resolved.DataType.t), ConstructorName.make_std name))
end
module F = struct
@@ -582,7 +583,7 @@ module F = struct
| `In_type (typ_name, _, `FField _) ->
Ok
(`Field
- ((`Type (parent', typ_name) :> Resolved.FieldParent.t), name)))
+ ((`Type (parent', typ_name) :> Resolved.FieldParent.t), name)))
| `T (parent', t) -> (
find Find.any_in_type t (fun x -> x) name_s >>= function
| `FConstructor _ -> got_a_constructor name_s
@@ -592,8 +593,8 @@ module F = struct
let of_component _env parent name =
Ok
(`Field
- ( (parent : Resolved.DataType.t :> Resolved.FieldParent.t),
- FieldName.make_std name ))
+ ( (parent : Resolved.DataType.t :> Resolved.FieldParent.t),
+ FieldName.make_std name ))
end
module MM = struct
diff --git a/src/xref2/tools.ml b/src/xref2/tools.ml
index 49414ab48..82eac8ca8 100644
--- a/src/xref2/tools.ml
+++ b/src/xref2/tools.ml
@@ -64,13 +64,13 @@ let c_ty_poss env p =
unresolved path, returns an ordered list of all possible unresolved
paths starting with the shortest and including the longest one. *)
let canonical_helper :
- 'unresolved 'resolved.
- Env.t ->
- (Env.t -> 'unresolved -> ('resolved * 'result, _) result) ->
- ('resolved -> Odoc_model.Paths.Path.Resolved.t) ->
- (Env.t -> 'unresolved -> 'unresolved list) ->
- 'unresolved ->
- ('resolved * 'result) option =
+ 'unresolved 'resolved.
+ Env.t ->
+ (Env.t -> 'unresolved -> ('resolved * 'result, _) result) ->
+ ('resolved -> Odoc_model.Paths.Path.Resolved.t) ->
+ (Env.t -> 'unresolved -> 'unresolved list) ->
+ 'unresolved ->
+ ('resolved * 'result) option =
fun env resolve lang_of possibilities p2 ->
let resolve p =
match resolve env p with Ok rp -> Some rp | Error _ -> None
@@ -1585,8 +1585,8 @@ and handle_signature_with_subs :
(fun sg_opt sub -> sg_opt >>= fun sg -> fragmap env sub sg)
(Ok sg) subs
-and assert_not_functor :
- type err. expansion -> (Component.Signature.t, err) Result.result = function
+and assert_not_functor : type err.
+ expansion -> (Component.Signature.t, err) Result.result = function
| Signature sg -> Ok sg
| _ -> assert false
@@ -1649,7 +1649,8 @@ and expansion_of_simple_expansion :
| Functor (arg, e) -> Functor (arg, helper e)
in
function
- | Signature sg -> Signature sg | Functor (arg, e) -> Functor (arg, helper e)
+ | Signature sg -> Signature sg
+ | Functor (arg, e) -> Functor (arg, helper e)
and expansion_of_module_type_expr :
Env.t ->
@@ -1711,7 +1712,9 @@ and expansion_of_module :
let sg =
(* Override the signature's documentation when the module also has
a comment attached. *)
- match m.doc.elements with [] -> sg | _ -> { sg with doc = m.doc }
+ match m.doc.elements with
+ | [] -> sg
+ | _ -> { sg with doc = m.doc }
in
Ok (Signature sg)
| Functor _ as f -> Ok fThe diffs are much bigger for sherlodoc as it uses the janestreet profile, which has changed a lot in this release. |
|
Thanks @Julow ! |
The aim of this preview is to gather feedback.
Changelog can be found here: https://github.com/ocaml-ppx/ocamlformat/blob/main/CHANGES.md