diff --git a/lib/Fmt_ast.ml b/lib/Fmt_ast.ml index a136f24f34..dd29565417 100644 --- a/lib/Fmt_ast.ml +++ b/lib/Fmt_ast.ml @@ -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 @@ -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 ) diff --git a/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref b/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref index c18b84f303..050db807e0 100644 --- a/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref @@ -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 +;; diff --git a/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref b/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref index 187c6db1e0..d7d438a3e5 100644 --- a/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref @@ -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 +;; diff --git a/test/passing/refs.ahrefs/let_binding-indent.ml.ref b/test/passing/refs.ahrefs/let_binding-indent.ml.ref index 190db884bc..19f120ed20 100644 --- a/test/passing/refs.ahrefs/let_binding-indent.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-indent.ml.ref @@ -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 +;; diff --git a/test/passing/refs.ahrefs/let_binding.ml.ref b/test/passing/refs.ahrefs/let_binding.ml.ref index 10193df68f..fab45fd893 100644 --- a/test/passing/refs.ahrefs/let_binding.ml.ref +++ b/test/passing/refs.ahrefs/let_binding.ml.ref @@ -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 +;; diff --git a/test/passing/refs.ahrefs/let_punning-denied.ml.ref b/test/passing/refs.ahrefs/let_punning-denied.ml.ref index 412c98a4a8..92a1877e55 100644 --- a/test/passing/refs.ahrefs/let_punning-denied.ml.ref +++ b/test/passing/refs.ahrefs/let_punning-denied.ml.ref @@ -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 diff --git a/test/passing/refs.ahrefs/let_punning-preferred.ml.ref b/test/passing/refs.ahrefs/let_punning-preferred.ml.ref index 29ef0c2a71..ddaa50bf68 100644 --- a/test/passing/refs.ahrefs/let_punning-preferred.ml.ref +++ b/test/passing/refs.ahrefs/let_punning-preferred.ml.ref @@ -26,9 +26,7 @@ let r = (* 3 *) x (* 2 *) (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in x, y let s = @@ -37,7 +35,5 @@ let s = (* 3 *) x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in x, y diff --git a/test/passing/refs.ahrefs/let_punning.ml.ref b/test/passing/refs.ahrefs/let_punning.ml.ref index 5432ff3fa6..82ee8e3c72 100644 --- a/test/passing/refs.ahrefs/let_punning.ml.ref +++ b/test/passing/refs.ahrefs/let_punning.ml.ref @@ -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 diff --git a/test/passing/refs.default/let_binding-deindent-fun.ml.ref b/test/passing/refs.default/let_binding-deindent-fun.ml.ref index db53858100..604e473a2d 100644 --- a/test/passing/refs.default/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.default/let_binding-deindent-fun.ml.ref @@ -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 +;; diff --git a/test/passing/refs.default/let_binding-in_indent.ml.ref b/test/passing/refs.default/let_binding-in_indent.ml.ref index 79a4965be2..05dac1fbca 100644 --- a/test/passing/refs.default/let_binding-in_indent.ml.ref +++ b/test/passing/refs.default/let_binding-in_indent.ml.ref @@ -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 +;; diff --git a/test/passing/refs.default/let_binding-indent.ml.ref b/test/passing/refs.default/let_binding-indent.ml.ref index a302c46bb7..ba4540c756 100644 --- a/test/passing/refs.default/let_binding-indent.ml.ref +++ b/test/passing/refs.default/let_binding-indent.ml.ref @@ -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 +;; diff --git a/test/passing/refs.default/let_binding.ml.ref b/test/passing/refs.default/let_binding.ml.ref index 36fa3c8ca2..dbef21d364 100644 --- a/test/passing/refs.default/let_binding.ml.ref +++ b/test/passing/refs.default/let_binding.ml.ref @@ -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 +;; diff --git a/test/passing/refs.default/let_punning-denied.ml.ref b/test/passing/refs.default/let_punning-denied.ml.ref index 061a76aa8e..9f5522bee2 100644 --- a/test/passing/refs.default/let_punning-denied.ml.ref +++ b/test/passing/refs.default/let_punning-denied.ml.ref @@ -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) diff --git a/test/passing/refs.default/let_punning-preferred.ml.ref b/test/passing/refs.default/let_punning-preferred.ml.ref index d7389534bf..0632a5ab13 100644 --- a/test/passing/refs.default/let_punning-preferred.ml.ref +++ b/test/passing/refs.default/let_punning-preferred.ml.ref @@ -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 = @@ -30,7 +27,5 @@ let s = (* 3 *) x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in (x, y) diff --git a/test/passing/refs.default/let_punning.ml.ref b/test/passing/refs.default/let_punning.ml.ref index 2458e47565..9dbc1a4152 100644 --- a/test/passing/refs.default/let_punning.ml.ref +++ b/test/passing/refs.default/let_punning.ml.ref @@ -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) diff --git a/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref b/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref index 36a7451b80..aea933fa9f 100644 --- a/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref @@ -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 +;; diff --git a/test/passing/refs.janestreet/let_binding-in_indent.ml.ref b/test/passing/refs.janestreet/let_binding-in_indent.ml.ref index c1db5a009e..af69425dfa 100644 --- a/test/passing/refs.janestreet/let_binding-in_indent.ml.ref +++ b/test/passing/refs.janestreet/let_binding-in_indent.ml.ref @@ -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 +;; diff --git a/test/passing/refs.janestreet/let_binding-indent.ml.ref b/test/passing/refs.janestreet/let_binding-indent.ml.ref index 61dc7bc0f4..05f27db82e 100644 --- a/test/passing/refs.janestreet/let_binding-indent.ml.ref +++ b/test/passing/refs.janestreet/let_binding-indent.ml.ref @@ -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 +;; diff --git a/test/passing/refs.janestreet/let_binding.ml.ref b/test/passing/refs.janestreet/let_binding.ml.ref index 36a7451b80..aea933fa9f 100644 --- a/test/passing/refs.janestreet/let_binding.ml.ref +++ b/test/passing/refs.janestreet/let_binding.ml.ref @@ -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 +;; diff --git a/test/passing/refs.janestreet/let_punning-denied.ml.ref b/test/passing/refs.janestreet/let_punning-denied.ml.ref index f67c2a3c93..fc0e90f4dd 100644 --- a/test/passing/refs.janestreet/let_punning-denied.ml.ref +++ b/test/passing/refs.janestreet/let_punning-denied.ml.ref @@ -21,18 +21,12 @@ 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 ;; diff --git a/test/passing/refs.janestreet/let_punning-preferred.ml.ref b/test/passing/refs.janestreet/let_punning-preferred.ml.ref index 82d3ab7142..9cdde14625 100644 --- a/test/passing/refs.janestreet/let_punning-preferred.ml.ref +++ b/test/passing/refs.janestreet/let_punning-preferred.ml.ref @@ -26,9 +26,7 @@ let r = x (* 2 *) (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in x, y ;; @@ -39,8 +37,6 @@ let s = x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in x, y ;; diff --git a/test/passing/refs.janestreet/let_punning.ml.ref b/test/passing/refs.janestreet/let_punning.ml.ref index 530d7e3868..9038ec562f 100644 --- a/test/passing/refs.janestreet/let_punning.ml.ref +++ b/test/passing/refs.janestreet/let_punning.ml.ref @@ -21,16 +21,12 @@ 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 ;; diff --git a/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref b/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref index 56f710afbf..6308881b56 100644 --- a/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref @@ -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 +;; diff --git a/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref b/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref index 105ce4750a..bf79ab4c98 100644 --- a/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref @@ -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 +;; diff --git a/test/passing/refs.ocamlformat/let_binding-indent.ml.ref b/test/passing/refs.ocamlformat/let_binding-indent.ml.ref index 1897d8c16e..c9d0249d8d 100644 --- a/test/passing/refs.ocamlformat/let_binding-indent.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-indent.ml.ref @@ -301,3 +301,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 +;; diff --git a/test/passing/refs.ocamlformat/let_binding.ml.ref b/test/passing/refs.ocamlformat/let_binding.ml.ref index 02d8b1a247..dab5b9b9f0 100644 --- a/test/passing/refs.ocamlformat/let_binding.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding.ml.ref @@ -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 +;; diff --git a/test/passing/refs.ocamlformat/let_punning-denied.ml.ref b/test/passing/refs.ocamlformat/let_punning-denied.ml.ref index 192768574f..c1d493076a 100644 --- a/test/passing/refs.ocamlformat/let_punning-denied.ml.ref +++ b/test/passing/refs.ocamlformat/let_punning-denied.ml.ref @@ -17,17 +17,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) diff --git a/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref b/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref index 929a32637f..0a3ef1c5b1 100644 --- a/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref +++ b/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref @@ -19,12 +19,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 = @@ -33,7 +30,5 @@ let s = (* 3 *) x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in (x, y) diff --git a/test/passing/refs.ocamlformat/let_punning.ml.ref b/test/passing/refs.ocamlformat/let_punning.ml.ref index feaee6b37c..58a54065dd 100644 --- a/test/passing/refs.ocamlformat/let_punning.ml.ref +++ b/test/passing/refs.ocamlformat/let_punning.ml.ref @@ -17,15 +17,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) diff --git a/test/passing/tests/let_binding.ml b/test/passing/tests/let_binding.ml index ab77d849fd..4ff7d7dfd2 100644 --- a/test/passing/tests/let_binding.ml +++ b/test/passing/tests/let_binding.ml @@ -276,3 +276,19 @@ let rewrite_export = let+ (Raw id) : binary indice = () in 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