diff --git a/src/reason-parser/reason_pprint_ast.ml b/src/reason-parser/reason_pprint_ast.ml index 2c9501d5c..7e0f18bbd 100644 --- a/src/reason-parser/reason_pprint_ast.ml +++ b/src/reason-parser/reason_pprint_ast.ml @@ -2512,9 +2512,12 @@ let printer = object(self:'self) let t = match lbl with | Nolabel -> typ | Labelled lbl -> - makeList ~sep:(Sep " ") [atom (namedArgSym ^ lbl ^ ":"); typ] + label ~space:true (atom (namedArgSym ^ lbl ^ ":")) typ | Optional lbl -> - makeList ~sep:(Sep " ") [atom (namedArgSym ^ lbl ^ ":"); label typ (atom "=?")] + label + ~space:true + (atom (namedArgSym ^ lbl ^ ":")) + (label typ (atom "=?")) in if uncurried then makeList ~postSpace:true [atom "."; t] diff --git a/test/general-syntax-re.t/run.t b/test/general-syntax-re.t/run.t index dc59e0c28..2cf97ba88 100644 --- a/test/general-syntax-re.t/run.t +++ b/test/general-syntax-re.t/run.t @@ -76,8 +76,8 @@ Format general implementation syntax list(int); type firstTwoShouldBeGroupedAndFirstThree = ( - ~first: (list(int) => list(int)) => - list(int) + ~first: + (list(int) => list(int)) => list(int) ) => list(int); @@ -840,17 +840,16 @@ Format general implementation syntax type typeWithNestedNamedArgs = ( - ~outerOne: (~innerOne: int, ~innerTwo: int) => - int, + ~outerOne: + (~innerOne: int, ~innerTwo: int) => int, ~outerTwo: int ) => int; type typeWithNestedOptionalNamedArgs = ( - ~outerOne: (~innerOne: int, ~innerTwo: int) => - int - =?, + ~outerOne: + (~innerOne: int, ~innerTwo: int) => int=?, ~outerTwo: int=? ) => int; diff --git a/test/general-syntax-rei.t/input.rei b/test/general-syntax-rei.t/input.rei index 2b535b6f4..493a662a1 100644 --- a/test/general-syntax-rei.t/input.rei +++ b/test/general-syntax-rei.t/input.rei @@ -52,3 +52,15 @@ module%foo X = Y; module%foo rec X: Y; +let wrapReasonForJs: + ( + ~component: componentSpec( + 'state, + 'initialState, + 'retainedProps, + 'initialRetainedPropssssssssssssssssss, + 'action + ) + ) => + reactClass; + diff --git a/test/general-syntax-rei.t/run.t b/test/general-syntax-rei.t/run.t index 65b1aae1f..0d95d4ed8 100644 --- a/test/general-syntax-rei.t/run.t +++ b/test/general-syntax-rei.t/run.t @@ -60,3 +60,16 @@ Format general interface syntax module%foo X = Y; module%foo rec X: Y; + + let wrapReasonForJs: + ( + ~component: + componentSpec( + 'state, + 'initialState, + 'retainedProps, + 'initialRetainedPropssssssssssssssssss, + 'action, + ) + ) => + reactClass;