diff --git a/CHANGELOG.md b/CHANGELOG.md index 267347ad3a..118b62ee92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ #### :bug: Bug fix +- Fix generation of interfaces for module types containing multiple type constraints. https://github.com/rescript-lang/rescript/pull/7825 + #### :memo: Documentation #### :nail_care: Polish diff --git a/compiler/syntax/src/res_outcome_printer.ml b/compiler/syntax/src/res_outcome_printer.ml index 1deeecc89e..f6fd5aec84 100644 --- a/compiler/syntax/src/res_outcome_printer.ml +++ b/compiler/syntax/src/res_outcome_printer.ml @@ -217,14 +217,18 @@ let rec print_out_type_doc (out_type : Outcometree.out_type) = Doc.join ~sep:Doc.line ((List.map2 [@doesNotRaise]) (fun lbl typ -> - Doc.concat - [ - Doc.text - (if i.contents > 0 then "and type " else "with type "); - Doc.text lbl; - Doc.text " = "; - print_out_type_doc typ; - ]) + let result = + Doc.concat + [ + Doc.text + (if i.contents > 0 then "and type " else "with type "); + Doc.text lbl; + Doc.text " = "; + print_out_type_doc typ; + ] + in + incr i; + result) labels types) in Doc.indent (Doc.concat [Doc.line; package]) diff --git a/tests/analysis_tests/tests/src/CreateInterface.res b/tests/analysis_tests/tests/src/CreateInterface.res index 71843a7f35..845067e1eb 100644 --- a/tests/analysis_tests/tests/src/CreateInterface.res +++ b/tests/analysis_tests/tests/src/CreateInterface.res @@ -171,3 +171,24 @@ module ComponentWithPolyProp = {
} } + +module OrderedSet = { + type t<'a, 'identity> = { + cmp: ('a, 'a) => int, + set: Belt.Set.t<'a, 'identity>, + array: array<'a>, + } + + let make = ( + type value identity, + ~id: module(Belt.Id.Comparable with type t = value and type identity = identity), + ): t