Skip to content

Commit cf6198d

Browse files
committed
Fix printing of module types with multiple type constraints
1 parent 62e5c5c commit cf6198d

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

compiler/syntax/src/res_outcome_printer.ml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,18 @@ let rec print_out_type_doc (out_type : Outcometree.out_type) =
217217
Doc.join ~sep:Doc.line
218218
((List.map2 [@doesNotRaise])
219219
(fun lbl typ ->
220-
Doc.concat
221-
[
222-
Doc.text
223-
(if i.contents > 0 then "and type " else "with type ");
224-
Doc.text lbl;
225-
Doc.text " = ";
226-
print_out_type_doc typ;
227-
])
220+
let result =
221+
Doc.concat
222+
[
223+
Doc.text
224+
(if i.contents > 0 then "and type " else "with type ");
225+
Doc.text lbl;
226+
Doc.text " = ";
227+
print_out_type_doc typ;
228+
]
229+
in
230+
incr i;
231+
result)
228232
labels types)
229233
in
230234
Doc.indent (Doc.concat [Doc.line; package])

tests/analysis_tests/tests/src/expected/CreateInterface.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ module OrderedSet: {
130130
set: Belt.Set.t<'a, 'identity>,
131131
array: array<'a>,
132132
}
133-
let make: (~id: module(Belt.Id.Comparable with type identity = 'a with type t = 'b)) => t<'b, 'a>
133+
let make: (~id: module(Belt.Id.Comparable with type identity = 'a and type t = 'b)) => t<'b, 'a>
134134
}
135135

0 commit comments

Comments
 (0)