Skip to content

Commit 3b8bf77

Browse files
fix f (g a begin end) (issue #2713) (#2715)
1 parent 4fca068 commit 3b8bf77

File tree

10 files changed

+64
-3
lines changed

10 files changed

+64
-3
lines changed

lib/Fmt_ast.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2340,14 +2340,14 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
23402340
let pro =
23412341
intro_epi
23422342
$ fmt_if parens (str "(")
2343-
$ ( fmt_args_grouped ~epi:fmt_atrs e0 args_before
2344-
$ fmt_if parens (closing_paren c ~force ~offset:(-3)) )
2343+
$ fmt_args_grouped ~epi:fmt_atrs e0 args_before
23452344
in
23462345
let label_sep = Params.Exp.fun_label_sep c.conf in
23472346
let pro = pro $ break 1 0 $ fmt_label lbl label_sep in
23482347
expr_epi
23492348
$ hovbox 4
2350-
(fmt_expression c ~pro ~box:false (sub_exp ~ctx last_arg))
2349+
( fmt_expression c ~pro ~box:false (sub_exp ~ctx last_arg)
2350+
$ fmt_if parens (closing_paren c ~force ~offset:(-3)) )
23512351
| _ ->
23522352
let fmt_atrs =
23532353
fmt_attributes c ~pre:(Break (1, -2)) pexp_attributes

test/passing/refs.ahrefs/exp_grouping-parens.ml.ref

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,3 +578,9 @@ let () =
578578
$ y
579579
in
580580
fooooooooooo x)
581+
582+
let f () =
583+
f
584+
(g a (fun () ->
585+
let x = y in
586+
z))

test/passing/refs.ahrefs/exp_grouping.ml.ref

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,3 +662,10 @@ let () =
662662
in
663663
fooooooooooo x
664664
end
665+
666+
let f () =
667+
f
668+
(g a begin fun () ->
669+
let x = y in
670+
z
671+
end)

test/passing/refs.default/exp_grouping-parens.ml.ref

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,3 +595,9 @@ let () =
595595
$ y
596596
in
597597
fooooooooooo x)
598+
599+
let f () =
600+
f
601+
(g a (fun () ->
602+
let x = y in
603+
z))

test/passing/refs.default/exp_grouping.ml.ref

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,3 +680,10 @@ let () =
680680
in
681681
fooooooooooo x
682682
end
683+
684+
let f () =
685+
f
686+
(g a begin fun () ->
687+
let x = y in
688+
z
689+
end)

test/passing/refs.janestreet/exp_grouping-parens.ml.ref

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,3 +677,10 @@ let () =
677677
in
678678
fooooooooooo x)
679679
;;
680+
681+
let f () =
682+
f
683+
(g a (fun () ->
684+
let x = y in
685+
z))
686+
;;

test/passing/refs.janestreet/exp_grouping.ml.ref

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,3 +765,11 @@ let () =
765765
fooooooooooo x
766766
end
767767
;;
768+
769+
let f () =
770+
f
771+
(g a begin fun () ->
772+
let x = y in
773+
z
774+
end)
775+
;;

test/passing/refs.ocamlformat/exp_grouping-parens.ml.ref

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,3 +599,9 @@ let () =
599599
$ y
600600
in
601601
fooooooooooo x )
602+
603+
let f () =
604+
f
605+
(g a (fun () ->
606+
let x = y in
607+
z ) )

test/passing/refs.ocamlformat/exp_grouping.ml.ref

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,3 +686,10 @@ let () =
686686
in
687687
fooooooooooo x
688688
end
689+
690+
let f () =
691+
f
692+
(g a begin fun () ->
693+
let x = y in
694+
z
695+
end )

test/passing/tests/exp_grouping.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,3 +547,10 @@ let () =
547547
in
548548
fooooooooooo x
549549
end
550+
551+
let f () =
552+
f
553+
(g a begin fun () ->
554+
let x = y in
555+
z
556+
end )

0 commit comments

Comments
 (0)