File tree Expand file tree Collapse file tree 8 files changed +56
-3
lines changed Expand file tree Collapse file tree 8 files changed +56
-3
lines changed Original file line number Diff line number Diff line change @@ -2916,11 +2916,14 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
2916
2916
$ fmt_atrs
2917
2917
2918
2918
and fmt_lazy c ~ctx ?(pro = noop) ~fmt_atrs ~ext ~parens e =
2919
- let lazy_ = str " lazy" $ fmt_extension_suffix c ext $ space_break in
2919
+ let lazy_ = str " lazy" $ fmt_extension_suffix c ext in
2920
2920
let kw_outer, kw_inner =
2921
2921
match e.pexp_desc with
2922
- | Pexp_beginend _ -> (noop, lazy_)
2923
- | _ -> (lazy_, noop)
2922
+ | Pexp_beginend _ ->
2923
+ (* having an unbreakable space is useful for [lazy begin fun ...]
2924
+ when the function has a long list of arguments. *)
2925
+ (noop, lazy_ $ str " " )
2926
+ | _ -> (lazy_ $ space_break, noop)
2924
2927
in
2925
2928
pro
2926
2929
$ hvbox 2
Original file line number Diff line number Diff line change @@ -411,3 +411,9 @@ let _ =
411
411
| A ->
412
412
print_endline xxxxxxxxx;
413
413
f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz)
414
+
415
+ let _ =
416
+ lazy
417
+ (fun xxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzzzzz ->
418
+ print_endline xxxxxxxxx;
419
+ f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz)
Original file line number Diff line number Diff line change @@ -476,3 +476,12 @@ let _ =
476
476
print_endline xxxxxxxxx;
477
477
f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
478
478
end
479
+
480
+ let _ =
481
+ lazy begin fun xxxxxxxxxxxxxxxxxxxxxxx
482
+ yyyyyyyyyyyyyyyyyyy
483
+ zzzzzzzzzzzzzzzzzzzzzzzz
484
+ ->
485
+ print_endline xxxxxxxxx;
486
+ f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
487
+ end
Original file line number Diff line number Diff line change @@ -470,3 +470,10 @@ let _ =
470
470
print_endline xxxxxxxxx;
471
471
f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz)
472
472
;;
473
+
474
+ let _ =
475
+ lazy
476
+ (fun xxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzzzzz ->
477
+ print_endline xxxxxxxxx;
478
+ f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz)
479
+ ;;
Original file line number Diff line number Diff line change @@ -552,3 +552,10 @@ let _ =
552
552
f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
553
553
end
554
554
;;
555
+
556
+ let _ =
557
+ lazy begin fun xxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzzzzz ->
558
+ print_endline xxxxxxxxx;
559
+ f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
560
+ end
561
+ ;;
Original file line number Diff line number Diff line change @@ -403,3 +403,9 @@ let _ =
403
403
| A ->
404
404
print_endline xxxxxxxxx ;
405
405
f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz )
406
+
407
+ let _ =
408
+ lazy
409
+ (fun xxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzzzzz ->
410
+ print_endline xxxxxxxxx ;
411
+ f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz )
Original file line number Diff line number Diff line change @@ -469,3 +469,12 @@ let _ =
469
469
print_endline xxxxxxxxx ;
470
470
f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
471
471
end
472
+
473
+ let _ =
474
+ lazy begin fun xxxxxxxxxxxxxxxxxxxxxxx
475
+ yyyyyyyyyyyyyyyyyyy
476
+ zzzzzzzzzzzzzzzzzzzzzzzz
477
+ ->
478
+ print_endline xxxxxxxxx ;
479
+ f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
480
+ end
Original file line number Diff line number Diff line change @@ -360,3 +360,9 @@ let _ =
360
360
print_endline xxxxxxxxx;
361
361
f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
362
362
end
363
+
364
+ let _ =
365
+ lazy begin fun xxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzzzzz ->
366
+ print_endline xxxxxxxxx;
367
+ f xxxxxxxxxx yyyyyyyyyyyyy zzzzzzzzzzzzzzzzzzzzz
368
+ end
You can’t perform that action at this time.
0 commit comments