diff --git a/CHANGES.md b/CHANGES.md index 9925651611..7eb637c791 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -63,6 +63,10 @@ profile. This started with version 0.26.0. instead of only some. (#2737, @v-gb) +- \* Removed unecessary line breaks in several places (#2778, @Julow) + Many line breaks were caused by a bug in the implementation of `Format` + rather than a deliberate choice. + ### Internal - Added information on writing tests to `CONTRIBUTING.md` (#2838, @WardBrian) diff --git a/bin/ocamlformat-rpc/main.ml b/bin/ocamlformat-rpc/main.ml index f6fc689b6f..194944d909 100644 --- a/bin/ocamlformat-rpc/main.ml +++ b/bin/ocamlformat-rpc/main.ml @@ -28,16 +28,16 @@ let info = ; `P "Before the client and the server agree on a common version to use \ the following commands are available: $(b,Halt) to close the \ - connection to the RPC; $(b,Version) $(i,v) to ask the server to \ - use version $(i,v). If the server agrees upon the version he will \ - send the reply $(b,Version) $(i,v) and the protocol version is set \ - to $(i,v), to use another version later the client has to close \ - the connexion and start a new one. If the server cannot use \ - version $(i,v) he might propose another version $(i,w) by sending \ - the reply $(b,Version) $(i,w) that the client can accept by \ - sending the same request for version $(i,w), or propose another \ - version. If the server cannot propose another version it will \ - close the connection. Unknown commands are ignored." + connection to the RPC; $(b,Version) $(i,v) to ask the server to use \ + version $(i,v). If the server agrees upon the version he will send \ + the reply $(b,Version) $(i,v) and the protocol version is set to \ + $(i,v), to use another version later the client has to close the \ + connexion and start a new one. If the server cannot use version \ + $(i,v) he might propose another version $(i,w) by sending the reply \ + $(b,Version) $(i,w) that the client can accept by sending the same \ + request for version $(i,w), or propose another version. If the \ + server cannot propose another version it will close the connection. \ + Unknown commands are ignored." ; `P "Once the client and the server agree on a common version, the \ requests you can send may differ from one version to another." diff --git a/lib/Ast.ml b/lib/Ast.ml index 90a8982858..d05d4b9313 100644 --- a/lib/Ast.ml +++ b/lib/Ast.ml @@ -74,10 +74,10 @@ type cls = Let_match | Match | Non_apply | Sequence | Then | ThenElse module Token = struct let is_infix = function | Parser.AMPERAMPER | AMPERSAND | ANDOP _ | BAR | BARBAR | COLON - |COLONCOLON | COLONEQUAL | DOTDOT | DOTOP _ | EQUAL | GREATER - |HASHOP _ | INFIXOP0 _ | INFIXOP1 _ | INFIXOP2 _ | INFIXOP3 _ - |INFIXOP4 _ | LESS | LESSMINUS | LETOP _ | MINUS | MINUSDOT - |MINUSGREATER | PERCENT | PLUS | PLUSDOT | PLUSEQ | SLASH | STAR -> + |COLONCOLON | COLONEQUAL | DOTDOT | DOTOP _ | EQUAL | GREATER | HASHOP _ + |INFIXOP0 _ | INFIXOP1 _ | INFIXOP2 _ | INFIXOP3 _ | INFIXOP4 _ | LESS + |LESSMINUS | LETOP _ | MINUS | MINUSDOT | MINUSGREATER | PERCENT | PLUS + |PLUSDOT | PLUSEQ | SLASH | STAR -> true | _ -> false end @@ -1307,8 +1307,8 @@ end = struct |Pexp_send _ | Pexp_sequence _ | Pexp_setfield _ | Pexp_setinstvar _ |Pexp_tuple _ | Pexp_unreachable | Pexp_variant _ | Pexp_while _ |Pexp_hole | Pexp_beginend _ | Pexp_parens _ | Pexp_cons _ - |Pexp_letopen _ | Pexp_indexop_access _ | Pexp_prefix _ - |Pexp_infix _ | Pexp_construct_unit_beginend _ -> + |Pexp_letopen _ | Pexp_indexop_access _ | Pexp_prefix _ | Pexp_infix _ + |Pexp_construct_unit_beginend _ -> assert false | Pexp_extension (_, ext) -> assert (check_extensions ext) | Pexp_object ({pcstr_self; _}, _) -> @@ -1650,8 +1650,8 @@ end = struct | Ptyp_alias _ -> Some (As, Non) | Ptyp_constr (_, _ :: _ :: _) -> Some (Comma, Non) | Ptyp_constr _ -> Some (Apply, Non) - | Ptyp_any | Ptyp_var _ | Ptyp_object _ | Ptyp_class _ - |Ptyp_variant _ | Ptyp_package _ | Ptyp_extension _ | Ptyp_open _ -> + | Ptyp_any | Ptyp_var _ | Ptyp_object _ | Ptyp_class _ | Ptyp_variant _ + |Ptyp_package _ | Ptyp_extension _ | Ptyp_open _ -> None ) | {ctx= Cty {pcty_desc; _}; ast= Typ typ; _} -> ( match pcty_desc with @@ -1743,8 +1743,8 @@ end = struct match pcl_desc with Pcl_apply _ -> Some (Apply, Non) | _ -> None ) | { ctx= Exp _ ; ast= - ( Pld _ | Top | Tli _ | Pat _ | Cl _ | Mty _ | Mod _ | Sig _ - | Str _ | Clf _ | Ctf _ | Rep | Mb _ | Md _ ) } + ( Pld _ | Top | Tli _ | Pat _ | Cl _ | Mty _ | Mod _ | Sig _ | Str _ + | Clf _ | Ctf _ | Rep | Mb _ | Md _ ) } |{ctx= Fpe _ | Fpc _; ast= _} |{ctx= _; ast= Fpe _ | Fpc _} |{ctx= Vc _; ast= _} @@ -1767,8 +1767,8 @@ end = struct ( Pld _ | Top | Tli _ | Typ _ | Cty _ | Pat _ | Mty _ | Mod _ | Sig _ | Str _ | Clf _ | Ctf _ | Rep | Mb _ | Md _ ) ; ast= - ( Pld _ | Top | Tli _ | Pat _ | Exp _ | Cl _ | Mty _ | Mod _ - | Sig _ | Str _ | Clf _ | Ctf _ | Rep | Mb _ | Md _ ) } -> + ( Pld _ | Top | Tli _ | Pat _ | Exp _ | Cl _ | Mty _ | Mod _ | Sig _ + | Str _ | Clf _ | Ctf _ | Rep | Mb _ | Md _ ) } -> None (** [prec_ast ast] is the precedence of [ast]. Meaningful for binary @@ -1783,8 +1783,8 @@ end = struct | Ptyp_arrow _ | Ptyp_poly _ -> Some MinusGreater | Ptyp_tuple _ -> Some InfixOp3 | Ptyp_alias _ -> Some As - | Ptyp_any | Ptyp_var _ | Ptyp_constr _ | Ptyp_object _ - |Ptyp_class _ | Ptyp_variant _ | Ptyp_extension _ | Ptyp_open _ -> + | Ptyp_any | Ptyp_var _ | Ptyp_constr _ | Ptyp_object _ | Ptyp_class _ + |Ptyp_variant _ | Ptyp_extension _ | Ptyp_open _ -> None ) | Td _ -> None | Cty {pcty_desc; _} -> ( diff --git a/lib/Conf.ml b/lib/Conf.ml index b914234da4..1960080dd0 100644 --- a/lib/Conf.ml +++ b/lib/Conf.ml @@ -304,12 +304,12 @@ let profile = existing code. General guidelines that have directed the design \ include: Legibility, in the sense of making it as hard as possible \ for quick visual parsing to give the wrong interpretation, is of \ - highest priority; Whenever possible the high-level structure of \ - the code should be obvious by looking only at the left margin, in \ + highest priority; Whenever possible the high-level structure of the \ + code should be obvious by looking only at the left margin, in \ particular, it should not be necessary to visually jump from left \ - to right hunting for critical keywords, tokens, etc; All else \ - equal compact code is preferred as reading without scrolling is \ - easier, so indentation or white space is avoided unless it helps \ + to right hunting for critical keywords, tokens, etc; All else equal \ + compact code is preferred as reading without scrolling is easier, \ + so indentation or white space is avoided unless it helps \ legibility; Attention has been given to making some syntactic \ gotchas visually obvious." ; Decl.Value.make ~name:"janestreet" `janestreet @@ -376,8 +376,8 @@ module Formatting = struct the end of the line and breaks after it if the whole assignment \ expression does not fit on a single line." ; Decl.Value.make ~name:"begin-line" `Begin_line - "$(b,begin-line) positions assignment operators (`:=` and `<-`) \ - at the beginning of the line and breaks before it if the whole \ + "$(b,begin-line) positions assignment operators (`:=` and `<-`) at \ + the beginning of the line and breaks before it if the whole \ assignment expression does not fit on a single line." ] in Decl.choice ~names ~all ~default ~doc ~kind @@ -440,11 +440,11 @@ module Formatting = struct let names = ["break-collection-expressions"] in let all = [ Decl.Value.make ~name:"fit-or-vertical" `Fit_or_vertical - "$(b,fit-or-vertical) vertically breaks expressions if they do \ - not fit on a single line." + "$(b,fit-or-vertical) vertically breaks expressions if they do not \ + fit on a single line." ; Decl.Value.make ~name:"wrap" `Wrap - "$(b,wrap) will group simple expressions and try to format them \ - in a single line." ] + "$(b,wrap) will group simple expressions and try to format them in \ + a single line." ] in Decl.choice ~names ~all ~default ~doc ~kind (fun conf elt -> @@ -506,11 +506,11 @@ module Formatting = struct let names = ["break-infix"] in let all = [ Decl.Value.make ~name:"wrap" `Wrap - "$(b,wrap) will group simple expressions and try to format them \ - in a single line." + "$(b,wrap) will group simple expressions and try to format them in \ + a single line." ; Decl.Value.make ~name:"fit-or-vertical" `Fit_or_vertical - "$(b,fit-or-vertical) vertically breaks expressions if they do \ - not fit on a single line." + "$(b,fit-or-vertical) vertically breaks expressions if they do not \ + fit on a single line." ; Decl.Value.make ~name:"wrap-or-vertical" `Wrap_or_vertical "$(b,wrap-or-vertical) behaves like $(b,wrap) for high precedence \ operators and behaves like $(b,fit-or-vertical) for low \ @@ -570,8 +570,8 @@ module Formatting = struct let names = ["break-string-literals"] in let all = [ Decl.Value.make ~name:"auto" `Auto - "$(b,auto) mode breaks lines at newlines and wraps string \ - literals at the margin." + "$(b,auto) mode breaks lines at newlines and wraps string literals \ + at the margin." ; Decl.Value.make ~name:"never" `Never "$(b,never) mode formats string literals as they are parsed, in \ particular, with escape sequences expanded." ] @@ -629,9 +629,8 @@ module Formatting = struct [ Decl.Value.make ~name:"normal" `Normal "$(b,normal) indents as it would any other expression." ; Decl.Value.make ~name:"compact" `Compact - "$(b,compact) forces an indentation of 2, unless \ - $(b,nested-match) is set to $(b,align) and we're on the last \ - case." ] + "$(b,compact) forces an indentation of 2, unless $(b,nested-match) \ + is set to $(b,align) and we're on the last case." ] in Decl.choice ~names ~all ~default ~doc ~kind (fun conf elt -> @@ -660,9 +659,9 @@ module Formatting = struct declarations because that would change their meaning and on \ structures, signatures and objects for readability." ; Decl.Value.make ~name:"before-except-val" `Before_except_val - "$(b,before-except-val) puts doc comments before the \ - corresponding code, but puts doc comments of $(b,val) and \ - $(b,external) declarations after the corresponding declarations." + "$(b,before-except-val) puts doc comments before the corresponding \ + code, but puts doc comments of $(b,val) and $(b,external) \ + declarations after the corresponding declarations." ; Decl.Value.make ~name:"before" `Before "$(b,before) puts comments before the corresponding code." ] in @@ -705,8 +704,8 @@ module Formatting = struct let names = ["doc-comments-val"] in let msg = "If you are using `doc-comments-val=before` in combination with \ - `doc-comments=before` then only `doc-comments=before` is now \ - required to achive the same behavior. If you are using \ + `doc-comments=before` then only `doc-comments=before` is now required \ + to achive the same behavior. If you are using \ `doc-comments-val=before` in combination with `doc-comments=after` \ this behavior is not available anymore. If you are using \ `doc-comments-val=after` in combination with `doc-comments=before` \ @@ -749,8 +748,8 @@ module Formatting = struct let names = ["exp-grouping"] in let all = [ Decl.Value.make ~name:"preserve" `Preserve - "$(b,preserve) preserves the original grouping syntax \ - (parentheses or $(i,begin)/$(i,end))." + "$(b,preserve) preserves the original grouping syntax (parentheses \ + or $(i,begin)/$(i,end))." ; Decl.Value.make ~name:"parens" `Parens "$(b,parens) groups expressions using parentheses." ] in @@ -786,8 +785,8 @@ module Formatting = struct ; Decl.Value.make ~name:"tight" `Tight "$(b,tight) does not use a space." ; Decl.Value.make ~name:"tight-decl" `Tight_decl - "$(b,tight-decl) is $(b,tight) for declarations and $(b,loose) \ - for instantiations." ] + "$(b,tight-decl) is $(b,tight) for declarations and $(b,loose) for \ + instantiations." ] in Decl.choice ~names ~all ~default ~doc ~kind (fun conf elt -> update conf ~f:(fun f -> {f with field_space= elt})) @@ -835,8 +834,8 @@ module Formatting = struct ; Decl.Value.make ~name:"vertical" `Vertical "$(b,vertical) always vertically breaks branches." ; Decl.Value.make ~name:"keyword-first" `Keyword_first - "$(b,keyword-first) formats if-then-else expressions such that \ - the if-then-else keywords are the first on the line." + "$(b,keyword-first) formats if-then-else expressions such that the \ + if-then-else keywords are the first on the line." ; Decl.Value.make ~name:"k-r" `K_R "$(b,k-r) formats if-then-else expressions with parentheses that \ match the K&R style." ] @@ -933,8 +932,8 @@ module Formatting = struct let names = ["let-and"] in let all = [ Decl.Value.make ~name:"compact" `Compact - "$(b,compact) will try to format `let p = e and p = e` in a \ - single line." + "$(b,compact) will try to format `let p = e and p = e` in a single \ + line." ; Decl.Value.make ~name:"sparse" `Sparse "$(b,sparse) will always break between them." ] in @@ -1005,17 +1004,17 @@ module Formatting = struct let names = ["letop-punning"] in let all = [ Decl.Value.make ~name:"preserve" `Preserve - "$(b,preserve) uses let-punning only when it exists in the \ - source; the code \"$(i,let* foo and* z = z in ...)\" will be \ - left unchanged." + "$(b,preserve) uses let-punning only when it exists in the source; \ + the code \"$(i,let* foo and* z = z in ...)\" will be left \ + unchanged." ; Decl.Value.make ~name:"always" `Always "$(b,always) uses let-punning whenever possible; the code \ \"$(i,let* foo and* z = z in ...)\" will be rewritten to \ \"$(i,let* foo and* z in ...)\"." ; Decl.Value.make ~name:"never" `Never - "$(b,never) never uses let-punning; the code \"$(i,let* foo and* \ - z = z in ...)\" will be rewritten to \"$(i,let* foo = foo and* z \ - = z in ...)\". " ] + "$(b,never) never uses let-punning; the code \"$(i,let* foo and* z \ + = z in ...)\" will be rewritten to \"$(i,let* foo = foo and* z = \ + z in ...)\". " ] in Decl.choice ~names ~all ~default ~doc ~kind (fun conf elt -> update conf ~f:(fun f -> {f with letop_punning= elt})) @@ -1168,8 +1167,8 @@ module Formatting = struct [ Decl.Value.make ~name:"always" `Always "$(b,always) always uses parentheses around tuples." ; Decl.Value.make ~name:"multi-line-only" `Multi_line_only - "$(b,multi-line-only) mode will try to skip parens for \ - single-line tuples." ] + "$(b,multi-line-only) mode will try to skip parens for single-line \ + tuples." ] in Decl.choice ~names ~all ~default ~doc ~kind (fun conf elt -> update conf ~f:(fun f -> {f with parens_tuple= elt})) @@ -1180,8 +1179,8 @@ module Formatting = struct let names = ["parens-tuple-patterns"] in let all = [ Decl.Value.make ~name:"multi-line-only" `Multi_line_only - "$(b,multi-line-only) mode will try to skip parens for \ - single-line tuple patterns." + "$(b,multi-line-only) mode will try to skip parens for single-line \ + tuple patterns." ; Decl.Value.make ~name:"always" `Always "$(b,always) always uses parentheses around tuples patterns." ] in @@ -1211,8 +1210,8 @@ module Formatting = struct let names = ["sequence-blank-line"] in let all = [ Decl.Value.make ~name:"preserve-one" `Preserve_one - "$(b,preserve) will keep a blank line between two expressions of \ - a sequence if the input contains at least one." + "$(b,preserve) will keep a blank line between two expressions of a \ + sequence if the input contains at least one." ; Decl.Value.make ~name:"compact" `Compact "$(b,compact) will not keep any blank line between expressions of \ a sequence." ] @@ -1314,8 +1313,8 @@ module Formatting = struct let type_decl_indent = let docv = "COLS" in let doc = - "Indentation of type declarations ($(docv) columns) if they do not \ - fit on a single line." + "Indentation of type declarations ($(docv) columns) if they do not fit \ + on a single line." in let names = ["type-decl-indent"] in Decl.int ~names ~default ~doc ~docv ~kind ~allow_inline:false @@ -1328,8 +1327,8 @@ module Formatting = struct "Comments are divided into paragraphs by open lines (two or more \ consecutive newlines), and each paragraph is wrapped at the margin. \ Multi-line comments with vertically-aligned asterisks on the left \ - margin are not wrapped. Consecutive comments with both left and \ - right margin aligned are not wrapped either." + margin are not wrapped. Consecutive comments with both left and right \ + margin aligned are not wrapped either." in Decl.flag ~default ~names:["wrap-comments"] ~doc ~kind (fun conf elt -> update conf ~f:(fun f -> {f with wrap_comments= elt})) diff --git a/lib/Conf_t.ml b/lib/Conf_t.ml index c332d45cfc..b4c9fce3d8 100644 --- a/lib/Conf_t.ml +++ b/lib/Conf_t.ml @@ -35,8 +35,8 @@ module Error = struct | Bad_value (name, msg) -> Format.sprintf "For option %S: %s" name msg | Version_mismatch {read; installed} -> Format.sprintf - "Project should be formatted using ocamlformat version %S, but \ - the installed version is %S" + "Project should be formatted using ocamlformat version %S, but the \ + installed version is %S" read installed end diff --git a/lib/Fmt_ast.ml b/lib/Fmt_ast.ml index c5bff72148..0f04d00524 100644 --- a/lib/Fmt_ast.ml +++ b/lib/Fmt_ast.ml @@ -1927,8 +1927,17 @@ and fmt_infix_op_args c ~parens xexp op_args = $ hovbox_if (not very_last) 2 (fmt_expression c ~parens xarg) ) in let fmt_op_arg_group ~first:first_grp ~last:last_grp args = - let indent = if first_grp && parens then -2 else 0 in - hovbox indent + let box = + let indent = if first_grp && parens then -2 else 0 in + if + List.exists + ~f:(fun (cmts_before, cmts_after, _) -> + Option.is_some cmts_before || Option.is_some cmts_after ) + args + then hvbox indent + else hovbox indent + in + box (list_fl args (fun ~first ~last (cmts_before, cmts_after, (op, xarg)) -> let very_first = first_grp && first in @@ -1942,7 +1951,7 @@ and fmt_infix_op_args c ~parens xexp op_args = (str " ") in match cmts_after with - | Some c -> (noop, hovbox 0 (op $ space_break $ c)) + | Some c -> (noop, hovbox 0 (op $ force_break $ c)) | None -> (op $ break, noop) in fmt_opt cmts_before $ before_arg @@ -2538,7 +2547,8 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens in let cmts_after_kw = if Cmts.has_after c.cmts keyword_loc then - Some (Cmts.fmt_after c keyword_loc) + Some + (Cmts.fmt_after ~epi:force_break c keyword_loc) else None in let p = @@ -3145,8 +3155,7 @@ and fmt_class_signature c ~ctx ~pro ~epi ?ext self_ fields = in let ast x = Ctf x in let cmts_within = - if List.is_empty fields then - (* Side effect order is important. *) + if List.is_empty fields then (* Side effect order is important. *) Cmts.fmt_within ~pro:noop c (Ast.location ctx) else noop in diff --git a/lib/Params.ml b/lib/Params.ml index 90d2e6f99c..26fdf06f38 100644 --- a/lib/Params.ml +++ b/lib/Params.ml @@ -877,22 +877,27 @@ let get_if_then_else (c : Conf.t) ~pro ~first ~last ~parens_bch else if parens_bch then wrap (str "(") (str ")") (wrap_breaks k) else k in - let get_parens_breaks ~opn_hint_indent ~cls_hint:(ch_sp, ch_sl) = - let brk hint = fits_breaks "" ~hint "" in + let get_parens_breaks ?(force_break_before = false) ~opn_hint_indent + ~cls_hint:(ch_sp, ch_sl) = + let brk hint = + if force_break_before then break 1000 opn_hint_indent + else fits_breaks "" ~hint "" + in if has_beginend then let _, offset = ch_sl in wrap (brk (1, opn_hint_indent)) (break 1000 offset) else match imd with - | `Space -> wrap (brk (1, opn_hint_indent)) (brk ch_sp) + | `Space -> + wrap (brk (1, opn_hint_indent)) (fits_breaks "" ~hint:ch_sp "") | `No -> wrap (brk (0, opn_hint_indent)) noop | `Closing_on_separate_line -> - wrap (brk (0, opn_hint_indent)) (brk ch_sl) + wrap (brk (0, opn_hint_indent)) (fits_breaks "" ~hint:ch_sl "") in let cond () = match xcond with | Some xcnd -> - hvbox 2 + hovbox 2 ( hvbox 0 ( hvbox 2 ( pro @@ -943,6 +948,20 @@ let get_if_then_else (c : Conf.t) ~pro ~first ~last ~parens_bch ; space_between_branches= fmt_if (has_beginend || parens_bch) (str " ") } | `Fit_or_vertical -> + let is_multi_line = + not (Location.is_single_line expr_loc c.fmt_opts.margin.v) + in + let branch_pro, force_break_before = + if parens_bch || has_beginend then + if Option.is_some cmts_after_kw then (break 1000 0, is_multi_line) + else (str " ", is_multi_line) + else if is_multi_line then (break 1000 2, false) + else (break 1 2, false) + in + let wrap_breaks = + get_parens_breaks ~force_break_before ~opn_hint_indent:2 + ~cls_hint:((1, 0), (1000, 0)) + in { box_branch= hovbox ( match imd with @@ -950,20 +969,12 @@ let get_if_then_else (c : Conf.t) ~pro ~first ~last ~parens_bch | _ -> 0 ) ; cond= cond () ; box_keyword_and_expr= Fn.id - ; branch_pro= branch_pro () - ; wrap_parens= - wrap_parens - ~wrap_breaks: - (get_parens_breaks ~opn_hint_indent:2 - ~cls_hint:((1, 0), (1000, 0)) ) + ; branch_pro + ; wrap_parens= wrap_parens ~wrap_breaks ; beginend_loc ; box_expr= Some false - ; expr_pro= - Some - (fmt_if - (not (Location.is_single_line expr_loc c.fmt_opts.margin.v)) - (break_unless_newline 1000 2) ) - ; expr_eol= Some (break 1 2) + ; expr_pro= None + ; expr_eol= Some (break 1000 2) ; branch_expr ; break_end_branch= noop ; space_between_branches= diff --git a/lib/Std_longident.ml b/lib/Std_longident.ml index 7626d853d0..2277d57c5d 100644 --- a/lib/Std_longident.ml +++ b/lib/Std_longident.ml @@ -71,8 +71,8 @@ module String_id = struct if Char_id.is_infixop i.[0] then true else match i with - | "!=" | "land" | "lor" | "lxor" | "mod" | "::" | ":=" | "asr" - |"lsl" | "lsr" | "or" | "||" -> + | "!=" | "land" | "lor" | "lxor" | "mod" | "::" | ":=" | "asr" | "lsl" + |"lsr" | "or" | "||" -> true | _ -> is_monadic_binding i diff --git a/lib/Translation_unit.ml b/lib/Translation_unit.ml index 64842cf3c3..c3e68dcfc0 100644 --- a/lib/Translation_unit.ml +++ b/lib/Translation_unit.ml @@ -104,8 +104,8 @@ module Error = struct List.iter l ~f:(fun (l, w) -> Warning.print_warning l w) ; Format.fprintf fmt "@{Hint@}: (Warning 50) This file contains a \ - documentation comment (** ... *) that the OCaml compiler \ - does not know how to attach to the AST. OCamlformat does not \ + documentation comment (** ... *) that the OCaml compiler does \ + not know how to attach to the AST. OCamlformat does not \ support these cases. You can find more information at: \ https://github.com/ocaml-ppx/ocamlformat#overview. If you'd \ like to disable this check and let ocamlformat make a choice \ diff --git a/lib/bin_conf/Bin_conf.ml b/lib/bin_conf/Bin_conf.ml index 5c357c4a5a..5394141f00 100644 --- a/lib/bin_conf/Bin_conf.ml +++ b/lib/bin_conf/Bin_conf.ml @@ -57,27 +57,27 @@ let info = ; `P "$(tname) automatically formats OCaml code." ; `S (Decl.section_name Decl.Formatting `Valid) ; `P - "Unless otherwise noted, any option \ - $(b,--)$(i,option)$(b,=)$(i,VAL) detailed in this section can be \ - set in many ways, its value is determined in the following order \ - (of increasing priority): the default value is used if no other \ - value is specified. The value of a boolean option $(b,--foo) or \ - $(b,--no-foo) can be modified in an $(b,.ocamlformat) \ - configuration file with '$(b,foo = ){$(b,true),$(b,false)}', it \ - can be done for any other option with an '$(b,option = )$(i,VAL)' \ - line (*), or using the OCAMLFORMAT environment variable: \ + "Unless otherwise noted, any option $(b,--)$(i,option)$(b,=)$(i,VAL) \ + detailed in this section can be set in many ways, its value is \ + determined in the following order (of increasing priority): the \ + default value is used if no other value is specified. The value of \ + a boolean option $(b,--foo) or $(b,--no-foo) can be modified in an \ + $(b,.ocamlformat) configuration file with '$(b,foo = \ + ){$(b,true),$(b,false)}', it can be done for any other option with \ + an '$(b,option = )$(i,VAL)' line (*), or using the OCAMLFORMAT \ + environment variable: \ $(b,OCAMLFORMAT=)$(i,option)$(b,=)$(i,VAL)$(b,,)...$(b,,)$(i,option)$(b,=)$(i,VAL), \ or as an optional parameter on the command line, or with a global \ $(b,[@@@ocamlformat \")$(i,option)$(b,=)$(i,VAL)$(b,\"]) attribute \ in the processed file, or with an $(b,[@@ocamlformat \ - \")$(i,option)$(b,=)$(i,VAL)$(b,\"]) attribute on expression in \ - the processed file." + \")$(i,option)$(b,=)$(i,VAL)$(b,\"]) attribute on expression in the \ + processed file." ; `P - "(*) $(b,.ocamlformat) files in current and all ancestor \ - directories for each input file are used, applied from top to \ - bottom, overriding the settings each time a file is applied, \ - stopping at the project root. If no project root and no \ - $(b,ocamlformat) file has been found, and if the option \ + "(*) $(b,.ocamlformat) files in current and all ancestor directories \ + for each input file are used, applied from top to bottom, \ + overriding the settings each time a file is applied, stopping at \ + the project root. If no project root and no $(b,ocamlformat) file \ + has been found, and if the option \ $(b,enable-outside-detected-project) is set, the global \ $(b,ocamlformat) file defined in $(b,\\$XDG_CONFIG_HOME) (or in \ $(b,\\$HOME/.config) if $(b,\\$XDG_CONFIG_HOME) is undefined) is \ @@ -90,13 +90,13 @@ let info = Shell-style regular expressions are supported. Lines starting with \ $(b,#) are ignored and can be used as comments." ; `P - "If the $(b,disable) option is set, an $(b,.ocamlformat-enable) \ - file specifies files that OCamlFormat should format even when the \ + "If the $(b,disable) option is set, an $(b,.ocamlformat-enable) file \ + specifies files that OCamlFormat should format even when the \ $(b,disable) option is set. Each line in an \ $(b,.ocamlformat-enable) file specifies a filename relative to the \ - directory containing the $(b,.ocamlformat-enable) file. \ - Shell-style regular expressions are supported. Lines starting with \ - $(b,#) are ignored and can be used as comments." + directory containing the $(b,.ocamlformat-enable) file. Shell-style \ + regular expressions are supported. Lines starting with $(b,#) are \ + ignored and can be used as comments." ; `S (Decl.section_name Decl.Operational `Valid) ; `P "Unless mentioned otherwise non-formatting options cannot be set in \ @@ -156,8 +156,8 @@ let inplace = let check = let doc = - "Check whether the input files already are formatted. Mutually \ - exclusive with --inplace and --output." + "Check whether the input files already are formatted. Mutually exclusive \ + with --inplace and --output." in declare_option ~set:(fun check conf -> {conf with check}) @@ -705,8 +705,8 @@ let validate_inputs () = | Some kind -> Ok (`Stdin (Some name, kind)) | None -> Error - "Cannot deduce file kind from passed --name. Please specify \ - --impl or --intf" ) + "Cannot deduce file kind from passed --name. Please specify --impl \ + or --intf" ) | [File f], Some kind, name -> Ok (`Single_file (kind, name, f)) | [File f], None, name -> let kind = diff --git a/test/passing/refs.ahrefs/break_cases-align.ml.err b/test/passing/refs.ahrefs/break_cases-align.ml.err index 98a3c2d4d4..8eec415173 100644 --- a/test/passing/refs.ahrefs/break_cases-align.ml.err +++ b/test/passing/refs.ahrefs/break_cases-align.ml.err @@ -1 +1 @@ -Warning: break_cases-align.ml:269 exceeds the margin +Warning: break_cases-align.ml:268 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases-align.ml.ref b/test/passing/refs.ahrefs/break_cases-align.ml.ref index 702e9fe36f..ef15d9cae5 100644 --- a/test/passing/refs.ahrefs/break_cases-align.ml.ref +++ b/test/passing/refs.ahrefs/break_cases-align.ml.ref @@ -236,8 +236,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_cases-all.ml.err b/test/passing/refs.ahrefs/break_cases-all.ml.err index 3c7bee4528..2a818e9900 100644 --- a/test/passing/refs.ahrefs/break_cases-all.ml.err +++ b/test/passing/refs.ahrefs/break_cases-all.ml.err @@ -1 +1 @@ -Warning: break_cases-all.ml:269 exceeds the margin +Warning: break_cases-all.ml:268 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases-all.ml.ref b/test/passing/refs.ahrefs/break_cases-all.ml.ref index 702e9fe36f..ef15d9cae5 100644 --- a/test/passing/refs.ahrefs/break_cases-all.ml.ref +++ b/test/passing/refs.ahrefs/break_cases-all.ml.ref @@ -236,8 +236,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.err b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.err index 4aca007e21..bdfc225491 100644 --- a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.err +++ b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.err @@ -1 +1 @@ -Warning: break_cases-closing_on_separate_line.ml:277 exceeds the margin +Warning: break_cases-closing_on_separate_line.ml:276 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.ref b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.ref index 221441661b..74b35c942e 100644 --- a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.ref +++ b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line.ml.ref @@ -244,8 +244,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err index 57348847cb..c118a1dbd3 100644 --- a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err +++ b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err @@ -1 +1 @@ -Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:277 exceeds the margin +Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:276 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref index 221441661b..74b35c942e 100644 --- a/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref +++ b/test/passing/refs.ahrefs/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref @@ -244,8 +244,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.err b/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.err index b44c48f770..b5c77bdd0b 100644 --- a/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.err +++ b/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.err @@ -1 +1 @@ -Warning: break_cases-cosl_lnmp_cmei.ml:277 exceeds the margin +Warning: break_cases-cosl_lnmp_cmei.ml:276 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.ref b/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.ref index 221441661b..74b35c942e 100644 --- a/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.ref +++ b/test/passing/refs.ahrefs/break_cases-cosl_lnmp_cmei.ml.ref @@ -244,8 +244,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_cases-normal_indent.ml.err b/test/passing/refs.ahrefs/break_cases-normal_indent.ml.err index ecf6612029..243adbf007 100644 --- a/test/passing/refs.ahrefs/break_cases-normal_indent.ml.err +++ b/test/passing/refs.ahrefs/break_cases-normal_indent.ml.err @@ -1 +1 @@ -Warning: break_cases-normal_indent.ml:269 exceeds the margin +Warning: break_cases-normal_indent.ml:268 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases-normal_indent.ml.ref b/test/passing/refs.ahrefs/break_cases-normal_indent.ml.ref index 702e9fe36f..ef15d9cae5 100644 --- a/test/passing/refs.ahrefs/break_cases-normal_indent.ml.ref +++ b/test/passing/refs.ahrefs/break_cases-normal_indent.ml.ref @@ -236,8 +236,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_cases-toplevel.ml.err b/test/passing/refs.ahrefs/break_cases-toplevel.ml.err index e8ea041697..57a2d51260 100644 --- a/test/passing/refs.ahrefs/break_cases-toplevel.ml.err +++ b/test/passing/refs.ahrefs/break_cases-toplevel.ml.err @@ -1 +1 @@ -Warning: break_cases-toplevel.ml:235 exceeds the margin +Warning: break_cases-toplevel.ml:234 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases-toplevel.ml.ref b/test/passing/refs.ahrefs/break_cases-toplevel.ml.ref index a271e0ee13..d4bb8c9630 100644 --- a/test/passing/refs.ahrefs/break_cases-toplevel.ml.ref +++ b/test/passing/refs.ahrefs/break_cases-toplevel.ml.ref @@ -202,8 +202,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_cases.ml.err b/test/passing/refs.ahrefs/break_cases.ml.err index 6d7a26b1ff..78652337f5 100644 --- a/test/passing/refs.ahrefs/break_cases.ml.err +++ b/test/passing/refs.ahrefs/break_cases.ml.err @@ -1 +1 @@ -Warning: break_cases.ml:205 exceeds the margin +Warning: break_cases.ml:204 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_cases.ml.ref b/test/passing/refs.ahrefs/break_cases.ml.ref index f1b4851b14..5c6a0eebc4 100644 --- a/test/passing/refs.ahrefs/break_cases.ml.ref +++ b/test/passing/refs.ahrefs/break_cases.ml.ref @@ -172,8 +172,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ahrefs/break_string_literals.ml.err b/test/passing/refs.ahrefs/break_string_literals.ml.err new file mode 100644 index 0000000000..02f0ea5169 --- /dev/null +++ b/test/passing/refs.ahrefs/break_string_literals.ml.err @@ -0,0 +1,2 @@ +Warning: break_string_literals.ml:67 exceeds the margin +Warning: break_string_literals.ml:79 exceeds the margin diff --git a/test/passing/refs.ahrefs/break_string_literals.ml.ref b/test/passing/refs.ahrefs/break_string_literals.ml.ref index 7e96cdf92e..1dac11b62e 100644 --- a/test/passing/refs.ahrefs/break_string_literals.ml.ref +++ b/test/passing/refs.ahrefs/break_string_literals.ml.ref @@ -65,20 +65,20 @@ let fooo = Fooo "@\nFooooo: `%s`\n" let fooooooooooo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \ - commodo consequat. Duis aute irure dolor in reprehenderit in voluptate \ - velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat \ - cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id \ - est laborum." + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, \ + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse \ + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat \ + non proident, sunt in culpa qui officia deserunt mollit anim id est \ + laborum." let fooooooooooo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ tempor incididunt ut labore et dolore magna aliqua.@;\ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut \ aliquip ex ea commodo consequat.@;\ - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum \ - dolore eu fugiat nulla pariatur.@;\ + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore \ + eu fugiat nulla pariatur.@;\ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia \ deserunt mollit anim id est laborum." diff --git a/test/passing/refs.ahrefs/comments-no-wrap.ml.err b/test/passing/refs.ahrefs/comments-no-wrap.ml.err index 2577c534ab..9aa7dde658 100644 --- a/test/passing/refs.ahrefs/comments-no-wrap.ml.err +++ b/test/passing/refs.ahrefs/comments-no-wrap.ml.err @@ -1,3 +1,3 @@ -Warning: comments-no-wrap.ml:195 exceeds the margin -Warning: comments-no-wrap.ml:257 exceeds the margin -Warning: comments-no-wrap.ml:416 exceeds the margin +Warning: comments-no-wrap.ml:194 exceeds the margin +Warning: comments-no-wrap.ml:256 exceeds the margin +Warning: comments-no-wrap.ml:415 exceeds the margin diff --git a/test/passing/refs.ahrefs/comments-no-wrap.ml.ref b/test/passing/refs.ahrefs/comments-no-wrap.ml.ref index f9b0c6ae75..804f03e88a 100644 --- a/test/passing/refs.ahrefs/comments-no-wrap.ml.ref +++ b/test/passing/refs.ahrefs/comments-no-wrap.ml.ref @@ -72,8 +72,7 @@ match x with ;; match x with -| Aaaaaaaaaaaaaaaaaaaa -(* this comment is intended to refer to the case below *) +| Aaaaaaaaaaaaaaaaaaaa (* this comment is intended to refer to the case below *) | Bbbbbbbbbbbbbbbbbbbb -> () ;; diff --git a/test/passing/refs.ahrefs/comments.ml.err b/test/passing/refs.ahrefs/comments.ml.err index 41ee55d422..713a339e2a 100644 --- a/test/passing/refs.ahrefs/comments.ml.err +++ b/test/passing/refs.ahrefs/comments.ml.err @@ -1,3 +1,3 @@ -Warning: comments.ml:195 exceeds the margin -Warning: comments.ml:257 exceeds the margin -Warning: comments.ml:416 exceeds the margin +Warning: comments.ml:194 exceeds the margin +Warning: comments.ml:256 exceeds the margin +Warning: comments.ml:415 exceeds the margin diff --git a/test/passing/refs.ahrefs/comments.ml.ref b/test/passing/refs.ahrefs/comments.ml.ref index f9b0c6ae75..804f03e88a 100644 --- a/test/passing/refs.ahrefs/comments.ml.ref +++ b/test/passing/refs.ahrefs/comments.ml.ref @@ -72,8 +72,7 @@ match x with ;; match x with -| Aaaaaaaaaaaaaaaaaaaa -(* this comment is intended to refer to the case below *) +| Aaaaaaaaaaaaaaaaaaaa (* this comment is intended to refer to the case below *) | Bbbbbbbbbbbbbbbbbbbb -> () ;; diff --git a/test/passing/refs.ahrefs/comments_in_record-break_separator-after.ml.ref b/test/passing/refs.ahrefs/comments_in_record-break_separator-after.ml.ref index 39d7a47446..566046fd6d 100644 --- a/test/passing/refs.ahrefs/comments_in_record-break_separator-after.ml.ref +++ b/test/passing/refs.ahrefs/comments_in_record-break_separator-after.ml.ref @@ -107,8 +107,7 @@ type t = { type t = { mutable ci_fixed : IntervalSet.t; - mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t; } diff --git a/test/passing/refs.ahrefs/comments_in_record-break_separator-before.ml.ref b/test/passing/refs.ahrefs/comments_in_record-break_separator-before.ml.ref index 2bd70a2efd..5a22e52a80 100644 --- a/test/passing/refs.ahrefs/comments_in_record-break_separator-before.ml.ref +++ b/test/passing/refs.ahrefs/comments_in_record-break_separator-before.ml.ref @@ -107,8 +107,7 @@ type t = { type t = { mutable ci_fixed : IntervalSet.t - ; mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + ; mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t } diff --git a/test/passing/refs.ahrefs/comments_in_record.ml.ref b/test/passing/refs.ahrefs/comments_in_record.ml.ref index 39d7a47446..566046fd6d 100644 --- a/test/passing/refs.ahrefs/comments_in_record.ml.ref +++ b/test/passing/refs.ahrefs/comments_in_record.ml.ref @@ -107,8 +107,7 @@ type t = { type t = { mutable ci_fixed : IntervalSet.t; - mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t; } diff --git a/test/passing/refs.ahrefs/escaped_nl.ml.err b/test/passing/refs.ahrefs/escaped_nl.ml.err new file mode 100644 index 0000000000..2c67530849 --- /dev/null +++ b/test/passing/refs.ahrefs/escaped_nl.ml.err @@ -0,0 +1 @@ +Warning: escaped_nl.ml:1 exceeds the margin diff --git a/test/passing/refs.ahrefs/escaped_nl.ml.ref b/test/passing/refs.ahrefs/escaped_nl.ml.ref index 15f86137c9..f3fc0dc13f 100644 --- a/test/passing/refs.ahrefs/escaped_nl.ml.ref +++ b/test/passing/refs.ahrefs/escaped_nl.ml.ref @@ -1,6 +1,6 @@ let s1 = - "No field 'install', but a field 'remove': install instructions probably \ - part of 'build'. Use the 'install' field or a .install file" + "No field 'install', but a field 'remove': install instructions probably part \ + of 'build'. Use the 'install' field or a .install file" let x = cond 40 `Warning diff --git a/test/passing/refs.ahrefs/exp_grouping.ml.ref b/test/passing/refs.ahrefs/exp_grouping.ml.ref index eec29562d9..6e1849f768 100644 --- a/test/passing/refs.ahrefs/exp_grouping.ml.ref +++ b/test/passing/refs.ahrefs/exp_grouping.ml.ref @@ -194,8 +194,7 @@ let _ = |] let () = - if a then begin b - (* asd *) + if a then begin b (* asd *) end [@@@ocamlformat "if-then-else=compact"] @@ -215,8 +214,7 @@ let _ = end let () = - if a then begin b - (* asd *) + if a then begin b (* asd *) end [@@@ocamlformat "if-then-else=fit-or-vertical"] @@ -237,8 +235,7 @@ let _ = let () = if a then begin - b - (* asd *) + b (* asd *) end [@@@ocamlformat "if-then-else=keyword-first"] @@ -261,8 +258,7 @@ let _ = let () = if a - then begin - b (* asd *) + then begin b (* asd *) end [@@@ocamlformat "if-then-else=k-r"] @@ -381,8 +377,7 @@ let _ = | _ -> begin[@foo] y end let v = - map x begin fun x y z -> - y + map x begin fun x y z -> y end let v = @@ -396,8 +391,7 @@ let v = begin fun x arggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg - -> - y + -> y end let v = @@ -413,8 +407,7 @@ let v = argggggggggggggggggggggggggggggggggg gggggggggggggggggggg ggggggggggggggg - -> - y + -> y end let v = diff --git a/test/passing/refs.ahrefs/ite-compact.ml.ref b/test/passing/refs.ahrefs/ite-compact.ml.ref index e9ba48dfdc..c8604e9e06 100644 --- a/test/passing/refs.ahrefs/ite-compact.ml.ref +++ b/test/passing/refs.ahrefs/ite-compact.ml.ref @@ -178,7 +178,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ahrefs/ite-compact_closing.ml.ref b/test/passing/refs.ahrefs/ite-compact_closing.ml.ref index 26b372c8a6..fc811681a2 100644 --- a/test/passing/refs.ahrefs/ite-compact_closing.ml.ref +++ b/test/passing/refs.ahrefs/ite-compact_closing.ml.ref @@ -195,7 +195,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ahrefs/ite-fit_or_vertical.ml.ref b/test/passing/refs.ahrefs/ite-fit_or_vertical.ml.ref index c84abf5706..87615873d3 100644 --- a/test/passing/refs.ahrefs/ite-fit_or_vertical.ml.ref +++ b/test/passing/refs.ahrefs/ite-fit_or_vertical.ml.ref @@ -213,7 +213,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else diff --git a/test/passing/refs.ahrefs/ite-fit_or_vertical_closing.ml.err b/test/passing/refs.ahrefs/ite-fit_or_vertical_closing.ml.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/passing/refs.ahrefs/ite-fit_or_vertical_closing.ml.ref b/test/passing/refs.ahrefs/ite-fit_or_vertical_closing.ml.ref index 3b2dc00529..d14f4864c9 100644 --- a/test/passing/refs.ahrefs/ite-fit_or_vertical_closing.ml.ref +++ b/test/passing/refs.ahrefs/ite-fit_or_vertical_closing.ml.ref @@ -223,7 +223,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else () diff --git a/test/passing/refs.ahrefs/ite-fit_or_vertical_no_indicate.ml.ref b/test/passing/refs.ahrefs/ite-fit_or_vertical_no_indicate.ml.ref index c84abf5706..87615873d3 100644 --- a/test/passing/refs.ahrefs/ite-fit_or_vertical_no_indicate.ml.ref +++ b/test/passing/refs.ahrefs/ite-fit_or_vertical_no_indicate.ml.ref @@ -213,7 +213,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else diff --git a/test/passing/refs.ahrefs/ite-kw_first.ml.ref b/test/passing/refs.ahrefs/ite-kw_first.ml.ref index 44a48eac50..f6e6c34101 100644 --- a/test/passing/refs.ahrefs/ite-kw_first.ml.ref +++ b/test/passing/refs.ahrefs/ite-kw_first.ml.ref @@ -208,7 +208,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ahrefs/ite-kw_first_closing.ml.ref b/test/passing/refs.ahrefs/ite-kw_first_closing.ml.ref index c0838ccd41..cbcd0bac82 100644 --- a/test/passing/refs.ahrefs/ite-kw_first_closing.ml.ref +++ b/test/passing/refs.ahrefs/ite-kw_first_closing.ml.ref @@ -225,7 +225,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ahrefs/ite-kw_first_no_indicate.ml.ref b/test/passing/refs.ahrefs/ite-kw_first_no_indicate.ml.ref index 44a48eac50..f6e6c34101 100644 --- a/test/passing/refs.ahrefs/ite-kw_first_no_indicate.ml.ref +++ b/test/passing/refs.ahrefs/ite-kw_first_no_indicate.ml.ref @@ -208,7 +208,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ahrefs/ite-no_indicate.ml.ref b/test/passing/refs.ahrefs/ite-no_indicate.ml.ref index e9ba48dfdc..c8604e9e06 100644 --- a/test/passing/refs.ahrefs/ite-no_indicate.ml.ref +++ b/test/passing/refs.ahrefs/ite-no_indicate.ml.ref @@ -178,7 +178,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ahrefs/ite.ml.ref b/test/passing/refs.ahrefs/ite.ml.ref index e9ba48dfdc..c8604e9e06 100644 --- a/test/passing/refs.ahrefs/ite.ml.ref +++ b/test/passing/refs.ahrefs/ite.ml.ref @@ -178,7 +178,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ahrefs/js_source.ml.err b/test/passing/refs.ahrefs/js_source.ml.err index aefce07998..290c257cf0 100644 --- a/test/passing/refs.ahrefs/js_source.ml.err +++ b/test/passing/refs.ahrefs/js_source.ml.err @@ -1,5 +1,6 @@ Warning: js_source.ml:136 exceeds the margin Warning: js_source.ml:170 exceeds the margin +Warning: js_source.ml:224 exceeds the margin Warning: js_source.ml:243 exceeds the margin Warning: js_source.ml:255 exceeds the margin Warning: js_source.ml:862 exceeds the margin diff --git a/test/passing/refs.ahrefs/js_source.ml.ref b/test/passing/refs.ahrefs/js_source.ml.ref index e63dce0ed9..7cf3a6e1a0 100644 --- a/test/passing/refs.ahrefs/js_source.ml.ref +++ b/test/passing/refs.ahrefs/js_source.ml.ref @@ -222,8 +222,8 @@ let nullsafe_optimistic_third_party_params_in_non_strict = provided our tooling and error reporting is friendly enough to be smoothly used by developers. *) ~default:true - "Nullsafe: in this mode we treat non annotated third party method params \ - as if they were annotated as nullable." + "Nullsafe: in this mode we treat non annotated third party method params as \ + if they were annotated as nullable." let foo () = if%bind diff --git a/test/passing/refs.ahrefs/labeled_tuples.ml.err b/test/passing/refs.ahrefs/labeled_tuples.ml.err index f75afab645..a2d4093a6a 100644 --- a/test/passing/refs.ahrefs/labeled_tuples.ml.err +++ b/test/passing/refs.ahrefs/labeled_tuples.ml.err @@ -1,2 +1,2 @@ +Warning: labeled_tuples.ml:633 exceeds the margin Warning: labeled_tuples.ml:634 exceeds the margin -Warning: labeled_tuples.ml:635 exceeds the margin diff --git a/test/passing/refs.ahrefs/labeled_tuples.ml.ref b/test/passing/refs.ahrefs/labeled_tuples.ml.ref index e3c9620ae2..39f5c20719 100644 --- a/test/passing/refs.ahrefs/labeled_tuples.ml.ref +++ b/test/passing/refs.ahrefs/labeled_tuples.ml.ref @@ -608,8 +608,7 @@ type t = * (* before the z label *) z:(*after z label *) float (*end*) -let - (*before*) +let (*before*) ( ~(x (*l-ty*) : diff --git a/test/passing/refs.ahrefs/list_normalized.ml.ref b/test/passing/refs.ahrefs/list_normalized.ml.ref index 32868acb74..ed6222e0e2 100644 --- a/test/passing/refs.ahrefs/list_normalized.ml.ref +++ b/test/passing/refs.ahrefs/list_normalized.ml.ref @@ -27,8 +27,7 @@ let [ x; y ] = e let (x :: y :: ([] [@attr])) = e let [ x; (y [@attr]) ] = e let (*a*) (x (*b*) :: (*c*) y (*d*)) = e -let - (*a*) +let (*a*) [ x (*b*); (*c*) @@ -38,8 +37,7 @@ let ] (*f*) = e let (*a*) (x (*b*) :: (*c*) y (*d*) :: (*e*) ([] [@attr])) (*f*) = e -let - (*a*) +let (*a*) [ x (*b*); (*c*) diff --git a/test/passing/refs.default/break_cases-align.ml.err b/test/passing/refs.default/break_cases-align.ml.err index 98a3c2d4d4..8eec415173 100644 --- a/test/passing/refs.default/break_cases-align.ml.err +++ b/test/passing/refs.default/break_cases-align.ml.err @@ -1 +1 @@ -Warning: break_cases-align.ml:269 exceeds the margin +Warning: break_cases-align.ml:268 exceeds the margin diff --git a/test/passing/refs.default/break_cases-align.ml.ref b/test/passing/refs.default/break_cases-align.ml.ref index ce52cafead..f59d2207a9 100644 --- a/test/passing/refs.default/break_cases-align.ml.ref +++ b/test/passing/refs.default/break_cases-align.ml.ref @@ -236,8 +236,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_cases-all.ml.err b/test/passing/refs.default/break_cases-all.ml.err index 3c7bee4528..2a818e9900 100644 --- a/test/passing/refs.default/break_cases-all.ml.err +++ b/test/passing/refs.default/break_cases-all.ml.err @@ -1 +1 @@ -Warning: break_cases-all.ml:269 exceeds the margin +Warning: break_cases-all.ml:268 exceeds the margin diff --git a/test/passing/refs.default/break_cases-all.ml.ref b/test/passing/refs.default/break_cases-all.ml.ref index 41b6437651..e2f62ce250 100644 --- a/test/passing/refs.default/break_cases-all.ml.ref +++ b/test/passing/refs.default/break_cases-all.ml.ref @@ -236,8 +236,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_cases-closing_on_separate_line.ml.err b/test/passing/refs.default/break_cases-closing_on_separate_line.ml.err index d1a2698998..26544c9c91 100644 --- a/test/passing/refs.default/break_cases-closing_on_separate_line.ml.err +++ b/test/passing/refs.default/break_cases-closing_on_separate_line.ml.err @@ -1 +1 @@ -Warning: break_cases-closing_on_separate_line.ml:282 exceeds the margin +Warning: break_cases-closing_on_separate_line.ml:281 exceeds the margin diff --git a/test/passing/refs.default/break_cases-closing_on_separate_line.ml.ref b/test/passing/refs.default/break_cases-closing_on_separate_line.ml.ref index f65f18cc3c..130d192e7f 100644 --- a/test/passing/refs.default/break_cases-closing_on_separate_line.ml.ref +++ b/test/passing/refs.default/break_cases-closing_on_separate_line.ml.ref @@ -249,8 +249,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err b/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err index 4706b33ce2..8d959fa312 100644 --- a/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err +++ b/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err @@ -1 +1 @@ -Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:282 exceeds the margin +Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:281 exceeds the margin diff --git a/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref b/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref index 4406c2477e..bfd96707d0 100644 --- a/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref +++ b/test/passing/refs.default/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref @@ -249,8 +249,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.err b/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.err index 7fb5f97a35..f13eb98c3d 100644 --- a/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.err +++ b/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.err @@ -1 +1 @@ -Warning: break_cases-cosl_lnmp_cmei.ml:282 exceeds the margin +Warning: break_cases-cosl_lnmp_cmei.ml:281 exceeds the margin diff --git a/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.ref b/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.ref index 4406c2477e..bfd96707d0 100644 --- a/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.ref +++ b/test/passing/refs.default/break_cases-cosl_lnmp_cmei.ml.ref @@ -249,8 +249,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_cases-normal_indent.ml.err b/test/passing/refs.default/break_cases-normal_indent.ml.err index ecf6612029..243adbf007 100644 --- a/test/passing/refs.default/break_cases-normal_indent.ml.err +++ b/test/passing/refs.default/break_cases-normal_indent.ml.err @@ -1 +1 @@ -Warning: break_cases-normal_indent.ml:269 exceeds the margin +Warning: break_cases-normal_indent.ml:268 exceeds the margin diff --git a/test/passing/refs.default/break_cases-normal_indent.ml.ref b/test/passing/refs.default/break_cases-normal_indent.ml.ref index 41b6437651..e2f62ce250 100644 --- a/test/passing/refs.default/break_cases-normal_indent.ml.ref +++ b/test/passing/refs.default/break_cases-normal_indent.ml.ref @@ -236,8 +236,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_cases-toplevel.ml.err b/test/passing/refs.default/break_cases-toplevel.ml.err index e8ea041697..57a2d51260 100644 --- a/test/passing/refs.default/break_cases-toplevel.ml.err +++ b/test/passing/refs.default/break_cases-toplevel.ml.err @@ -1 +1 @@ -Warning: break_cases-toplevel.ml:235 exceeds the margin +Warning: break_cases-toplevel.ml:234 exceeds the margin diff --git a/test/passing/refs.default/break_cases-toplevel.ml.ref b/test/passing/refs.default/break_cases-toplevel.ml.ref index 2e2fd28b02..7564d84976 100644 --- a/test/passing/refs.default/break_cases-toplevel.ml.ref +++ b/test/passing/refs.default/break_cases-toplevel.ml.ref @@ -202,8 +202,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_cases.ml.err b/test/passing/refs.default/break_cases.ml.err index 78652337f5..3cac7951a8 100644 --- a/test/passing/refs.default/break_cases.ml.err +++ b/test/passing/refs.default/break_cases.ml.err @@ -1 +1 @@ -Warning: break_cases.ml:204 exceeds the margin +Warning: break_cases.ml:203 exceeds the margin diff --git a/test/passing/refs.default/break_cases.ml.ref b/test/passing/refs.default/break_cases.ml.ref index e3b68c3c6f..cb00252bef 100644 --- a/test/passing/refs.default/break_cases.ml.ref +++ b/test/passing/refs.default/break_cases.ml.ref @@ -171,8 +171,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.default/break_string_literals.ml.err b/test/passing/refs.default/break_string_literals.ml.err new file mode 100644 index 0000000000..a009d72c7a --- /dev/null +++ b/test/passing/refs.default/break_string_literals.ml.err @@ -0,0 +1,2 @@ +Warning: break_string_literals.ml:51 exceeds the margin +Warning: break_string_literals.ml:63 exceeds the margin diff --git a/test/passing/refs.default/break_string_literals.ml.ref b/test/passing/refs.default/break_string_literals.ml.ref index 3566cc2b9d..e861de92e1 100644 --- a/test/passing/refs.default/break_string_literals.ml.ref +++ b/test/passing/refs.default/break_string_literals.ml.ref @@ -49,20 +49,20 @@ let fooo = Fooo "@\nFooooo: `%s`\n" let fooooooooooo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \ - commodo consequat. Duis aute irure dolor in reprehenderit in voluptate \ - velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat \ - cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id \ - est laborum." + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, \ + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse \ + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat \ + non proident, sunt in culpa qui officia deserunt mollit anim id est \ + laborum." let fooooooooooo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ tempor incididunt ut labore et dolore magna aliqua.@;\ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut \ aliquip ex ea commodo consequat.@;\ - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum \ - dolore eu fugiat nulla pariatur.@;\ + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore \ + eu fugiat nulla pariatur.@;\ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia \ deserunt mollit anim id est laborum." diff --git a/test/passing/refs.default/comments-no-wrap.ml.err b/test/passing/refs.default/comments-no-wrap.ml.err index 16e9aa914b..0bb572e41e 100644 --- a/test/passing/refs.default/comments-no-wrap.ml.err +++ b/test/passing/refs.default/comments-no-wrap.ml.err @@ -1,3 +1,3 @@ -Warning: comments-no-wrap.ml:168 exceeds the margin -Warning: comments-no-wrap.ml:230 exceeds the margin -Warning: comments-no-wrap.ml:379 exceeds the margin +Warning: comments-no-wrap.ml:167 exceeds the margin +Warning: comments-no-wrap.ml:229 exceeds the margin +Warning: comments-no-wrap.ml:378 exceeds the margin diff --git a/test/passing/refs.default/comments-no-wrap.ml.ref b/test/passing/refs.default/comments-no-wrap.ml.ref index 5fd11d5457..4c8bdb97bd 100644 --- a/test/passing/refs.default/comments-no-wrap.ml.ref +++ b/test/passing/refs.default/comments-no-wrap.ml.ref @@ -54,8 +54,7 @@ match x with ;; match x with -| Aaaaaaaaaaaaaaaaaaaa -(* this comment is intended to refer to the case below *) +| Aaaaaaaaaaaaaaaaaaaa (* this comment is intended to refer to the case below *) | Bbbbbbbbbbbbbbbbbbbb -> () ;; diff --git a/test/passing/refs.default/comments.ml.err b/test/passing/refs.default/comments.ml.err index c9536f497d..1d173a9c51 100644 --- a/test/passing/refs.default/comments.ml.err +++ b/test/passing/refs.default/comments.ml.err @@ -1,3 +1,3 @@ -Warning: comments.ml:168 exceeds the margin -Warning: comments.ml:230 exceeds the margin -Warning: comments.ml:379 exceeds the margin +Warning: comments.ml:167 exceeds the margin +Warning: comments.ml:229 exceeds the margin +Warning: comments.ml:378 exceeds the margin diff --git a/test/passing/refs.default/comments.ml.ref b/test/passing/refs.default/comments.ml.ref index 5fd11d5457..4c8bdb97bd 100644 --- a/test/passing/refs.default/comments.ml.ref +++ b/test/passing/refs.default/comments.ml.ref @@ -54,8 +54,7 @@ match x with ;; match x with -| Aaaaaaaaaaaaaaaaaaaa -(* this comment is intended to refer to the case below *) +| Aaaaaaaaaaaaaaaaaaaa (* this comment is intended to refer to the case below *) | Bbbbbbbbbbbbbbbbbbbb -> () ;; diff --git a/test/passing/refs.default/comments_in_record-break_separator-after.ml.ref b/test/passing/refs.default/comments_in_record-break_separator-after.ml.ref index b011463882..1f9b343a72 100644 --- a/test/passing/refs.default/comments_in_record-break_separator-after.ml.ref +++ b/test/passing/refs.default/comments_in_record-break_separator-after.ml.ref @@ -101,8 +101,7 @@ type t = { type t = { mutable ci_fixed : IntervalSet.t; - mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t; } diff --git a/test/passing/refs.default/comments_in_record-break_separator-before.ml.ref b/test/passing/refs.default/comments_in_record-break_separator-before.ml.ref index 4642e03a40..d746d523fa 100644 --- a/test/passing/refs.default/comments_in_record-break_separator-before.ml.ref +++ b/test/passing/refs.default/comments_in_record-break_separator-before.ml.ref @@ -101,8 +101,7 @@ type t = { type t = { mutable ci_fixed : IntervalSet.t - ; mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + ; mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t } diff --git a/test/passing/refs.default/comments_in_record.ml.ref b/test/passing/refs.default/comments_in_record.ml.ref index b011463882..1f9b343a72 100644 --- a/test/passing/refs.default/comments_in_record.ml.ref +++ b/test/passing/refs.default/comments_in_record.ml.ref @@ -101,8 +101,7 @@ type t = { type t = { mutable ci_fixed : IntervalSet.t; - mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t; } diff --git a/test/passing/refs.default/escaped_nl.ml.err b/test/passing/refs.default/escaped_nl.ml.err new file mode 100644 index 0000000000..2c67530849 --- /dev/null +++ b/test/passing/refs.default/escaped_nl.ml.err @@ -0,0 +1 @@ +Warning: escaped_nl.ml:1 exceeds the margin diff --git a/test/passing/refs.default/escaped_nl.ml.ref b/test/passing/refs.default/escaped_nl.ml.ref index e7f8dda477..4e37db84f4 100644 --- a/test/passing/refs.default/escaped_nl.ml.ref +++ b/test/passing/refs.default/escaped_nl.ml.ref @@ -1,6 +1,6 @@ let s1 = - "No field 'install', but a field 'remove': install instructions probably \ - part of 'build'. Use the 'install' field or a .install file" + "No field 'install', but a field 'remove': install instructions probably part \ + of 'build'. Use the 'install' field or a .install file" let x = cond 40 `Warning diff --git a/test/passing/refs.default/exp_grouping.ml.ref b/test/passing/refs.default/exp_grouping.ml.ref index ae563059eb..c6b6b3aae5 100644 --- a/test/passing/refs.default/exp_grouping.ml.ref +++ b/test/passing/refs.default/exp_grouping.ml.ref @@ -217,8 +217,7 @@ let _ = |] let () = - if a then begin b - (* asd *) + if a then begin b (* asd *) end [@@@ocamlformat "if-then-else=compact"] @@ -238,8 +237,7 @@ let _ = end let () = - if a then begin b - (* asd *) + if a then begin b (* asd *) end [@@@ocamlformat "if-then-else=fit-or-vertical"] @@ -260,8 +258,7 @@ let _ = let () = if a then begin - b - (* asd *) + b (* asd *) end [@@@ocamlformat "if-then-else=keyword-first"] @@ -284,8 +281,7 @@ let _ = let () = if a - then begin - b (* asd *) + then begin b (* asd *) end [@@@ocamlformat "if-then-else=k-r"] @@ -402,8 +398,7 @@ let _ = let _ = match x with _ -> begin[@foo] y end let v = - map x begin fun x y z -> - y + map x begin fun x y z -> y end let v = @@ -417,8 +412,7 @@ let v = begin fun x arggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg - -> - y + -> y end let v = @@ -434,8 +428,7 @@ let v = argggggggggggggggggggggggggggggggggg gggggggggggggggggggg ggggggggggggggg - -> - y + -> y end let v = diff --git a/test/passing/refs.default/ite-compact.ml.ref b/test/passing/refs.default/ite-compact.ml.ref index aed2378aa2..f95b893202 100644 --- a/test/passing/refs.default/ite-compact.ml.ref +++ b/test/passing/refs.default/ite-compact.ml.ref @@ -178,7 +178,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.default/ite-compact_closing.ml.ref b/test/passing/refs.default/ite-compact_closing.ml.ref index 57bbc8f434..2adda729ac 100644 --- a/test/passing/refs.default/ite-compact_closing.ml.ref +++ b/test/passing/refs.default/ite-compact_closing.ml.ref @@ -193,7 +193,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.default/ite-fit_or_vertical.ml.ref b/test/passing/refs.default/ite-fit_or_vertical.ml.ref index 11469dac1f..f0eda5723f 100644 --- a/test/passing/refs.default/ite-fit_or_vertical.ml.ref +++ b/test/passing/refs.default/ite-fit_or_vertical.ml.ref @@ -213,7 +213,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else diff --git a/test/passing/refs.default/ite-fit_or_vertical_closing.ml.err b/test/passing/refs.default/ite-fit_or_vertical_closing.ml.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/passing/refs.default/ite-fit_or_vertical_closing.ml.ref b/test/passing/refs.default/ite-fit_or_vertical_closing.ml.ref index d9f3d09c36..3453a4bdf5 100644 --- a/test/passing/refs.default/ite-fit_or_vertical_closing.ml.ref +++ b/test/passing/refs.default/ite-fit_or_vertical_closing.ml.ref @@ -223,7 +223,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else () diff --git a/test/passing/refs.default/ite-fit_or_vertical_no_indicate.ml.ref b/test/passing/refs.default/ite-fit_or_vertical_no_indicate.ml.ref index 11469dac1f..f0eda5723f 100644 --- a/test/passing/refs.default/ite-fit_or_vertical_no_indicate.ml.ref +++ b/test/passing/refs.default/ite-fit_or_vertical_no_indicate.ml.ref @@ -213,7 +213,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else diff --git a/test/passing/refs.default/ite-kw_first.ml.ref b/test/passing/refs.default/ite-kw_first.ml.ref index 0091a64584..0fe682f78b 100644 --- a/test/passing/refs.default/ite-kw_first.ml.ref +++ b/test/passing/refs.default/ite-kw_first.ml.ref @@ -208,7 +208,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.default/ite-kw_first_closing.ml.ref b/test/passing/refs.default/ite-kw_first_closing.ml.ref index 2b44ee9c5b..7ec7740109 100644 --- a/test/passing/refs.default/ite-kw_first_closing.ml.ref +++ b/test/passing/refs.default/ite-kw_first_closing.ml.ref @@ -223,7 +223,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.default/ite-kw_first_no_indicate.ml.ref b/test/passing/refs.default/ite-kw_first_no_indicate.ml.ref index 0091a64584..0fe682f78b 100644 --- a/test/passing/refs.default/ite-kw_first_no_indicate.ml.ref +++ b/test/passing/refs.default/ite-kw_first_no_indicate.ml.ref @@ -208,7 +208,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.default/ite-no_indicate.ml.ref b/test/passing/refs.default/ite-no_indicate.ml.ref index aed2378aa2..f95b893202 100644 --- a/test/passing/refs.default/ite-no_indicate.ml.ref +++ b/test/passing/refs.default/ite-no_indicate.ml.ref @@ -178,7 +178,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.default/ite.ml.ref b/test/passing/refs.default/ite.ml.ref index aed2378aa2..f95b893202 100644 --- a/test/passing/refs.default/ite.ml.ref +++ b/test/passing/refs.default/ite.ml.ref @@ -178,7 +178,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.default/js_source.ml.err b/test/passing/refs.default/js_source.ml.err index e2a2cb4b3b..b330fe25be 100644 --- a/test/passing/refs.default/js_source.ml.err +++ b/test/passing/refs.default/js_source.ml.err @@ -1,5 +1,6 @@ Warning: js_source.ml:123 exceeds the margin Warning: js_source.ml:157 exceeds the margin +Warning: js_source.ml:210 exceeds the margin Warning: js_source.ml:224 exceeds the margin Warning: js_source.ml:229 exceeds the margin Warning: js_source.ml:240 exceeds the margin diff --git a/test/passing/refs.default/js_source.ml.ref b/test/passing/refs.default/js_source.ml.ref index c71b146064..58eb92a9b0 100644 --- a/test/passing/refs.default/js_source.ml.ref +++ b/test/passing/refs.default/js_source.ml.ref @@ -208,8 +208,8 @@ let nullsafe_optimistic_third_party_params_in_non_strict = provided our tooling and error reporting is friendly enough to be smoothly used by developers. *) ~default:true - "Nullsafe: in this mode we treat non annotated third party method params \ - as if they were annotated as nullable." + "Nullsafe: in this mode we treat non annotated third party method params as \ + if they were annotated as nullable." let foo () = if%bind diff --git a/test/passing/refs.default/labeled_tuples.ml.err b/test/passing/refs.default/labeled_tuples.ml.err index d3824613bd..7cb51c12af 100644 --- a/test/passing/refs.default/labeled_tuples.ml.err +++ b/test/passing/refs.default/labeled_tuples.ml.err @@ -1,3 +1,3 @@ Warning: labeled_tuples.ml:200 exceeds the margin +Warning: labeled_tuples.ml:572 exceeds the margin Warning: labeled_tuples.ml:573 exceeds the margin -Warning: labeled_tuples.ml:574 exceeds the margin diff --git a/test/passing/refs.default/labeled_tuples.ml.ref b/test/passing/refs.default/labeled_tuples.ml.ref index c795615300..3864cd7e6e 100644 --- a/test/passing/refs.default/labeled_tuples.ml.ref +++ b/test/passing/refs.default/labeled_tuples.ml.ref @@ -547,8 +547,7 @@ type t = z:(*after z label *) float (*end*) (** Comment tests *) -let - (*before*) +let (*before*) ( ~(x (*l-ty*) : diff --git a/test/passing/refs.default/list_normalized.ml.ref b/test/passing/refs.default/list_normalized.ml.ref index 194e1a0fb7..996178070b 100644 --- a/test/passing/refs.default/list_normalized.ml.ref +++ b/test/passing/refs.default/list_normalized.ml.ref @@ -27,8 +27,7 @@ let (x :: y :: ([] [@attr])) = e let [ x; (y [@attr]) ] = e let (*a*) (x (*b*) :: (*c*) y (*d*)) = e -let - (*a*) +let (*a*) [ x (*b*); (*c*) @@ -40,8 +39,7 @@ let let (*a*) (x (*b*) :: (*c*) y (*d*) :: (*e*) ([] [@attr])) (*f*) = e -let - (*a*) +let (*a*) [ x (*b*); (*c*) diff --git a/test/passing/refs.default/loc_stack.ml.err b/test/passing/refs.default/loc_stack.ml.err new file mode 100644 index 0000000000..9918a91411 --- /dev/null +++ b/test/passing/refs.default/loc_stack.ml.err @@ -0,0 +1 @@ +Warning: loc_stack.ml:26 exceeds the margin diff --git a/test/passing/refs.default/loc_stack.ml.ref b/test/passing/refs.default/loc_stack.ml.ref index f6959f70d6..3a806b718a 100644 --- a/test/passing/refs.default/loc_stack.ml.ref +++ b/test/passing/refs.default/loc_stack.ml.ref @@ -24,9 +24,8 @@ let should_inline : Llvm.llvalue -> bool = build contexts *) match Llvm.classify_value llv with | Instruction - ( Trunc | ZExt | SExt | FPToUI | FPToSI | UIToFP | SIToFP - | FPTrunc | FPExt | PtrToInt | IntToPtr | BitCast | AddrSpaceCast - ) -> + ( Trunc | ZExt | SExt | FPToUI | FPToSI | UIToFP | SIToFP | FPTrunc + | FPExt | PtrToInt | IntToPtr | BitCast | AddrSpaceCast ) -> true (* inline casts *) | _ -> false (* do not inline if >= 2 uses *)) | None -> true) diff --git a/test/passing/refs.janestreet/break_cases-align.ml.err b/test/passing/refs.janestreet/break_cases-align.ml.err index ee6bee49a7..5b72c7633f 100644 --- a/test/passing/refs.janestreet/break_cases-align.ml.err +++ b/test/passing/refs.janestreet/break_cases-align.ml.err @@ -1 +1 @@ -Warning: break_cases-align.ml:281 exceeds the margin +Warning: break_cases-align.ml:279 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases-align.ml.ref b/test/passing/refs.janestreet/break_cases-align.ml.ref index 5433745ce6..8eaf52e642 100644 --- a/test/passing/refs.janestreet/break_cases-align.ml.ref +++ b/test/passing/refs.janestreet/break_cases-align.ml.ref @@ -247,8 +247,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -265,8 +264,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_cases-all.ml.err b/test/passing/refs.janestreet/break_cases-all.ml.err index c67a7bb4da..dd03413c1d 100644 --- a/test/passing/refs.janestreet/break_cases-all.ml.err +++ b/test/passing/refs.janestreet/break_cases-all.ml.err @@ -1 +1 @@ -Warning: break_cases-all.ml:281 exceeds the margin +Warning: break_cases-all.ml:279 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases-all.ml.ref b/test/passing/refs.janestreet/break_cases-all.ml.ref index df9e5465d8..da01a2be36 100644 --- a/test/passing/refs.janestreet/break_cases-all.ml.ref +++ b/test/passing/refs.janestreet/break_cases-all.ml.ref @@ -247,8 +247,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -265,8 +264,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.err b/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.err index 0b60487d98..79a9a6c99f 100644 --- a/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.err +++ b/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.err @@ -1 +1 @@ -Warning: break_cases-closing_on_separate_line.ml:294 exceeds the margin +Warning: break_cases-closing_on_separate_line.ml:292 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.ref b/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.ref index 40f4944217..e910c6de07 100644 --- a/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.ref +++ b/test/passing/refs.janestreet/break_cases-closing_on_separate_line.ml.ref @@ -260,8 +260,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -278,8 +277,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err b/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err index d06a1b6431..efa84563dd 100644 --- a/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err +++ b/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err @@ -1 +1 @@ -Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:294 exceeds the margin +Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:292 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref b/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref index 40f4944217..e910c6de07 100644 --- a/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref +++ b/test/passing/refs.janestreet/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref @@ -260,8 +260,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -278,8 +277,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.err b/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.err index 7629771131..5b3dda4c40 100644 --- a/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.err +++ b/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.err @@ -1 +1 @@ -Warning: break_cases-cosl_lnmp_cmei.ml:294 exceeds the margin +Warning: break_cases-cosl_lnmp_cmei.ml:292 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.ref b/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.ref index 40f4944217..e910c6de07 100644 --- a/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.ref +++ b/test/passing/refs.janestreet/break_cases-cosl_lnmp_cmei.ml.ref @@ -260,8 +260,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -278,8 +277,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_cases-normal_indent.ml.err b/test/passing/refs.janestreet/break_cases-normal_indent.ml.err index f964740874..a54a434620 100644 --- a/test/passing/refs.janestreet/break_cases-normal_indent.ml.err +++ b/test/passing/refs.janestreet/break_cases-normal_indent.ml.err @@ -1 +1 @@ -Warning: break_cases-normal_indent.ml:281 exceeds the margin +Warning: break_cases-normal_indent.ml:279 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases-normal_indent.ml.ref b/test/passing/refs.janestreet/break_cases-normal_indent.ml.ref index df9e5465d8..da01a2be36 100644 --- a/test/passing/refs.janestreet/break_cases-normal_indent.ml.ref +++ b/test/passing/refs.janestreet/break_cases-normal_indent.ml.ref @@ -247,8 +247,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -265,8 +264,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_cases-toplevel.ml.err b/test/passing/refs.janestreet/break_cases-toplevel.ml.err index b8616d2d27..5a6331d5d5 100644 --- a/test/passing/refs.janestreet/break_cases-toplevel.ml.err +++ b/test/passing/refs.janestreet/break_cases-toplevel.ml.err @@ -1 +1 @@ -Warning: break_cases-toplevel.ml:245 exceeds the margin +Warning: break_cases-toplevel.ml:243 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases-toplevel.ml.ref b/test/passing/refs.janestreet/break_cases-toplevel.ml.ref index fbfcb69c5f..2870b1b8e8 100644 --- a/test/passing/refs.janestreet/break_cases-toplevel.ml.ref +++ b/test/passing/refs.janestreet/break_cases-toplevel.ml.ref @@ -211,8 +211,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -229,8 +228,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_cases.ml.err b/test/passing/refs.janestreet/break_cases.ml.err index 6cab4f07ae..6d7a26b1ff 100644 --- a/test/passing/refs.janestreet/break_cases.ml.err +++ b/test/passing/refs.janestreet/break_cases.ml.err @@ -1 +1 @@ -Warning: break_cases.ml:207 exceeds the margin +Warning: break_cases.ml:205 exceeds the margin diff --git a/test/passing/refs.janestreet/break_cases.ml.ref b/test/passing/refs.janestreet/break_cases.ml.ref index 1b281357f2..6d0838002d 100644 --- a/test/passing/refs.janestreet/break_cases.ml.ref +++ b/test/passing/refs.janestreet/break_cases.ml.ref @@ -173,8 +173,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () ;; @@ -191,8 +190,7 @@ let _ = let _ = match x with | { y = - ( Z - (* _____________________________________________________________________ *) + ( Z (* _____________________________________________________________________ *) | X _ | Y _ ) } -> () diff --git a/test/passing/refs.janestreet/break_string_literals.ml.err b/test/passing/refs.janestreet/break_string_literals.ml.err new file mode 100644 index 0000000000..08490db9de --- /dev/null +++ b/test/passing/refs.janestreet/break_string_literals.ml.err @@ -0,0 +1,3 @@ +Warning: break_string_literals.ml:57 exceeds the margin +Warning: break_string_literals.ml:67 exceeds the margin +Warning: break_string_literals.ml:90 exceeds the margin diff --git a/test/passing/refs.janestreet/break_string_literals.ml.ref b/test/passing/refs.janestreet/break_string_literals.ml.ref index 2bb8bf3a59..344580ea3b 100644 --- a/test/passing/refs.janestreet/break_string_literals.ml.ref +++ b/test/passing/refs.janestreet/break_string_literals.ml.ref @@ -55,9 +55,9 @@ let fooooooooooo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure \ - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla \ - pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia \ - deserunt mollit anim id est laborum." + dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \ + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ + mollit anim id est laborum." ;; let fooooooooooo = @@ -65,8 +65,8 @@ let fooooooooooo = incididunt ut labore et dolore magna aliqua.@;\ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex \ ea commodo consequat.@;\ - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu \ - fugiat nulla pariatur.@;\ + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat \ + nulla pariatur.@;\ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt \ mollit anim id est laborum." ;; @@ -88,8 +88,8 @@ let _ = let _ = Pp.textf - "Failed to parse environment variable: %s=%s Permitted values: if-exists always \ - never Default: %s" + "Failed to parse environment variable: %s=%s Permitted values: if-exists always never \ + Default: %s" var v (to_string default) diff --git a/test/passing/refs.janestreet/comments-no-wrap.ml.ref b/test/passing/refs.janestreet/comments-no-wrap.ml.ref index a7fe003ef9..af5286663f 100644 --- a/test/passing/refs.janestreet/comments-no-wrap.ml.ref +++ b/test/passing/refs.janestreet/comments-no-wrap.ml.ref @@ -469,9 +469,7 @@ type a = b (* a *) as (* b *) 'c (* c *) type t = { (* comment before mutable *) - mutable - (* really long comment that doesn't fit on the same line as other stuff *) - x : + mutable (* really long comment that doesn't fit on the same line as other stuff *) x : int } diff --git a/test/passing/refs.janestreet/comments.ml.ref b/test/passing/refs.janestreet/comments.ml.ref index a7fe003ef9..af5286663f 100644 --- a/test/passing/refs.janestreet/comments.ml.ref +++ b/test/passing/refs.janestreet/comments.ml.ref @@ -469,9 +469,7 @@ type a = b (* a *) as (* b *) 'c (* c *) type t = { (* comment before mutable *) - mutable - (* really long comment that doesn't fit on the same line as other stuff *) - x : + mutable (* really long comment that doesn't fit on the same line as other stuff *) x : int } diff --git a/test/passing/refs.janestreet/comments_in_record-break_separator-after.ml.ref b/test/passing/refs.janestreet/comments_in_record-break_separator-after.ml.ref index f19acbe818..e69430a1cd 100644 --- a/test/passing/refs.janestreet/comments_in_record-break_separator-after.ml.ref +++ b/test/passing/refs.janestreet/comments_in_record-break_separator-after.ml.ref @@ -107,8 +107,7 @@ type t = type t = { mutable ci_fixed : IntervalSet.t; - mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t } diff --git a/test/passing/refs.janestreet/comments_in_record-break_separator-before.ml.ref b/test/passing/refs.janestreet/comments_in_record-break_separator-before.ml.ref index 91044122b0..81b42f872c 100644 --- a/test/passing/refs.janestreet/comments_in_record-break_separator-before.ml.ref +++ b/test/passing/refs.janestreet/comments_in_record-break_separator-before.ml.ref @@ -107,8 +107,7 @@ type t = type t = { mutable ci_fixed : IntervalSet.t - ; mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + ; mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t } diff --git a/test/passing/refs.janestreet/comments_in_record.ml.ref b/test/passing/refs.janestreet/comments_in_record.ml.ref index 91044122b0..81b42f872c 100644 --- a/test/passing/refs.janestreet/comments_in_record.ml.ref +++ b/test/passing/refs.janestreet/comments_in_record.ml.ref @@ -107,8 +107,7 @@ type t = type t = { mutable ci_fixed : IntervalSet.t - ; mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + ; mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled : IntervalSet.t } diff --git a/test/passing/refs.janestreet/escaped_nl.ml.err b/test/passing/refs.janestreet/escaped_nl.ml.err new file mode 100644 index 0000000000..25258cd0e3 --- /dev/null +++ b/test/passing/refs.janestreet/escaped_nl.ml.err @@ -0,0 +1 @@ +Warning: escaped_nl.ml:9 exceeds the margin diff --git a/test/passing/refs.janestreet/escaped_nl.ml.ref b/test/passing/refs.janestreet/escaped_nl.ml.ref index 1dfdb8b6ad..48ff2927d5 100644 --- a/test/passing/refs.janestreet/escaped_nl.ml.ref +++ b/test/passing/refs.janestreet/escaped_nl.ml.ref @@ -7,8 +7,8 @@ let x = cond 40 `Warning - "Package uses flags that aren't recognised by earlier versions in OPAM 1.2 branch. \ - At the moment, you should use a tag \"flags:foo\" instead for compatibility" + "Package uses flags that aren't recognised by earlier versions in OPAM 1.2 branch. At \ + the moment, you should use a tag \"flags:foo\" instead for compatibility" ~detail:alpha_flags (alpha_flags <> []) ;; diff --git a/test/passing/refs.janestreet/exp_grouping.ml.ref b/test/passing/refs.janestreet/exp_grouping.ml.ref index b6df9636e7..924a4cf15c 100644 --- a/test/passing/refs.janestreet/exp_grouping.ml.ref +++ b/test/passing/refs.janestreet/exp_grouping.ml.ref @@ -259,8 +259,7 @@ let _ = let () = if a - then begin - b (* asd *) + then begin b (* asd *) end ;; @@ -282,8 +281,7 @@ let _ = ;; let () = - if a then begin b - (* asd *) + if a then begin b (* asd *) end ;; @@ -306,8 +304,7 @@ let _ = let () = if a then begin - b - (* asd *) + b (* asd *) end ;; @@ -332,8 +329,7 @@ let _ = let () = if a - then begin - b (* asd *) + then begin b (* asd *) end ;; @@ -471,20 +467,17 @@ let _ = ;; let v = - map x begin fun x y z -> - y + map x begin fun x y z -> y end ;; let v = - map x begin fun x arggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -> - y + map x begin fun x arggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -> y end ;; let v = - map x begin fun x arggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -> - y + map x begin fun x arggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg -> y end ;; @@ -499,8 +492,7 @@ let v = begin fun x argggggggggggggggggggggggggggggggggg gggggggggggggggggggg - ggggggggggggggg -> - y + ggggggggggggggg -> y end ;; diff --git a/test/passing/refs.ocamlformat/break_cases-align.ml.err b/test/passing/refs.ocamlformat/break_cases-align.ml.err index 3188e3010e..d0381b1d05 100644 --- a/test/passing/refs.ocamlformat/break_cases-align.ml.err +++ b/test/passing/refs.ocamlformat/break_cases-align.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases-align.ml:242 exceeds the margin -Warning: break_cases-align.ml:250 exceeds the margin -Warning: break_cases-align.ml:261 exceeds the margin +Warning: break_cases-align.ml:241 exceeds the margin +Warning: break_cases-align.ml:249 exceeds the margin +Warning: break_cases-align.ml:260 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases-align.ml.ref b/test/passing/refs.ocamlformat/break_cases-align.ml.ref index a326f76daa..f8c6b74b66 100644 --- a/test/passing/refs.ocamlformat/break_cases-align.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases-align.ml.ref @@ -232,8 +232,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_cases-all.ml.err b/test/passing/refs.ocamlformat/break_cases-all.ml.err index 776c4be40e..847d4b3265 100644 --- a/test/passing/refs.ocamlformat/break_cases-all.ml.err +++ b/test/passing/refs.ocamlformat/break_cases-all.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases-all.ml:242 exceeds the margin -Warning: break_cases-all.ml:250 exceeds the margin -Warning: break_cases-all.ml:261 exceeds the margin +Warning: break_cases-all.ml:241 exceeds the margin +Warning: break_cases-all.ml:249 exceeds the margin +Warning: break_cases-all.ml:260 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases-all.ml.ref b/test/passing/refs.ocamlformat/break_cases-all.ml.ref index bd662405f2..ee575c6a02 100644 --- a/test/passing/refs.ocamlformat/break_cases-all.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases-all.ml.ref @@ -232,8 +232,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.err b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.err index 1cfceabecb..90a845a549 100644 --- a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.err +++ b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases-closing_on_separate_line.ml:255 exceeds the margin -Warning: break_cases-closing_on_separate_line.ml:264 exceeds the margin -Warning: break_cases-closing_on_separate_line.ml:276 exceeds the margin +Warning: break_cases-closing_on_separate_line.ml:254 exceeds the margin +Warning: break_cases-closing_on_separate_line.ml:263 exceeds the margin +Warning: break_cases-closing_on_separate_line.ml:275 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.ref b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.ref index c75c22169b..513723fbe3 100644 --- a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line.ml.ref @@ -245,8 +245,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err index d3e663c46b..3cda691d4e 100644 --- a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err +++ b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:255 exceeds the margin -Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:264 exceeds the margin -Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:276 exceeds the margin +Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:254 exceeds the margin +Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:263 exceeds the margin +Warning: break_cases-closing_on_separate_line_leading_nested_match_parens.ml:275 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref index 98b623880a..2265abfd3e 100644 --- a/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases-closing_on_separate_line_leading_nested_match_parens.ml.ref @@ -245,8 +245,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.err b/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.err index 59bfee2f13..ee3b7cc5cf 100644 --- a/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.err +++ b/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases-cosl_lnmp_cmei.ml:255 exceeds the margin -Warning: break_cases-cosl_lnmp_cmei.ml:264 exceeds the margin -Warning: break_cases-cosl_lnmp_cmei.ml:276 exceeds the margin +Warning: break_cases-cosl_lnmp_cmei.ml:254 exceeds the margin +Warning: break_cases-cosl_lnmp_cmei.ml:263 exceeds the margin +Warning: break_cases-cosl_lnmp_cmei.ml:275 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.ref b/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.ref index e9cdaee2f5..c60d870f14 100644 --- a/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases-cosl_lnmp_cmei.ml.ref @@ -245,8 +245,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.err b/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.err index 880df9862c..17a834cbd1 100644 --- a/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.err +++ b/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases-normal_indent.ml:242 exceeds the margin -Warning: break_cases-normal_indent.ml:250 exceeds the margin -Warning: break_cases-normal_indent.ml:261 exceeds the margin +Warning: break_cases-normal_indent.ml:241 exceeds the margin +Warning: break_cases-normal_indent.ml:249 exceeds the margin +Warning: break_cases-normal_indent.ml:260 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.ref b/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.ref index eedd462e1e..618cfebd4f 100644 --- a/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases-normal_indent.ml.ref @@ -232,8 +232,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_cases-toplevel.ml.err b/test/passing/refs.ocamlformat/break_cases-toplevel.ml.err index ca43e81403..9df810126e 100644 --- a/test/passing/refs.ocamlformat/break_cases-toplevel.ml.err +++ b/test/passing/refs.ocamlformat/break_cases-toplevel.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases-toplevel.ml:206 exceeds the margin -Warning: break_cases-toplevel.ml:214 exceeds the margin -Warning: break_cases-toplevel.ml:225 exceeds the margin +Warning: break_cases-toplevel.ml:205 exceeds the margin +Warning: break_cases-toplevel.ml:213 exceeds the margin +Warning: break_cases-toplevel.ml:224 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases-toplevel.ml.ref b/test/passing/refs.ocamlformat/break_cases-toplevel.ml.ref index ffe2841dfb..515002d544 100644 --- a/test/passing/refs.ocamlformat/break_cases-toplevel.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases-toplevel.ml.ref @@ -196,8 +196,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_cases.ml.err b/test/passing/refs.ocamlformat/break_cases.ml.err index c958cfb1d1..2ab6458db7 100644 --- a/test/passing/refs.ocamlformat/break_cases.ml.err +++ b/test/passing/refs.ocamlformat/break_cases.ml.err @@ -1,3 +1,3 @@ -Warning: break_cases.ml:178 exceeds the margin -Warning: break_cases.ml:186 exceeds the margin -Warning: break_cases.ml:197 exceeds the margin +Warning: break_cases.ml:177 exceeds the margin +Warning: break_cases.ml:185 exceeds the margin +Warning: break_cases.ml:196 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_cases.ml.ref b/test/passing/refs.ocamlformat/break_cases.ml.ref index 46f419fd7a..e9b467ae79 100644 --- a/test/passing/refs.ocamlformat/break_cases.ml.ref +++ b/test/passing/refs.ocamlformat/break_cases.ml.ref @@ -168,8 +168,7 @@ let handler = let _ = match abc with | Fooooooooooooooooo (* comment *) - | Baaaaaaaaaaaaaaaar - (* comment *) + | Baaaaaaaaaaaaaaaar (* comment *) | Baaaaaaaaaaaaaaaaz (* comment *) -> () diff --git a/test/passing/refs.ocamlformat/break_string_literals.ml.err b/test/passing/refs.ocamlformat/break_string_literals.ml.err new file mode 100644 index 0000000000..02f0ea5169 --- /dev/null +++ b/test/passing/refs.ocamlformat/break_string_literals.ml.err @@ -0,0 +1,2 @@ +Warning: break_string_literals.ml:67 exceeds the margin +Warning: break_string_literals.ml:79 exceeds the margin diff --git a/test/passing/refs.ocamlformat/break_string_literals.ml.ref b/test/passing/refs.ocamlformat/break_string_literals.ml.ref index eddcdbe28d..ae319994c6 100644 --- a/test/passing/refs.ocamlformat/break_string_literals.ml.ref +++ b/test/passing/refs.ocamlformat/break_string_literals.ml.ref @@ -65,20 +65,20 @@ let fooo = Fooo "@\nFooooo: `%s`\n" let fooooooooooo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \ - commodo consequat. Duis aute irure dolor in reprehenderit in voluptate \ - velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat \ - cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id \ - est laborum." + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, \ + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse \ + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat \ + non proident, sunt in culpa qui officia deserunt mollit anim id est \ + laborum." let fooooooooooo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ tempor incididunt ut labore et dolore magna aliqua.@;\ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut \ aliquip ex ea commodo consequat.@;\ - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum \ - dolore eu fugiat nulla pariatur.@;\ + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore \ + eu fugiat nulla pariatur.@;\ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia \ deserunt mollit anim id est laborum." diff --git a/test/passing/refs.ocamlformat/comments_in_record-break_separator-after.ml.ref b/test/passing/refs.ocamlformat/comments_in_record-break_separator-after.ml.ref index 7fc1ec8561..cd0a8643de 100644 --- a/test/passing/refs.ocamlformat/comments_in_record-break_separator-after.ml.ref +++ b/test/passing/refs.ocamlformat/comments_in_record-break_separator-after.ml.ref @@ -87,8 +87,7 @@ type t = type t = { mutable ci_fixed: IntervalSet.t; - mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled: IntervalSet.t } diff --git a/test/passing/refs.ocamlformat/comments_in_record-break_separator-before.ml.ref b/test/passing/refs.ocamlformat/comments_in_record-break_separator-before.ml.ref index 4e1b5a4aa2..15f374d15d 100644 --- a/test/passing/refs.ocamlformat/comments_in_record-break_separator-before.ml.ref +++ b/test/passing/refs.ocamlformat/comments_in_record-break_separator-before.ml.ref @@ -87,8 +87,7 @@ type t = type t = { mutable ci_fixed: IntervalSet.t - ; mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + ; mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled: IntervalSet.t } diff --git a/test/passing/refs.ocamlformat/comments_in_record.ml.ref b/test/passing/refs.ocamlformat/comments_in_record.ml.ref index 4e1b5a4aa2..15f374d15d 100644 --- a/test/passing/refs.ocamlformat/comments_in_record.ml.ref +++ b/test/passing/refs.ocamlformat/comments_in_record.ml.ref @@ -87,8 +87,7 @@ type t = type t = { mutable ci_fixed: IntervalSet.t - ; mutable - (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) + ; mutable (* spilled stack slots (reg.loc = Stack (Local n)) still in use *) ci_spilled: IntervalSet.t } diff --git a/test/passing/refs.ocamlformat/escaped_nl.ml.err b/test/passing/refs.ocamlformat/escaped_nl.ml.err new file mode 100644 index 0000000000..2c67530849 --- /dev/null +++ b/test/passing/refs.ocamlformat/escaped_nl.ml.err @@ -0,0 +1 @@ +Warning: escaped_nl.ml:1 exceeds the margin diff --git a/test/passing/refs.ocamlformat/escaped_nl.ml.ref b/test/passing/refs.ocamlformat/escaped_nl.ml.ref index 15f86137c9..f3fc0dc13f 100644 --- a/test/passing/refs.ocamlformat/escaped_nl.ml.ref +++ b/test/passing/refs.ocamlformat/escaped_nl.ml.ref @@ -1,6 +1,6 @@ let s1 = - "No field 'install', but a field 'remove': install instructions probably \ - part of 'build'. Use the 'install' field or a .install file" + "No field 'install', but a field 'remove': install instructions probably part \ + of 'build'. Use the 'install' field or a .install file" let x = cond 40 `Warning diff --git a/test/passing/refs.ocamlformat/exp_grouping-parens.ml.err b/test/passing/refs.ocamlformat/exp_grouping-parens.ml.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/passing/refs.ocamlformat/exp_grouping-parens.ml.ref b/test/passing/refs.ocamlformat/exp_grouping-parens.ml.ref index 8f10b4c4b1..7ea4f30b27 100644 --- a/test/passing/refs.ocamlformat/exp_grouping-parens.ml.ref +++ b/test/passing/refs.ocamlformat/exp_grouping-parens.ml.ref @@ -383,8 +383,7 @@ let v = let v = map x (fun x y z -> ya f ; a f b) let v = - map x begin%ext1 fun%ext2 x y z -> - ya f ; a f b + map x begin%ext1 fun%ext2 x y z -> ya f ; a f b end let _ = diff --git a/test/passing/refs.ocamlformat/exp_grouping.ml.ref b/test/passing/refs.ocamlformat/exp_grouping.ml.ref index 81cc8f4caa..67809e5839 100644 --- a/test/passing/refs.ocamlformat/exp_grouping.ml.ref +++ b/test/passing/refs.ocamlformat/exp_grouping.ml.ref @@ -210,8 +210,7 @@ let _ = c ) |] let () = - if a then begin b - (* asd *) + if a then begin b (* asd *) end [@@@ocamlformat "if-then-else=compact"] @@ -221,8 +220,7 @@ let _ = foo.fooooo <- Fooo.foo fooo foo.fooooo ; Fooo fooo end - else if y then begin - f 0 ; f 2 + else if y then begin f 0 ; f 2 end else begin foo.fooooo <- Fooo.foo fooo foo.fooooo ; @@ -230,8 +228,7 @@ let _ = end let () = - if a then begin b - (* asd *) + if a then begin b (* asd *) end [@@@ocamlformat "if-then-else=fit-or-vertical"] @@ -251,8 +248,7 @@ let _ = let () = if a then begin - b - (* asd *) + b (* asd *) end [@@@ocamlformat "if-then-else=keyword-first"] @@ -264,8 +260,7 @@ let _ = Fooo fooo end else if y - then begin - f 0 ; f 2 + then begin f 0 ; f 2 end else begin foo.fooooo <- Fooo.foo fooo foo.fooooo ; @@ -274,8 +269,7 @@ let _ = let () = if a - then begin - b (* asd *) + then begin b (* asd *) end [@@@ocamlformat "if-then-else=k-r"] @@ -399,8 +393,7 @@ let _ = let _ = match x with _ -> begin[@foo] y end let v = - map x begin fun x y z -> - y + map x begin fun x y z -> y end let v = @@ -414,8 +407,7 @@ let v = begin fun x arggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg - -> - y + -> y end let v = @@ -430,8 +422,7 @@ let v = argggggggggggggggggggggggggggggggggg gggggggggggggggggggg ggggggggggggggg - -> - y + -> y end let v = @@ -440,13 +431,11 @@ let v = print y ; z ) let v = - map x begin fun x y z -> - ya f ; a f b + map x begin fun x y z -> ya f ; a f b end let v = - map x begin%ext1 fun%ext2 x y z -> - ya f ; a f b + map x begin%ext1 fun%ext2 x y z -> ya f ; a f b end let _ = diff --git a/test/passing/refs.ocamlformat/ite-compact.ml.ref b/test/passing/refs.ocamlformat/ite-compact.ml.ref index 6be99bd7ba..8672b0a164 100644 --- a/test/passing/refs.ocamlformat/ite-compact.ml.ref +++ b/test/passing/refs.ocamlformat/ite-compact.ml.ref @@ -177,7 +177,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ocamlformat/ite-compact_closing.ml.ref b/test/passing/refs.ocamlformat/ite-compact_closing.ml.ref index 1e09f4d91d..8c39e739e7 100644 --- a/test/passing/refs.ocamlformat/ite-compact_closing.ml.ref +++ b/test/passing/refs.ocamlformat/ite-compact_closing.ml.ref @@ -187,7 +187,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ocamlformat/ite-fit_or_vertical.ml.err b/test/passing/refs.ocamlformat/ite-fit_or_vertical.ml.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/passing/refs.ocamlformat/ite-fit_or_vertical.ml.ref b/test/passing/refs.ocamlformat/ite-fit_or_vertical.ml.ref index 1037714c9a..bc04c167a3 100644 --- a/test/passing/refs.ocamlformat/ite-fit_or_vertical.ml.ref +++ b/test/passing/refs.ocamlformat/ite-fit_or_vertical.ml.ref @@ -212,7 +212,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else diff --git a/test/passing/refs.ocamlformat/ite-fit_or_vertical_closing.ml.err b/test/passing/refs.ocamlformat/ite-fit_or_vertical_closing.ml.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/passing/refs.ocamlformat/ite-fit_or_vertical_closing.ml.ref b/test/passing/refs.ocamlformat/ite-fit_or_vertical_closing.ml.ref index 2f481d0229..461bf7172b 100644 --- a/test/passing/refs.ocamlformat/ite-fit_or_vertical_closing.ml.ref +++ b/test/passing/refs.ocamlformat/ite-fit_or_vertical_closing.ml.ref @@ -218,7 +218,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else () diff --git a/test/passing/refs.ocamlformat/ite-fit_or_vertical_no_indicate.ml.ref b/test/passing/refs.ocamlformat/ite-fit_or_vertical_no_indicate.ml.ref index a5cf3c4eb3..2555a13663 100644 --- a/test/passing/refs.ocamlformat/ite-fit_or_vertical_no_indicate.ml.ref +++ b/test/passing/refs.ocamlformat/ite-fit_or_vertical_no_indicate.ml.ref @@ -209,7 +209,7 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin + begin () end else diff --git a/test/passing/refs.ocamlformat/ite-kw_first.ml.ref b/test/passing/refs.ocamlformat/ite-kw_first.ml.ref index a16cfdfef2..2decd18409 100644 --- a/test/passing/refs.ocamlformat/ite-kw_first.ml.ref +++ b/test/passing/refs.ocamlformat/ite-kw_first.ml.ref @@ -206,7 +206,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ocamlformat/ite-kw_first_closing.ml.ref b/test/passing/refs.ocamlformat/ite-kw_first_closing.ml.ref index 16d20633e5..3612bc450e 100644 --- a/test/passing/refs.ocamlformat/ite-kw_first_closing.ml.ref +++ b/test/passing/refs.ocamlformat/ite-kw_first_closing.ml.ref @@ -216,7 +216,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ocamlformat/ite-kw_first_no_indicate.ml.ref b/test/passing/refs.ocamlformat/ite-kw_first_no_indicate.ml.ref index cd9913982c..d0f7dd9fb4 100644 --- a/test/passing/refs.ocamlformat/ite-kw_first_no_indicate.ml.ref +++ b/test/passing/refs.ocamlformat/ite-kw_first_no_indicate.ml.ref @@ -203,7 +203,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ocamlformat/ite-no_indicate.ml.ref b/test/passing/refs.ocamlformat/ite-no_indicate.ml.ref index 00fcfd7b1e..8dc27224d3 100644 --- a/test/passing/refs.ocamlformat/ite-no_indicate.ml.ref +++ b/test/passing/refs.ocamlformat/ite-no_indicate.ml.ref @@ -174,7 +174,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ocamlformat/ite.ml.ref b/test/passing/refs.ocamlformat/ite.ml.ref index 6be99bd7ba..8672b0a164 100644 --- a/test/passing/refs.ocamlformat/ite.ml.ref +++ b/test/passing/refs.ocamlformat/ite.ml.ref @@ -177,7 +177,6 @@ let _ = if x then 42 (* dummy *) else if y then z else w let () = if true then (* a *) - begin - () + begin () end else () diff --git a/test/passing/refs.ocamlformat/js_source.ml.err b/test/passing/refs.ocamlformat/js_source.ml.err index 96ee325fb2..096908a813 100644 --- a/test/passing/refs.ocamlformat/js_source.ml.err +++ b/test/passing/refs.ocamlformat/js_source.ml.err @@ -2,6 +2,7 @@ Warning: js_source.ml:122 exceeds the margin Warning: js_source.ml:138 exceeds the margin Warning: js_source.ml:147 exceeds the margin Warning: js_source.ml:154 exceeds the margin +Warning: js_source.ml:205 exceeds the margin Warning: js_source.ml:219 exceeds the margin Warning: js_source.ml:224 exceeds the margin Warning: js_source.ml:235 exceeds the margin diff --git a/test/passing/refs.ocamlformat/js_source.ml.ref b/test/passing/refs.ocamlformat/js_source.ml.ref index a99ee97996..1edff713cd 100644 --- a/test/passing/refs.ocamlformat/js_source.ml.ref +++ b/test/passing/refs.ocamlformat/js_source.ml.ref @@ -203,8 +203,8 @@ let nullsafe_optimistic_third_party_params_in_non_strict = provided our tooling and error reporting is friendly enough to be smoothly used by developers. *) ~default:true - "Nullsafe: in this mode we treat non annotated third party method params \ - as if they were annotated as nullable." + "Nullsafe: in this mode we treat non annotated third party method params as \ + if they were annotated as nullable." let foo () = if%bind diff --git a/test/passing/refs.ocamlformat/labeled_tuples.ml.err b/test/passing/refs.ocamlformat/labeled_tuples.ml.err index 269146df4e..43c724ed31 100644 --- a/test/passing/refs.ocamlformat/labeled_tuples.ml.err +++ b/test/passing/refs.ocamlformat/labeled_tuples.ml.err @@ -1,2 +1,2 @@ Warning: labeled_tuples.ml:223 exceeds the margin -Warning: labeled_tuples.ml:641 exceeds the margin +Warning: labeled_tuples.ml:640 exceeds the margin diff --git a/test/passing/refs.ocamlformat/labeled_tuples.ml.ref b/test/passing/refs.ocamlformat/labeled_tuples.ml.ref index b2b37d9701..6f3719b417 100644 --- a/test/passing/refs.ocamlformat/labeled_tuples.ml.ref +++ b/test/passing/refs.ocamlformat/labeled_tuples.ml.ref @@ -613,8 +613,7 @@ type t = * (* before the z label *) z:(*after z label *) float (*end*) -let - (*before*) +let (*before*) ( ~(x (*l-ty*) : diff --git a/test/passing/refs.ocamlformat/list_normalized.ml.ref b/test/passing/refs.ocamlformat/list_normalized.ml.ref index 1112bf3b6b..425ed133af 100644 --- a/test/passing/refs.ocamlformat/list_normalized.ml.ref +++ b/test/passing/refs.ocamlformat/list_normalized.ml.ref @@ -31,8 +31,7 @@ let [x; (y [@attr])] = e let (*a*) (x (*b*) :: (*c*) y (*d*)) = e -let - (*a*) +let (*a*) [ x (*b*) ; (*c*) y @@ -42,8 +41,7 @@ let let (*a*) (x (*b*) :: (*c*) y (*d*) :: (*e*) ([] [@attr])) (*f*) = e -let - (*a*) +let (*a*) [ x (*b*) ; (*c*) (y [@attr]) diff --git a/test/unit/test_translation_unit.ml b/test/unit/test_translation_unit.ml index 3bce4ea113..79c43020a6 100644 --- a/test/unit/test_translation_unit.ml +++ b/test/unit/test_translation_unit.ml @@ -109,8 +109,8 @@ File "", line 1, characters 0-3: \ name : string;\n\ \ version : string option;\n\ \ }\n\n\ - \ val create_serverInfo : name:string -> ?version:string -> \ - unit -> serverInfo\n\n\ + \ val create_serverInfo : name:string -> ?version:string -> unit \ + -> serverInfo\n\n\ \ type t = InitializeResult.t = {\n\ \ capabilities : ServerCapabilities.t;\n\ \ serverInfo : serverInfo option;\n\ diff --git a/vendor/ocaml-common/domain.ml b/vendor/ocaml-common/domain.ml new file mode 100644 index 0000000000..44b61b2e5d --- /dev/null +++ b/vendor/ocaml-common/domain.ml @@ -0,0 +1,12 @@ +(* Unsafe replacement for some [Domain] functions needed to implement + [Format_]. Remove this module if OCamlformat ever uses parallelism. *) + +module DLS = struct + type 'a key = 'a ref + let new_key f = ref (f ()) + let get k = !k + let set k v = k := v +end + +let at_exit = at_exit +let before_first_spawn f = f () diff --git a/vendor/ocamlformat_support/format_.ml b/vendor/ocamlformat_support/format_.ml index 11834b3b0f..77d47e5509 100644 --- a/vendor/ocamlformat_support/format_.ml +++ b/vendor/ocamlformat_support/format_.ml @@ -592,21 +592,12 @@ let set_size state ~break_hint = () (* scan_push is only used for breaks and boxes. *) -(* -This changes the behavior of OCamlformat. -It was introduced in https://github.com/ocaml/ocaml/pull/13853 -Called from [scan_push]. - (* Enter a break hint in the pretty-printer queue, taking care of increasing the rightward position *after* we update the pending break *) let pp_enqueue_break state token = Queue.add token state.pp_queue; set_size state ~break_hint:true; state.pp_right_total <- state.pp_right_total + token.length -*) -let pp_enqueue_break state token = - pp_enqueue state token; - set_size state ~break_hint:true (* Push a token on pretty-printer scanning stack. If b is true set_size is called. *)