Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Fmt_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4876,7 +4876,7 @@ and fmt_value_binding c ~ctx0 ~rec_flag ?in_ ?epi
, fmt_item_attributes c ~pre:(Break (1, 2)) at_at_attrs $ in_ indent
, fmt_opt epi
, Cmts.fmt_before c lb_loc
, Cmts.fmt_after c lb_loc ~pro:force_break )
, Cmts.fmt_after c lb_loc ~pro:(break 1 0) )
| None ->
let epi =
fmt_item_attributes c ~pre:(Break (1, 0)) at_at_attrs $ fmt_opt epi
Expand Down Expand Up @@ -4955,7 +4955,7 @@ and fmt_value_binding c ~ctx0 ~rec_flag ?in_ ?epi
( hvbox_if toplevel indent decl_and_body
$ cmts_after
$ opt loc_in
(Cmts.fmt_before c ~pro:force_break ~epi:noop ~eol:noop) )
(Cmts.fmt_before c ~pro:(break 1 0) ~epi:noop ~eol:noop) )
$ in_ )
$ opt loc_in (Cmts.fmt_after ~pro:force_break c)
$ epi )
Expand Down
19 changes: 19 additions & 0 deletions test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.ahrefs/let_binding-in_indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.ahrefs/let_binding-indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.ahrefs/let_binding.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
10 changes: 2 additions & 8 deletions test/passing/refs.ahrefs/let_punning-denied.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@ let q =

let r =
let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and* (* 5 *) y =
y
(* 6 *)
in
and* (* 5 *) y = y (* 6 *) in
x, y

let s =
let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and (* 5 *) y =
y
(* 6 *)
in
and (* 5 *) y = y (* 6 *) in
x, y
8 changes: 2 additions & 6 deletions test/passing/refs.ahrefs/let_punning-preferred.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ let r =
(* 3 *) x
(* 2 *)
(* 4 *)
and* (* 5 *) y
(* 6 *)
in
and* (* 5 *) y (* 6 *) in
x, y

let s =
Expand All @@ -37,7 +35,5 @@ let s =
(* 3 *) x
(* 2 *)
(* 4 *)
and (* 5 *) y
(* 6 *)
in
and (* 5 *) y (* 6 *) in
x, y
8 changes: 2 additions & 6 deletions test/passing/refs.ahrefs/let_punning.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ let q =

let r =
let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and* (* 5 *) y
(* 6 *)
in
and* (* 5 *) y (* 6 *) in
x, y

let s =
let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and (* 5 *) y
(* 6 *)
in
and (* 5 *) y (* 6 *) in
x, y
19 changes: 19 additions & 0 deletions test/passing/refs.default/let_binding-deindent-fun.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.default/let_binding-in_indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.default/let_binding-indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.default/let_binding.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
12 changes: 2 additions & 10 deletions test/passing/refs.default/let_punning-denied.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,9 @@ let q =
(x, y, z)

let r =
let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and* (* 5 *) y =
y
(* 6 *)
in
let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and* (* 5 *) y = y (* 6 *) in
(x, y)

let s =
let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and (* 5 *) y =
y
(* 6 *)
in
let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and (* 5 *) y = y (* 6 *) in
(x, y)
11 changes: 3 additions & 8 deletions test/passing/refs.default/let_punning-preferred.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ let q =
let r =
let*
(* 1 *)
(* 3 *) x
(* 2 *)
(* 3 *) x (* 2 *)
(* 4 *)
and* (* 5 *) y
(* 6 *)
in
and* (* 5 *) y (* 6 *) in
(x, y)

let s =
Expand All @@ -30,7 +27,5 @@ let s =
(* 3 *) x
(* 2 *)
(* 4 *)
and (* 5 *) y
(* 6 *)
in
and (* 5 *) y (* 6 *) in
(x, y)
10 changes: 2 additions & 8 deletions test/passing/refs.default/let_punning.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ let q =
(x, y, z)

let r =
let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and* (* 5 *) y
(* 6 *)
in
let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and* (* 5 *) y (* 6 *) in
(x, y)

let s =
let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *)
and (* 5 *) y
(* 6 *)
in
let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and (* 5 *) y (* 6 *) in
(x, y)
19 changes: 19 additions & 0 deletions test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.janestreet/let_binding-in_indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
19 changes: 19 additions & 0 deletions test/passing/refs.janestreet/let_binding-indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,22 @@ let rewrite_export =
let+ (a, b) : a * b = () in
()
;;

(* Comment before in should stay on same line when it fits *)
let () =
let threshold = 3 (* max depth *) in
use threshold
;;

let () =
let left _ = true (* value vs nothing *) in
use left
;;

(* Comment before in that does not fit should break *)
let () =
let some_long_variable_name =
some_long_expression_value (* a long comment forcing a break *)
in
use some_long_variable_name
;;
Loading
Loading