Skip to content

Commit 2d9fb4a

Browse files
authored
Stabilize comment around functor type arguments (#2420)
1 parent 31cdd4a commit 2d9fb4a

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ profile. This started with version 0.26.0.
88

99
### Bug fixes
1010

11+
- Fix non-stabilizing comments before a functor type argument (#2420, @Julow)
1112
- Fix crash caused by module types with nested `with module` (#2419, @Julow)
1213

1314
## 0.26.0 (2023-07-18)

lib/Fmt_ast.ml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3406,11 +3406,12 @@ and fmt_functor_param c ctx {loc; txt= arg} =
34063406
| Unit -> Cmts.fmt c loc (wrap "(" ")" (Cmts.fmt_within c loc))
34073407
| Named (name, mt) ->
34083408
let xmt = sub_mty ~ctx mt in
3409-
Cmts.fmt c loc
3410-
(wrap "(" ")"
3411-
(hovbox 0
3412-
( hovbox 0 (fmt_str_loc_opt c name $ fmt "@ : ")
3413-
$ compose_module (fmt_module_type c xmt) ~f:Fn.id ) ) )
3409+
hvbox 0
3410+
(Cmts.fmt c loc
3411+
(wrap "(" ")"
3412+
(hovbox 0
3413+
( hovbox 0 (fmt_str_loc_opt c name $ fmt "@ : ")
3414+
$ compose_module (fmt_module_type c xmt) ~f:Fn.id ) ) ) )
34143415

34153416
and fmt_module_type c ?(rec_ = false) ({ast= mty; _} as xmty) =
34163417
let ctx = Mty mty in

test/passing/tests/module_type.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,9 @@ let foo (type foooo fooo_ooooo)
110110
()
111111

112112
module N : S with module type T = (U with module M = M) = struct end
113+
114+
module type Grammar = functor
115+
(Nonterm : Nonterminal)
116+
(* Set of nonterminals *)
117+
(Attr : Attribute)
118+
-> sig end

0 commit comments

Comments
 (0)