diff --git a/CHANGES.md b/CHANGES.md index 3a6ffd9f57..9991716aa6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,7 @@ profile. This started with version 0.26.0. - \* Reduce the indentation of (polytype) type constraints (#2437, @gpetiot) - \* Consistent indentation of polymorphic variant arguments (#2427, @Julow) - \* Don't align breaking module arguments (#2505, @Julow) +- Improvements to ocp-indent-compat and the Janestreet profile (#2314, @Julow) ### Fixed diff --git a/lib/Conf.ml b/lib/Conf.ml index e08101e39c..8f4f37bfa7 100644 --- a/lib/Conf.ml +++ b/lib/Conf.ml @@ -227,7 +227,7 @@ let janestreet_profile from = ; margin= elt 90 ; match_indent= elt 0 ; match_indent_nested= elt `Never - ; max_indent= elt @@ Some 2 + ; max_indent= elt None ; module_item_spacing= elt `Compact ; nested_match= elt `Wrap ; ocp_indent_compat= elt true diff --git a/lib/Fmt_ast.ml b/lib/Fmt_ast.ml index e0d6326c5f..417e46959d 100644 --- a/lib/Fmt_ast.ml +++ b/lib/Fmt_ast.ml @@ -578,11 +578,21 @@ let rec fmt_extension_aux c ctx ~key (ext, pld) = when Source.extension_using_sugar ~name:ext ~payload:ppat_loc -> fmt_pattern c ~ext (sub_pat ~ctx pat) | _ -> - wrap "[" "]" - ( str (Ext.Key.to_string key) - $ fmt_str_loc c ext - $ fmt_payload c (Pld pld) pld - $ fmt_if (Exposed.Right.payload pld) " " ) + let box = + if c.conf.fmt_opts.ocp_indent_compat.v then + match pld with + | PStr [{pstr_desc= Pstr_eval _; _}] | PTyp _ | PPat _ -> + hvbox c.conf.fmt_opts.extension_indent.v + | PSig _ | PStr _ -> + hvbox c.conf.fmt_opts.stritem_extension_indent.v + else Fn.id + in + box + (wrap "[" "]" + ( str (Ext.Key.to_string key) + $ fmt_str_loc c ext + $ fmt_payload c (Pld pld) pld + $ fmt_if (Exposed.Right.payload pld) " " ) ) and fmt_extension = fmt_extension_aux ~key:Ext.Key.Regular @@ -622,11 +632,7 @@ and fmt_attribute c ~key {attr_name; attr_payload; attr_loc} = and fmt_attributes_aux c ?pre ?suf ~key attrs = let num = List.length attrs in fmt_if_k (num > 0) - ( opt pre (function - (* Breaking before an attribute can confuse ocp-indent that will - produce a suboptimal indentation. *) - | Space when c.conf.fmt_opts.ocp_indent_compat.v -> sp Blank - | pre -> sp pre ) + ( opt pre sp $ hvbox_if (num > 1) 0 (hvbox 0 (list attrs "@ " (fmt_attribute c ~key)) $ opt suf str) ) @@ -979,7 +985,7 @@ and fmt_row_field c ctx {prf_desc; prf_attributes; prf_loc} = | Rinherit typ -> fmt_core_type c (sub_typ ~ctx typ) in hvbox 0 - ( hvbox 0 (Cmts.fmt c prf_loc row) + ( hvbox (Params.Indent.variant_type_arg c.conf) (Cmts.fmt c prf_loc row) $ fmt_attributes_and_docstrings c prf_attributes ) and fmt_pattern_attributes c xpat k = @@ -1060,7 +1066,8 @@ and fmt_pattern ?ext c ?pro ?parens ?(box = false) Cmts.fmt c ppat_loc (hvbox 0 (fmt_pat_cons c ~parens (List.map lp ~f:(sub_pat ~ctx)))) | Ppat_construct (lid, Some (exists, pat)) -> - cbox 0 + cbox + (Params.Indent.variant c.conf ~parens) (Params.parens_if parens c.conf (hvbox 2 ( fmt_longident_loc c lid $ fmt "@ " @@ -1074,7 +1081,8 @@ and fmt_pattern ?ext c ?pro ?parens ?(box = false) $ fmt_pattern c (sub_pat ~ctx pat) ) ) ) | Ppat_variant (lbl, None) -> variant_var c lbl | Ppat_variant (lbl, Some pat) -> - cbox 0 + cbox + (Params.Indent.variant c.conf ~parens) (Params.parens_if parens c.conf (hvbox 2 ( variant_var c lbl $ fmt "@ " @@ -2182,7 +2190,8 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens | Pexp_variant (s, arg) -> pro $ Params.parens_if parens c.conf - (hvbox 2 + (hvbox + (Params.Indent.variant c.conf ~parens) ( variant_var c s $ opt arg (fmt "@ " >$ (sub_exp ~ctx >> fmt_expression c)) $ fmt_atrs ) ) @@ -2280,7 +2289,7 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens fmt_extension_suffix c ext ) ) ~fmt_attributes: (fmt_attributes c ~pre:Blank pexp_attributes) - ~fmt_cond:(fmt_expression c) + ~fmt_cond:(fmt_expression ~box:false c) in parens_prev_bch := parens_bch ; p.box_branch @@ -2461,8 +2470,8 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens | Pexp_pack (me, pt) -> let outer_pro = pro in let outer_parens = parens && has_attr in - let inner_parens = true in let blk = fmt_module_expr c (sub_mod ~ctx me) in + let align = Params.Align.module_pack c.conf ~me in let opn_paren = match c.conf.fmt_opts.indicate_multiline_delimiters.v with | `No | `Closing_on_separate_line -> str "(" @@ -2475,11 +2484,11 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens fits_breaks ~level "(" "( " and cls_paren = closing_paren c ~offset:(-2) in let pro = - fmt_if_k inner_parens opn_paren + fmt_if_k (not align) opn_paren $ str "module" $ fmt_extension_suffix c ext $ char ' ' - and epi = fmt_if_k inner_parens cls_paren in + and epi = cls_paren in let fmt_mod m = match pt with | Some (id, cnstrs) -> @@ -2491,7 +2500,9 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens outer_pro $ hvbox 0 (Params.parens_if outer_parens c.conf - (compose_module ~pro ~epi blk ~f:fmt_mod $ fmt_atrs) ) + ( fmt_if_k align opn_paren + $ compose_module ~pro ~epi blk ~f:fmt_mod + $ fmt_atrs ) ) | Pexp_record (flds, default) -> let fmt_field (lid, tc, exp) = let typ1, typ2 = @@ -3076,8 +3087,10 @@ and fmt_class_field c {ast= cf; _} = hvbox 2 ( hovbox 2 ( hovbox 4 - (box_fun_decl_args c 4 - ( box_fun_sig_args c 4 + (box_fun_decl_args c + (Params.Indent.fun_args c.conf) + ( box_fun_sig_args c + (Params.Indent.fun_type_annot c.conf) ( str "method" $ virtual_or_override kind $ fmt_private_virtual_flag c pv $ str " " $ fmt_str_loc c name $ typ ) @@ -4450,6 +4463,21 @@ and fmt_value_binding c ~rec_flag ?ext ?in_ ?epi , Cmts.Toplevel.fmt_before c lb_loc , Cmts.Toplevel.fmt_after c lb_loc ) in + let decl_args = + let decl = + fmt_str_loc c lb_op + $ fmt_extension_suffix c ext + $ fmt_attributes c at_attrs $ fmt_if rec_flag " rec" + $ fmt_or pat_has_cmt "@ " " " + and pattern = fmt_pattern c lb_pat + and args = + fmt_if_k + (not (List.is_empty lb_args)) + (fmt "@ " $ wrap_fun_decl_args c (fmt_fun_args c lb_args)) + $ fmt_newtypes + in + box_fun_decl_args c 4 (Params.Align.fun_decl c.conf ~decl ~pattern ~args) + in fmt_docstring c ~epi:(fmt "@\n") doc1 $ cmts_before $ hvbox 0 @@ -4457,22 +4485,9 @@ and fmt_value_binding c ~rec_flag ?ext ?in_ ?epi ( hvbox_if toplevel 0 ( hvbox_if toplevel indent ( hovbox 2 - ( hovbox 4 - ( box_fun_decl_args c 4 - ( hovbox 4 - ( fmt_str_loc c lb_op - $ fmt_extension_suffix c ext - $ fmt_attributes c at_attrs - $ fmt_if rec_flag " rec" - $ fmt_or pat_has_cmt "@ " " " - $ fmt_pattern c lb_pat ) - $ fmt_if_k - (not (List.is_empty lb_args)) - ( fmt "@ " - $ wrap_fun_decl_args c - (fmt_fun_args c lb_args) ) - $ fmt_newtypes ) - $ fmt_cstr ) + ( hovbox + (Params.Indent.fun_type_annot c.conf) + (decl_args $ fmt_cstr) $ fmt_if_k (not lb_pun) (fmt_or_k c.conf.fmt_opts.ocp_indent_compat.v (fits_breaks " =" ~hint:(1000, 0) "=") diff --git a/lib/Params.ml b/lib/Params.ml index d20fcff66b..256516f272 100644 --- a/lib/Params.ml +++ b/lib/Params.ml @@ -629,14 +629,6 @@ let comma_sep (c : Conf.t) : Fmt.s = | `After -> ",@;<1 2>" module Align = struct - (** Whether [exp] occurs in [args] as a labelled argument. *) - let is_labelled_arg args exp = - List.exists - ~f:(function - | Nolabel, _ -> false - | Labelled _, x | Optional _, x -> phys_equal x exp ) - args - let general (c : Conf.t) t = hvbox_if (not c.fmt_opts.align_symbol_open_paren.v) 0 t @@ -665,6 +657,19 @@ module Align = struct | _ -> parens && not c.fmt_opts.align_symbol_open_paren.v in hvbox_if align 0 t + + let fun_decl (c : Conf.t) ~decl ~pattern ~args = + if c.fmt_opts.ocp_indent_compat.v then + hovbox 4 (decl $ hvbox 2 (pattern $ args)) + else hovbox 4 (decl $ pattern) $ args + + let module_pack (c : Conf.t) ~me = + if not c.fmt_opts.ocp_indent_compat.v then false + else + (* Align when the constraint is not desugared. *) + match me.pmod_desc with + | Pmod_structure _ | Pmod_ident _ -> false + | _ -> true end module Indent = struct @@ -715,7 +720,7 @@ module Indent = struct let record_docstring (c : Conf.t) = if ocp c then - match c.fmt_opts.break_separators.v with `Before -> -2 | `After -> 0 + match c.fmt_opts.break_separators.v with `Before -> 0 | `After -> 2 else 4 let constructor_docstring c = if ocp c then 0 else 4 @@ -733,4 +738,8 @@ module Indent = struct let mty_with c = if ocp c then 0 else 2 let type_constr c = if ocp c then 2 else 0 + + let variant c ~parens = if ocp c && parens then 3 else 2 + + let variant_type_arg c = if ocp c then 2 else 0 end diff --git a/lib/Params.mli b/lib/Params.mli index 0cfb14b08c..a057247520 100644 --- a/lib/Params.mli +++ b/lib/Params.mli @@ -177,6 +177,11 @@ module Align : sig val function_ : Conf.t -> parens:bool -> ctx0:Ast.t -> self:expression -> Fmt.t -> Fmt.t + + val fun_decl : Conf.t -> decl:Fmt.t -> pattern:Fmt.t -> args:Fmt.t -> Fmt.t + + val module_pack : Conf.t -> me:module_expr -> bool + (** Not implemented as a wrapper to work with the blk system. *) end module Indent : sig @@ -227,4 +232,8 @@ module Indent : sig (** Types *) val type_constr : Conf.t -> int + + val variant : Conf.t -> parens:bool -> int + + val variant_type_arg : Conf.t -> int end diff --git a/test/cli/multiple_projects.t b/test/cli/multiple_projects.t index 4cd1f41452..58937c4040 100644 --- a/test/cli/multiple_projects.t +++ b/test/cli/multiple_projects.t @@ -14,12 +14,12 @@ Second project formatted with the 'ocamlformat' profile: $ cat project1/main.ml let _machin - ?aaaaaaaaaa:_ - ?bbbbbbbbbbb:_ - ?cccccccccccc:_ - ?ddddddddddddd:_ - ?eeeeeeeeeeee:_ - () + ?aaaaaaaaaa:_ + ?bbbbbbbbbbb:_ + ?cccccccccccc:_ + ?ddddddddddddd:_ + ?eeeeeeeeeeee:_ + () = () ;; diff --git a/test/passing/tests/break_separators-after.ml.ref b/test/passing/tests/break_separators-after.ml.ref index a3d77ee546..7f99bd19b8 100644 --- a/test/passing/tests/break_separators-after.ml.ref +++ b/test/passing/tests/break_separators-after.ml.ref @@ -263,11 +263,11 @@ let x {aaaaaaaaaaaaaa; aaaaaaaaaaaaa; aaaaaaaaaa} = {aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa; bbbbbbbbbbbbb= bbb bb bbbbbb} let x - { aaaaaaaaaaaaaaaaaaaaaa; - aaaaaaaaaaaaaaaaaaa; - aaaaaaaaaaaaaa; - aaaaaaaaaaaaaaaaaa; - aaaaaaaaaa } + { aaaaaaaaaaaaaaaaaaaaaa; + aaaaaaaaaaaaaaaaaaa; + aaaaaaaaaaaaaa; + aaaaaaaaaaaaaaaaaa; + aaaaaaaaaa } = { aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa; bbbbbbbbbbbbb= bbb bb bbbbbb; @@ -370,7 +370,12 @@ let g () = hhhhhhhhhh |] -> fooooooooo -let () = match x with _, (* line 1 line 2 *) Some _ -> x +let () = + match x with + | ( _, + (* line 1 line 2 *) + Some _ ) -> + x let () = match x with diff --git a/test/passing/tests/break_separators-after_docked.ml.ref b/test/passing/tests/break_separators-after_docked.ml.ref index 325930a4f4..fe984aadea 100644 --- a/test/passing/tests/break_separators-after_docked.ml.ref +++ b/test/passing/tests/break_separators-after_docked.ml.ref @@ -289,13 +289,13 @@ let x {aaaaaaaaaaaaaa; aaaaaaaaaaaaa; aaaaaaaaaa} = {aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa; bbbbbbbbbbbbb= bbb bb bbbbbb} let x - { - aaaaaaaaaaaaaaaaaaaaaa; - aaaaaaaaaaaaaaaaaaa; - aaaaaaaaaaaaaa; - aaaaaaaaaaaaaaaaaa; - aaaaaaaaaa; - } + { + aaaaaaaaaaaaaaaaaaaaaa; + aaaaaaaaaaaaaaaaaaa; + aaaaaaaaaaaaaa; + aaaaaaaaaaaaaaaaaa; + aaaaaaaaaa; + } = { aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa; @@ -419,7 +419,12 @@ let g () = |] -> fooooooooo -let () = match x with _, (* line 1 line 2 *) Some _ -> x +let () = + match x with + | ( _, + (* line 1 line 2 *) + Some _ ) -> + x let () = match x with diff --git a/test/passing/tests/break_separators-before_docked.ml.ref b/test/passing/tests/break_separators-before_docked.ml.ref index 63a5e062e7..6959fdcba3 100644 --- a/test/passing/tests/break_separators-before_docked.ml.ref +++ b/test/passing/tests/break_separators-before_docked.ml.ref @@ -289,13 +289,13 @@ let x {aaaaaaaaaaaaaa; aaaaaaaaaaaaa; aaaaaaaaaa} = {aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa; bbbbbbbbbbbbb= bbb bb bbbbbb} let x - { - aaaaaaaaaaaaaaaaaaaaaa - ; aaaaaaaaaaaaaaaaaaa - ; aaaaaaaaaaaaaa - ; aaaaaaaaaaaaaaaaaa - ; aaaaaaaaaa - } + { + aaaaaaaaaaaaaaaaaaaaaa + ; aaaaaaaaaaaaaaaaaaa + ; aaaaaaaaaaaaaa + ; aaaaaaaaaaaaaaaaaa + ; aaaaaaaaaa + } = { aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa @@ -419,7 +419,12 @@ let g () = |] -> fooooooooo -let () = match x with _, (* line 1 line 2 *) Some _ -> x +let () = + match x with + | ( _ + , (* line 1 line 2 *) + Some _ ) -> + x let () = match x with diff --git a/test/passing/tests/break_separators.ml b/test/passing/tests/break_separators.ml index 5d5af4f814..0e248429d0 100644 --- a/test/passing/tests/break_separators.ml +++ b/test/passing/tests/break_separators.ml @@ -263,11 +263,11 @@ let x {aaaaaaaaaaaaaa; aaaaaaaaaaaaa; aaaaaaaaaa} = {aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa; bbbbbbbbbbbbb= bbb bb bbbbbb} let x - { aaaaaaaaaaaaaaaaaaaaaa - ; aaaaaaaaaaaaaaaaaaa - ; aaaaaaaaaaaaaa - ; aaaaaaaaaaaaaaaaaa - ; aaaaaaaaaa } + { aaaaaaaaaaaaaaaaaaaaaa + ; aaaaaaaaaaaaaaaaaaa + ; aaaaaaaaaaaaaa + ; aaaaaaaaaaaaaaaaaa + ; aaaaaaaaaa } = { aaaaaaaaaaaa= aaaaaaaaaaaaaaaaa ; bbbbbbbbbbbbb= bbb bb bbbbbb @@ -370,7 +370,12 @@ let g () = ; hhhhhhhhhh |] -> fooooooooo -let () = match x with _, (* line 1 line 2 *) Some _ -> x +let () = + match x with + | ( _ + , (* line 1 line 2 *) + Some _ ) -> + x let () = match x with diff --git a/test/passing/tests/extensions-indent.mli.ref b/test/passing/tests/extensions-indent.mli.ref index 48d033c7c5..558f398b99 100644 --- a/test/passing/tests/extensions-indent.mli.ref +++ b/test/passing/tests/extensions-indent.mli.ref @@ -10,6 +10,11 @@ type t = foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooo foooooooooooooooooooooooooooo] +[%%foooooooooo + fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo + foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooo + foooooooooooooooooooooooooooo] + [%%foooooooooo: fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo diff --git a/test/passing/tests/extensions.mli b/test/passing/tests/extensions.mli index de0865db65..cb2956ae2e 100644 --- a/test/passing/tests/extensions.mli +++ b/test/passing/tests/extensions.mli @@ -10,6 +10,11 @@ type t = foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooo foooooooooooooooooooooooooooo] +[%%foooooooooo +fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo + foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooo + foooooooooooooooooooooooooooo] + [%%foooooooooo: fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo diff --git a/test/passing/tests/functor.ml b/test/passing/tests/functor.ml index 941d3cdd9d..8af0190553 100644 --- a/test/passing/tests/functor.ml +++ b/test/passing/tests/functor.ml @@ -70,7 +70,8 @@ module type KV_MAKER = functor (G : Irmin_git.G) (C : Irmin.Contents.S) -> module Make (TT : TableFormat.TABLES) - (IT : InspectionTableFormat.TABLES with type 'a lr1state = int) + (IT : + InspectionTableFormat.TABLES__________________________________________) (ET : EngineTypes.TABLE with type terminal = int @@ -83,6 +84,14 @@ struct type t = t end +module Make + (TT : TableFormat.TABLES) + (IT : + InspectionTableFormat.TABLES__________________________________________) = +struct + type t = t +end + (* Long syntax should be preserved *) module M = functor (_ : S) -> struct end diff --git a/test/passing/tests/functor.ml.err b/test/passing/tests/functor.ml.err new file mode 100644 index 0000000000..236d04d3f0 --- /dev/null +++ b/test/passing/tests/functor.ml.err @@ -0,0 +1 @@ +Warning: tests/functor.ml:89 exceeds the margin diff --git a/test/passing/tests/ite-compact.ml.ref b/test/passing/tests/ite-compact.ml.ref index a94a182514..38d75617b6 100644 --- a/test/passing/tests/ite-compact.ml.ref +++ b/test/passing/tests/ite-compact.ml.ref @@ -140,6 +140,13 @@ let _ = else fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-compact_closing.ml.ref b/test/passing/tests/ite-compact_closing.ml.ref index ac36e15e6b..ba050bfa68 100644 --- a/test/passing/tests/ite-compact_closing.ml.ref +++ b/test/passing/tests/ite-compact_closing.ml.ref @@ -155,6 +155,13 @@ let _ = else fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-fit_or_vertical.ml.ref b/test/passing/tests/ite-fit_or_vertical.ml.ref index 94232e3acb..eee4a817df 100644 --- a/test/passing/tests/ite-fit_or_vertical.ml.ref +++ b/test/passing/tests/ite-fit_or_vertical.ml.ref @@ -169,6 +169,15 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then + foooooooooooooooooooooooooooooooooooooooooo + else + foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-fit_or_vertical_closing.ml.ref b/test/passing/tests/ite-fit_or_vertical_closing.ml.ref index 10c038c088..6bfc9ec2ce 100644 --- a/test/passing/tests/ite-fit_or_vertical_closing.ml.ref +++ b/test/passing/tests/ite-fit_or_vertical_closing.ml.ref @@ -181,6 +181,15 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then + foooooooooooooooooooooooooooooooooooooooooo + else + foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-fit_or_vertical_no_indicate.ml.ref b/test/passing/tests/ite-fit_or_vertical_no_indicate.ml.ref index 116a182dd1..411368d842 100644 --- a/test/passing/tests/ite-fit_or_vertical_no_indicate.ml.ref +++ b/test/passing/tests/ite-fit_or_vertical_no_indicate.ml.ref @@ -169,6 +169,15 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then + foooooooooooooooooooooooooooooooooooooooooo + else + foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-kr.ml.ref b/test/passing/tests/ite-kr.ml.ref index 91a8ef6169..28d2dbb092 100644 --- a/test/passing/tests/ite-kr.ml.ref +++ b/test/passing/tests/ite-kr.ml.ref @@ -204,6 +204,15 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then + foooooooooooooooooooooooooooooooooooooooooo + else + foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-kr_closing.ml.ref b/test/passing/tests/ite-kr_closing.ml.ref index a06dc4919c..8fc41701c5 100644 --- a/test/passing/tests/ite-kr_closing.ml.ref +++ b/test/passing/tests/ite-kr_closing.ml.ref @@ -214,6 +214,15 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then + foooooooooooooooooooooooooooooooooooooooooo + else + foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-kw_first.ml.ref b/test/passing/tests/ite-kw_first.ml.ref index e1a2cc0640..a95a92faad 100644 --- a/test/passing/tests/ite-kw_first.ml.ref +++ b/test/passing/tests/ite-kw_first.ml.ref @@ -164,6 +164,13 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-kw_first_closing.ml.ref b/test/passing/tests/ite-kw_first_closing.ml.ref index 53f5faa855..e2316835df 100644 --- a/test/passing/tests/ite-kw_first_closing.ml.ref +++ b/test/passing/tests/ite-kw_first_closing.ml.ref @@ -179,6 +179,13 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-kw_first_no_indicate.ml.ref b/test/passing/tests/ite-kw_first_no_indicate.ml.ref index 9afc0df724..35c906e623 100644 --- a/test/passing/tests/ite-kw_first_no_indicate.ml.ref +++ b/test/passing/tests/ite-kw_first_no_indicate.ml.ref @@ -163,6 +163,13 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-no_indicate.ml.ref b/test/passing/tests/ite-no_indicate.ml.ref index 329f156775..78627d847b 100644 --- a/test/passing/tests/ite-no_indicate.ml.ref +++ b/test/passing/tests/ite-no_indicate.ml.ref @@ -139,6 +139,13 @@ let _ = else fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite-vertical.ml.ref b/test/passing/tests/ite-vertical.ml.ref index 28b9323123..62def39502 100644 --- a/test/passing/tests/ite-vertical.ml.ref +++ b/test/passing/tests/ite-vertical.ml.ref @@ -200,6 +200,15 @@ let _ = fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then + foooooooooooooooooooooooooooooooooooooooooo + else + foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/ite.ml b/test/passing/tests/ite.ml index 6f4c3aa98f..efc0ec53a8 100644 --- a/test/passing/tests/ite.ml +++ b/test/passing/tests/ite.ml @@ -140,6 +140,13 @@ let _ = (fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz) +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) foo then 0 diff --git a/test/passing/tests/ite.ml.ref b/test/passing/tests/ite.ml.ref index a94a182514..38d75617b6 100644 --- a/test/passing/tests/ite.ml.ref +++ b/test/passing/tests/ite.ml.ref @@ -140,6 +140,13 @@ let _ = else fun xxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz -> xxxxxxxxx yyyyyyyyyy zzzzzzzzzzzz +let _ = + if + (* foooooooooooooooooooooooooooooooooooooooooo *) + foooooooooooooooooooooooooooooooooooooooooo + then foooooooooooooooooooooooooooooooooooooooooo + else foooooooooooooooooooooooooooooooooooooooooo + let _ = if (* foo *) diff --git a/test/passing/tests/js_source.ml b/test/passing/tests/js_source.ml index 4b4e6504dc..7f974300f9 100644 --- a/test/passing/tests/js_source.ml +++ b/test/passing/tests/js_source.ml @@ -7864,12 +7864,6 @@ let _ = (name, Format.sprintf "expecting %S but got %S" Version.version value)) ;; -let _ = - Error - (Foooooooooooooooooo - (name, Format.sprintf "expecting %S but got %S" Version.version value)) -;; - let _ = `Foooooooooooooooooo (name, Format.sprintf "expecting %S but got %S" Version.version value) @@ -7880,11 +7874,6 @@ let _ = (name, Format.sprintf "expecting %S but got %S" Version.version value) ;; -let _ = - Foooooooooooooooooo - (name, Format.sprintf "expecting %S but got %S" Version.version value) -;; - let (`Foooooooooooooooooo (foooooooooooooo, foooooooooooooo, foooooooooooooo, foooooooooooooo) ) = @@ -8034,6 +8023,19 @@ type t = v}*) +(*$ + {| + f|} +*) + +type t = + { xxxxxxxxxxxxxxxxxxx : yyy + [@zzzzzzzzzzzzzzzzzzz + (* ________________________________ + ___ *) + _______] + } + let _ = match () with (*$ diff --git a/test/passing/tests/js_source.ml.err b/test/passing/tests/js_source.ml.err index 131216f22f..d619c7b087 100644 --- a/test/passing/tests/js_source.ml.err +++ b/test/passing/tests/js_source.ml.err @@ -1,6 +1,6 @@ -Warning: tests/js_source.ml:156 exceeds the margin -Warning: tests/js_source.ml:9539 exceeds the margin -Warning: tests/js_source.ml:9643 exceeds the margin -Warning: tests/js_source.ml:9702 exceeds the margin -Warning: tests/js_source.ml:9784 exceeds the margin -Warning: tests/js_source.ml:10293 exceeds the margin +Warning: tests/js_source.ml:162 exceeds the margin +Warning: tests/js_source.ml:9546 exceeds the margin +Warning: tests/js_source.ml:9650 exceeds the margin +Warning: tests/js_source.ml:9709 exceeds the margin +Warning: tests/js_source.ml:9791 exceeds the margin +Warning: tests/js_source.ml:10290 exceeds the margin diff --git a/test/passing/tests/js_source.ml.ocp b/test/passing/tests/js_source.ml.ocp index 33cd5e26da..bd367d2422 100644 --- a/test/passing/tests/js_source.ml.ocp +++ b/test/passing/tests/js_source.ml.ocp @@ -83,7 +83,8 @@ let () = and[@foo] y = 4 in [%foo (let module M = M in - ()) [@foo]]; + ()) + [@foo]]; [%foo (let open M in ()) [@foo]]; @@ -98,24 +99,28 @@ let () = [%foo while () do () - done [@foo]]; + done + [@foo]]; [%foo for x = () to () do () - done [@foo]]; + done + [@foo]]; [%foo assert true [@foo]]; [%foo lazy x [@foo]]; [%foo object end [@foo]]; [%foo begin 3 - end [@foo]]; + end + [@foo]]; [%foo new x [@foo]]; [%foo match[@foo] () with | [%foo? (* Pattern expressions *) - ((lazy x) [@foo])] -> () + ((lazy x) + [@foo])] -> () | [%foo? ((exception x) [@foo])] -> ()] ;; @@ -132,7 +137,8 @@ class x = method virtual x : t [@@foo] method! private x = 3 [@@foo] initializer x [@@foo] - end [@foo] + end + [@foo] (* Class type expressions *) class type t = object @@ -9481,7 +9487,8 @@ fun contents -> { contents = contents [@foo] };; (); ((); - ()) [@foo] + ()) +[@foo] (* https://github.com/LexiFi/gen_js_api/issues/61 *) @@ -9807,7 +9814,8 @@ let[@a and y = b in x + y] | _ -> .) -> - y [@attr + y + [@attr (* ... *) (* ... *) attr (* ... *)] @@ -10140,12 +10148,6 @@ let _ = (name, Format.sprintf "expecting %S but got %S" Version.version value)) ;; -let _ = - Error - (Foooooooooooooooooo - (name, Format.sprintf "expecting %S but got %S" Version.version value)) -;; - let _ = `Foooooooooooooooooo (name, Format.sprintf "expecting %S but got %S" Version.version value) @@ -10156,11 +10158,6 @@ let _ = (name, Format.sprintf "expecting %S but got %S" Version.version value) ;; -let _ = - Foooooooooooooooooo - (name, Format.sprintf "expecting %S but got %S" Version.version value) -;; - let (`Foooooooooooooooooo (foooooooooooooo, foooooooooooooo, foooooooooooooo, foooooooooooooo)) = @@ -10315,6 +10312,19 @@ type t = v}*) +(*$ + {| + f|} +*) + +type t = + { xxxxxxxxxxxxxxxxxxx : yyy + [@zzzzzzzzzzzzzzzzzzz + (* ________________________________ + ___ *) + _______] + } + let _ = match () with (*$ Printf.(printf "\n | _ -> .\n;;\n") *) diff --git a/test/passing/tests/js_source.ml.ref b/test/passing/tests/js_source.ml.ref index 1d8b14768b..13df5467ca 100644 --- a/test/passing/tests/js_source.ml.ref +++ b/test/passing/tests/js_source.ml.ref @@ -83,7 +83,8 @@ let () = and[@foo] y = 4 in [%foo (let module M = M in - ()) [@foo]]; + ()) + [@foo]]; [%foo (let open M in ()) [@foo]]; @@ -98,24 +99,28 @@ let () = [%foo while () do () - done [@foo]]; + done + [@foo]]; [%foo for x = () to () do () - done [@foo]]; + done + [@foo]]; [%foo assert true [@foo]]; [%foo lazy x [@foo]]; [%foo object end [@foo]]; [%foo begin 3 - end [@foo]]; + end + [@foo]]; [%foo new x [@foo]]; [%foo match[@foo] () with | [%foo? (* Pattern expressions *) - ((lazy x) [@foo])] -> () + ((lazy x) + [@foo])] -> () | [%foo? ((exception x) [@foo])] -> ()] ;; @@ -132,7 +137,8 @@ class x = method virtual x : t [@@foo] method! private x = 3 [@@foo] initializer x [@@foo] - end [@foo] + end + [@foo] (* Class type expressions *) class type t = object @@ -920,8 +926,8 @@ let id x = x let idb1 = (fun id -> - let _ = id true in - id) + let _ = id true in + id) id ;; @@ -1069,8 +1075,8 @@ let rec devariantize : type t. t ty -> variant -> t = let builder = create_builder () in List.iter2 (fun (Field { label; field_type; set }) (lab, v) -> - if label <> lab then raise VariantMismatch; - set builder (devariantize field_type v)) + if label <> lab then raise VariantMismatch; + set builder (devariantize field_type v)) fields fl; of_builder builder @@ -1319,8 +1325,8 @@ let ty_list : type a e. (a, e) ty -> (a vlist, e) ty = ; sum_inj = (fun (type c) : ((noarg -> a * a vlist -> unit, c) ty_sel * c -> a vlist) -> function - | Thd, Noarg -> `Nil - | Ttl Thd, v -> `Cons v) + | Thd, Noarg -> `Nil + | Ttl Thd, v -> `Cons v) (* One can also write the type annotation directly *) }) ;; @@ -3333,20 +3339,20 @@ let sort (type s) (module Set : Set.S with type elt = s) l = (* No real improvement here? *) let make_set (type s) cmp : (module Set.S with type elt = s) = (module Set.Make (struct - type t = s + type t = s - let compare = cmp - end)) + let compare = cmp + end)) ;; (* No type annotation here *) let sort_cmp (type s) cmp = sort (module Set.Make (struct - type t = s + type t = s - let compare = cmp - end)) + let compare = cmp + end)) ;; module type S = sig @@ -6109,9 +6115,9 @@ class c (v : int) = inherit (fun v -> - object - method v : string = v - end) + object + method v : string = v + end) "42" end ;; @@ -9481,7 +9487,8 @@ fun contents -> { contents = contents [@foo] };; (); ((); - ()) [@foo] + ()) +[@foo] (* https://github.com/LexiFi/gen_js_api/issues/61 *) @@ -9700,7 +9707,7 @@ let _ = type t = [ `XXXX - (* __________________________________________________________________________________ *) + (* __________________________________________________________________________________ *) | `XXXX (* __________________________________________________________________ *) | `XXXX (* _____________________________________________________ *) | `XXXX (* ___________________________________________________ *) @@ -9714,7 +9721,7 @@ type t = type t = { field : ty - (* Here is some verbatim formatted text: + (* Here is some verbatim formatted text: {v starting at column 7 v}*) @@ -9807,10 +9814,11 @@ let[@a and y = b in x + y] | _ -> .) -> - y [@attr - (* ... *) - (* ... *) - attr (* ... *)] + y + [@attr + (* ... *) + (* ... *) + attr (* ... *)] ;; let x = @@ -9952,28 +9960,28 @@ type t let pat = String.Search_pattern.create (String.init len ~f:(function - | 0 -> '\n' - | n when n < len - 1 -> ' ' - | _ -> '*')) + | 0 -> '\n' + | n when n < len - 1 -> ' ' + | _ -> '*')) ;; type t = { break_separators : [ `Before | `After ] ; break_sequences : bool ; break_string_literals : [ `Auto | `Never ] - (** How to potentially break string literals into new lines. *) + (** How to potentially break string literals into new lines. *) ; break_struct : bool ; cases_exp_indent : int ; cases_matching_exp_indent : [ `Normal | `Compact ] } let rec collect_files - ~enable_outside_detected_project - ~root - ~segs - ~ignores - ~enables - ~files + ~enable_outside_detected_project + ~root + ~segs + ~ignores + ~enables + ~files = match segs with | [] | [ "" ] -> ignores, enables, files, None @@ -10126,24 +10134,18 @@ type action = let%test_module "semantics" = (module ( - struct - open Core - open Appendable_list - module Stable = Stable - end : - S)) + struct + open Core + open Appendable_list + module Stable = Stable + end : + S)) ;; let _ = Error (`Foooooooooooooooooo - (name, Format.sprintf "expecting %S but got %S" Version.version value)) -;; - -let _ = - Error - (Foooooooooooooooooo - (name, Format.sprintf "expecting %S but got %S" Version.version value)) + (name, Format.sprintf "expecting %S but got %S" Version.version value)) ;; let _ = @@ -10156,11 +10158,6 @@ let _ = (name, Format.sprintf "expecting %S but got %S" Version.version value) ;; -let _ = - Foooooooooooooooooo - (name, Format.sprintf "expecting %S but got %S" Version.version value) -;; - let (`Foooooooooooooooooo (foooooooooooooo, foooooooooooooo, foooooooooooooo, foooooooooooooo)) = @@ -10267,9 +10264,9 @@ class x = module M = [%demo - module Foo = Bar + module Foo = Bar - type t] + type t] let _ = Some @@ -10306,7 +10303,7 @@ end type t = { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : YYYYYYYYYYYYYYYYYYYYY.t - (* ____________________________________ *) + (* ____________________________________ *) } (*{v @@ -10315,6 +10312,19 @@ type t = v}*) +(*$ + {| + f|} +*) + +type t = + { xxxxxxxxxxxxxxxxxxx : yyy + [@zzzzzzzzzzzzzzzzzzz + (* ________________________________ + ___ *) + _______] + } + let _ = match () with (*$ Printf.(printf "\n | _ -> .\n;;\n") *) diff --git a/test/passing/tests/ocp_indent_compat-break_colon_after.ml.ref b/test/passing/tests/ocp_indent_compat-break_colon_after.ml.ref index 5afc5d045f..4ed2d190af 100644 --- a/test/passing/tests/ocp_indent_compat-break_colon_after.ml.ref +++ b/test/passing/tests/ocp_indent_compat-break_colon_after.ml.ref @@ -63,24 +63,24 @@ module type M = sig end let ssmap : - (module MapT - with type key = string - and type data = string - and type map = SSMap.map ) + (module MapT + with type key = string + and type data = string + and type map = SSMap.map ) = () let ssmap : - (module MapT - with type key = string - and type data = string - and type map = SSMap.map ) - -> unit + (module MapT + with type key = string + and type data = string + and type map = SSMap.map ) + -> unit = () let long_function_name : type a. - a long_long_type -> a -> a -> a -> wrap_wrap_wrap -> unit + a long_long_type -> a -> a -> a -> wrap_wrap_wrap -> unit = fun () -> () diff --git a/test/passing/tests/ocp_indent_compat.ml b/test/passing/tests/ocp_indent_compat.ml index 224fa0e407..0dd986c79c 100644 --- a/test/passing/tests/ocp_indent_compat.ml +++ b/test/passing/tests/ocp_indent_compat.ml @@ -64,24 +64,24 @@ module type M = sig end let ssmap - : (module MapT - with type key = string - and type data = string - and type map = SSMap.map ) + : (module MapT + with type key = string + and type data = string + and type map = SSMap.map ) = () let ssmap - : (module MapT - with type key = string - and type data = string - and type map = SSMap.map ) - -> unit + : (module MapT + with type key = string + and type data = string + and type map = SSMap.map ) + -> unit = () let long_function_name - : type a. a long_long_type -> a -> a -> a -> wrap_wrap_wrap -> unit + : type a. a long_long_type -> a -> a -> a -> wrap_wrap_wrap -> unit = fun () -> () diff --git a/test/passing/tests/record-402.ml.ref b/test/passing/tests/record-402.ml.ref index 29b1ec7184..193886e656 100644 --- a/test/passing/tests/record-402.ml.ref +++ b/test/passing/tests/record-402.ml.ref @@ -53,3 +53,8 @@ let _ = {a= (module M : S); b= (module M : S)} let to_string {x; _ (* we should print y *)} = string_of_int x let {x= (x : t)} = x + +type t = + { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: + YYYYYYYYYYYYYYYYYYYYY.t + (* ____________________________________ *) } diff --git a/test/passing/tests/record-loose.ml.ref b/test/passing/tests/record-loose.ml.ref index 8ed2e0bd78..62bca17b96 100644 --- a/test/passing/tests/record-loose.ml.ref +++ b/test/passing/tests/record-loose.ml.ref @@ -53,3 +53,8 @@ let _ = {a = (module M : S); b = (module M : S)} let to_string {x; _ (* we should print y *)} = string_of_int x let {x : t} = x + +type t = + { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : + YYYYYYYYYYYYYYYYYYYYY.t + (* ____________________________________ *) } diff --git a/test/passing/tests/record-tight_decl.ml.ref b/test/passing/tests/record-tight_decl.ml.ref index 808f751f2e..c31018e185 100644 --- a/test/passing/tests/record-tight_decl.ml.ref +++ b/test/passing/tests/record-tight_decl.ml.ref @@ -53,3 +53,8 @@ let _ = {a = (module M : S); b = (module M : S)} let to_string {x; _ (* we should print y *)} = string_of_int x let {x : t} = x + +type t = + { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: + YYYYYYYYYYYYYYYYYYYYY.t + (* ____________________________________ *) } diff --git a/test/passing/tests/record.ml b/test/passing/tests/record.ml index d3a28caf61..96a59e4ce4 100644 --- a/test/passing/tests/record.ml +++ b/test/passing/tests/record.ml @@ -58,3 +58,8 @@ let _ = { a = (module M : S); b = (module M : S) } let to_string {x; _ (* we should print y *)} = string_of_int x let { x = (x : t) } = x + +type t = + { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : YYYYYYYYYYYYYYYYYYYYY.t + (* ____________________________________ *) + } diff --git a/test/passing/tests/record.ml.ref b/test/passing/tests/record.ml.ref index 01269aa842..caa3b447a6 100644 --- a/test/passing/tests/record.ml.ref +++ b/test/passing/tests/record.ml.ref @@ -53,3 +53,8 @@ let _ = {a= (module M : S); b= (module M : S)} let to_string {x; _ (* we should print y *)} = string_of_int x let {x: t} = x + +type t = + { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: + YYYYYYYYYYYYYYYYYYYYY.t + (* ____________________________________ *) }