Skip to content

Commit 35ef398

Browse files
authored
Un-indent comment after fun (#2592)
This indentation is not useful and is new in the janestreet profile.
1 parent 500977d commit 35ef398

File tree

7 files changed

+29
-4
lines changed

7 files changed

+29
-4
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ profile. This started with version 0.26.0.
3030
- \* Undo let-bindings normalizations (#2523, @gpetiot)
3131
- \* Undo method parameters normalizations (#2529, @gpetiot)
3232
- \* The `break-colon` option is now taken into account for method type constraints (#2529, @gpetiot)
33+
- Improve indentation of comments after a `fun` (#2592, @Julow)
3334

3435
### Fixed
3536

lib/Fmt_ast.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ and fmt_function ?(last_arg = false) ?force_closing_paren ~ctx ~ctx0
16081608
body ~pro $ cls_paren
16091609
in
16101610
let box k = if should_box then box k else k in
1611-
box (disambiguate_parens_wrap body $ Cmts.fmt_after c loc)
1611+
box (disambiguate_parens_wrap body) $ Cmts.fmt_after c loc
16121612

16131613
and fmt_label_arg ?(box = true) ?eol c (lbl, ({ast= arg; _} as xarg)) =
16141614
match (lbl, arg.pexp_desc) with

test/passing/tests/js_source.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8233,3 +8233,11 @@ let exists t key =
82338233

82348234
let _ = if x then 42 (* dummy *) else y
82358235
let _ = if x then 42 (* dummy *) else if y then z else w
8236+
8237+
let _ =
8238+
if x
8239+
then
8240+
fun _ -> true
8241+
(* foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo *)
8242+
else f
8243+
;;

test/passing/tests/js_source.ml.ocp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10522,3 +10522,11 @@ let exists t key =
1052210522

1052310523
let _ = if x then 42 (* dummy *) else y
1052410524
let _ = if x then 42 (* dummy *) else if y then z else w
10525+
10526+
let _ =
10527+
if x
10528+
then
10529+
fun _ -> true
10530+
(* foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo *)
10531+
else f
10532+
;;

test/passing/tests/js_source.ml.ref

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ let ty_list : type a e. (a, e) ty -> (a vlist, e) ty =
13341334
| Thd, Noarg -> `Nil
13351335
| Ttl Thd, v -> `Cons v
13361336
: (noarg -> a * a vlist -> unit, c) ty_sel * c -> a vlist))
1337-
(* One can also write the type annotation directly *)
1337+
(* One can also write the type annotation directly *)
13381338
})
13391339
;;
13401340

@@ -10522,3 +10522,11 @@ let exists t key =
1052210522

1052310523
let _ = if x then 42 (* dummy *) else y
1052410524
let _ = if x then 42 (* dummy *) else if y then z else w
10525+
10526+
let _ =
10527+
if x
10528+
then
10529+
fun _ -> true
10530+
(* foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo *)
10531+
else f
10532+
;;

test/passing/tests/source-conventional.ml.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ let ty_list : type a e. (a, e) ty -> (a vlist, e) ty =
12301230
(fun (type c) ->
12311231
(function Thd, Noarg -> `Nil | Ttl Thd, v -> `Cons v
12321232
: (noarg -> a * a vlist -> unit, c) ty_sel * c -> a vlist))
1233-
(* One can also write the type annotation directly *);
1233+
(* One can also write the type annotation directly *);
12341234
})
12351235

12361236
let v = variantize Enil (ty_list Int) (`Cons (1, `Cons (2, `Nil)))

test/passing/tests/source.ml.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ let ty_list : type a e. (a, e) ty -> (a vlist, e) ty =
13501350
(fun (type c) ->
13511351
( function Thd, Noarg -> `Nil | Ttl Thd, v -> `Cons v
13521352
: (noarg -> a * a vlist -> unit, c) ty_sel * c -> a vlist ) )
1353-
(* One can also write the type annotation directly *) } )
1353+
(* One can also write the type annotation directly *) } )
13541354

13551355
let v = variantize Enil (ty_list Int) (`Cons (1, `Cons (2, `Nil)))
13561356

0 commit comments

Comments
 (0)