Skip to content

Commit

Permalink
Merge branch 'MAIN' into js-short-fun
Browse files Browse the repository at this point in the history
  • Loading branch information
Julow committed Oct 25, 2024
2 parents 60f6243 + 35ef398 commit e4a6727
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ profile. This started with version 0.26.0.
- \* Undo let-bindings normalizations (#2523, @gpetiot)
- \* Undo method parameters normalizations (#2529, @gpetiot)
- \* The `break-colon` option is now taken into account for method type constraints (#2529, @gpetiot)
- Improve indentation of comments after a `fun` (#2592, @Julow)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion lib/Fmt_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ and fmt_function ?(last_arg = false) ?force_closing_paren ~ctx ~ctx0
body ~pro $ cls_paren
in
let box k = if should_box then box k else k in
box (disambiguate_parens_wrap body $ Cmts.fmt_after c loc)
box (disambiguate_parens_wrap body) $ Cmts.fmt_after c loc

and fmt_label_arg ?(box = true) ?eol c (lbl, ({ast= arg; _} as xarg)) =
match (lbl, arg.pexp_desc) with
Expand Down
8 changes: 8 additions & 0 deletions test/passing/tests/js_source.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8234,6 +8234,14 @@ let exists t key =
let _ = if x then 42 (* dummy *) else y
let _ = if x then 42 (* dummy *) else if y then z else w

let _ =
if x
then
fun _ -> true
(* foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo *)
else f
;;

let _ =
match ids_queue with
| Some q ->
Expand Down
8 changes: 8 additions & 0 deletions test/passing/tests/js_source.ml.ocp
Original file line number Diff line number Diff line change
Expand Up @@ -10522,6 +10522,14 @@ let exists t key =
let _ = if x then 42 (* dummy *) else y
let _ = if x then 42 (* dummy *) else if y then z else w

let _ =
if x
then
fun _ -> true
(* foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo *)
else f
;;

let _ =
match ids_queue with
| Some q ->
Expand Down
10 changes: 9 additions & 1 deletion test/passing/tests/js_source.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ let ty_list : type a e. (a, e) ty -> (a vlist, e) ty =
| Thd, Noarg -> `Nil
| Ttl Thd, v -> `Cons v
: (noarg -> a * a vlist -> unit, c) ty_sel * c -> a vlist))
(* One can also write the type annotation directly *)
(* One can also write the type annotation directly *)
})
;;

Expand Down Expand Up @@ -10522,6 +10522,14 @@ let exists t key =
let _ = if x then 42 (* dummy *) else y
let _ = if x then 42 (* dummy *) else if y then z else w

let _ =
if x
then
fun _ -> true
(* foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo *)
else f
;;

let _ =
match ids_queue with
| Some q ->
Expand Down
2 changes: 1 addition & 1 deletion test/passing/tests/source-conventional.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ let ty_list : type a e. (a, e) ty -> (a vlist, e) ty =
(fun (type c) ->
(function Thd, Noarg -> `Nil | Ttl Thd, v -> `Cons v
: (noarg -> a * a vlist -> unit, c) ty_sel * c -> a vlist))
(* One can also write the type annotation directly *);
(* One can also write the type annotation directly *);
})

let v = variantize Enil (ty_list Int) (`Cons (1, `Cons (2, `Nil)))
Expand Down
2 changes: 1 addition & 1 deletion test/passing/tests/source.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ let ty_list : type a e. (a, e) ty -> (a vlist, e) ty =
(fun (type c) ->
( function Thd, Noarg -> `Nil | Ttl Thd, v -> `Cons v
: (noarg -> a * a vlist -> unit, c) ty_sel * c -> a vlist ) )
(* One can also write the type annotation directly *) } )
(* One can also write the type annotation directly *) } )

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

Expand Down

0 comments on commit e4a6727

Please sign in to comment.