Skip to content

Commit

Permalink
fix poly variants with kind annots
Browse files Browse the repository at this point in the history
Signed-off-by: David Vulakh <[email protected]>
  • Loading branch information
dvulakh committed Oct 7, 2024
1 parent 3fefbfa commit 5dceabc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
27 changes: 16 additions & 11 deletions lib/Fmt_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3743,17 +3743,22 @@ and fmt_type_declaration c ?ext ?(pre = "") ?name ?(eq = "=") {ast= decl; _}
in
let box_manifest k =
hvbox c.conf.fmt_opts.type_decl_indent.v
( str pre
$ fmt_extension_suffix c ext
$ str " "
$ hvbox_if
(not (List.is_empty ptype_params))
0
( fmt_tydcl_params c ctx ptype_params
$ Option.value_map name ~default:(str txt) ~f:(fmt_longident_loc c)
$ fmt_opt
(Option.map ~f:(fmt_jkind_constr ~ctx:(Td decl) c) ptype_jkind)
)
( hvbox_if
(Option.is_some ptype_jkind)
c.conf.fmt_opts.type_decl_indent.v
( str pre
$ fmt_extension_suffix c ext
$ str " "
$ hvbox_if
(not (List.is_empty ptype_params))
0
( fmt_tydcl_params c ctx ptype_params
$ Option.value_map name ~default:(str txt)
~f:(fmt_longident_loc c)
$ fmt_opt
(Option.map
~f:(fmt_jkind_constr ~ctx:(Td decl) c)
ptype_jkind ) ) )
$ k )
in
let fmt_manifest_kind =
Expand Down
3 changes: 1 addition & 2 deletions test/passing/tests/layout_annotation-erased.ml.js-ref
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ type t_imm : immediate =
| Bbbbbbbbbbbbbbbbbbbbb
| Ccccccccccccccccccccc

type t_imm :
immediate =
type t_imm : immediate =
[ `Aaaaaaaaaaaaaaaaaaaaa
| `Bbbbbbbbbbbbbbbbbbbbb
| `Ccccccccccccccccccccc
Expand Down
3 changes: 1 addition & 2 deletions test/passing/tests/layout_annotation.ml.js-ref
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ type t_imm : immediate =
| Bbbbbbbbbbbbbbbbbbbbb
| Ccccccccccccccccccccc

type t_imm :
immediate =
type t_imm : immediate =
[ `Aaaaaaaaaaaaaaaaaaaaa
| `Bbbbbbbbbbbbbbbbbbbbb
| `Ccccccccccccccccccccc
Expand Down
3 changes: 1 addition & 2 deletions test/passing/tests/layout_annotation.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ type t_imm : immediate =
| Bbbbbbbbbbbbbbbbbbbbb
| Ccccccccccccccccccccc

type t_imm :
immediate =
type t_imm : immediate =
[`Aaaaaaaaaaaaaaaaaaaaa | `Bbbbbbbbbbbbbbbbbbbbb | `Ccccccccccccccccccccc]

type t_imm : immediate =
Expand Down

0 comments on commit 5dceabc

Please sign in to comment.