@@ -1417,7 +1417,7 @@ and fmt_fun ?force_closing_paren
1417
1417
$ body $ closing
1418
1418
$ Cmts. fmt_after c ast.pexp_loc )
1419
1419
1420
- and fmt_label_arg ?(box = true ) ?epi ? eol c (lbl , ({ast = arg ; _} as xarg )) =
1420
+ and fmt_label_arg ?(box = true ) ?eol c (lbl , ({ast = arg ; _} as xarg )) =
1421
1421
match (lbl, arg.pexp_desc) with
1422
1422
| (Labelled l | Optional l), Pexp_ident {txt= Lident i; loc}
1423
1423
when String. equal l.txt i && List. is_empty arg.pexp_attributes ->
@@ -1435,23 +1435,21 @@ and fmt_label_arg ?(box = true) ?epi ?eol c (lbl, ({ast= arg; _} as xarg)) =
1435
1435
| Optional _ -> str " ?"
1436
1436
| Nolabel -> noop
1437
1437
in
1438
- lbl $ fmt_expression c ~box ?epi xarg
1438
+ lbl $ fmt_expression c ~box xarg
1439
1439
| (Labelled _ | Optional _), _ when Cmts. has_after c.cmts xarg.ast.pexp_loc
1440
1440
->
1441
1441
let cmts_after = Cmts. fmt_after c xarg.ast.pexp_loc in
1442
1442
hvbox_if box 2
1443
1443
( hvbox_if box 0
1444
- (fmt_expression c
1445
- ~pro: (fmt_label lbl " :@;<0 2>" )
1446
- ~box ?epi xarg )
1444
+ (fmt_expression c ~pro: (fmt_label lbl " :@;<0 2>" ) ~box xarg)
1447
1445
$ cmts_after )
1448
1446
| (Labelled _ | Optional _ ), (Pexp_fun _ | Pexp_newtype _ ) ->
1449
1447
fmt_fun ~box ~label: lbl ~parens: true c xarg
1450
1448
| _ ->
1451
1449
let label_sep : s =
1452
1450
if box || c.conf.fmt_opts.wrap_fun_args.v then " :@," else " :"
1453
1451
in
1454
- fmt_label lbl label_sep $ fmt_expression c ~box ?epi xarg
1452
+ fmt_label lbl label_sep $ fmt_expression c ~box xarg
1455
1453
1456
1454
and expression_width c xe =
1457
1455
String. length
@@ -1467,15 +1465,15 @@ and fmt_args_grouped ?epi:(global_epi = noop) c ctx args =
1467
1465
| Pexp_fun _ | Pexp_function _ -> Some false
1468
1466
| _ -> None
1469
1467
in
1470
- let epi =
1471
- match (lbl, last ) with
1472
- | _ , true -> None
1473
- | Nolabel , _ -> Some ( fits_breaks " " ~hint: (1000 , - 1 ) " " )
1474
- | _ -> Some (fits_breaks " " ~hint: ( 1000 , - 3 ) " " )
1468
+ let break_after =
1469
+ match (ast.pexp_desc, c.conf.fmt_opts.break_string_literals.v ) with
1470
+ | Pexp_constant _ , `Auto when not last ->
1471
+ fits_breaks " " ~hint: (1000 , - 2 ) " "
1472
+ | _ -> noop
1475
1473
in
1476
1474
hovbox
1477
1475
(Params.Indent. fun_args_group c.conf ~lbl ast)
1478
- (fmt_label_arg c ?box ?epi (lbl, xarg))
1476
+ (fmt_label_arg c ?box (lbl, xarg) $ break_after )
1479
1477
$ fmt_if_k (not last) (break_unless_newline 1 0 )
1480
1478
in
1481
1479
let fmt_args ~first ~last args =
0 commit comments