Skip to content

Commit 792ec9c

Browse files
fix f (g a begin end)
1 parent 75e2bdd commit 792ec9c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/Fmt_ast.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,14 +2302,15 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
23022302
let pro =
23032303
intro_epi
23042304
$ fmt_if parens (str "(")
2305-
$ ( fmt_args_grouped ~epi:fmt_atrs e0 args_before
2306-
$ fmt_if parens (closing_paren c ~force ~offset:(-3)) )
2305+
$ fmt_args_grouped ~epi:fmt_atrs e0 args_before
23072306
in
23082307
let label_sep = Params.Exp.fun_label_sep c.conf in
23092308
let pro = pro $ break 1 0 $ fmt_label lbl label_sep in
23102309
expr_epi
23112310
$ hovbox 4
2312-
(fmt_expression c ~pro ~box:false (sub_exp ~ctx last_arg))
2311+
(fmt_expression c ~pro ~box:false (sub_exp ~ctx last_arg)
2312+
$ fmt_if parens (closing_paren c ~force ~offset:(-3))
2313+
)
23132314
| _ ->
23142315
let fmt_atrs =
23152316
fmt_attributes c ~pre:(Break (1, -2)) pexp_attributes

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)