diff --git a/CHANGELOG.md b/CHANGELOG.md index 71078431e0..137167e25c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ These are only breaking changes for unformatted code. - Fix issue with using alias and default value together https://github.com/rescript-lang/rescript-compiler/pull/5989 - GenType: fix issue with V3 compatibility mode (see https://github.com/rescript-lang/rescript-compiler/issues/5990) https://github.com/rescript-lang/rescript-compiler/pull/5991 - Fix issue in `Js.Promise2` where `then` and `catch` were returning `undefined` https://github.com/rescript-lang/rescript-compiler/pull/5997 +- Fix formatting of props spread for multiline JSX expression https://github.com/rescript-lang/rescript-compiler/pull/6006 #### :nail_care: Polish diff --git a/res_syntax/src/res_printer.ml b/res_syntax/src/res_printer.ml index ae8cbcfac9..e89e1cba95 100644 --- a/res_syntax/src/res_printer.ml +++ b/res_syntax/src/res_printer.ml @@ -4264,7 +4264,7 @@ and printJsxProp ~state arg cmtTbl = | Optional _lbl -> Doc.concat [Doc.question; printIdentLike ident]) | Asttypes.Labelled "_spreadProps", expr -> let doc = printExpressionWithComments ~state expr cmtTbl in - Doc.concat [Doc.lbrace; Doc.dotdotdot; Doc.softLine; doc; Doc.rbrace] + Doc.concat [Doc.lbrace; Doc.dotdotdot; doc; Doc.rbrace] | lbl, expr -> let argLoc, expr = match expr.pexp_attributes with diff --git a/res_syntax/tests/printer/expr/expected/jsx.res.txt b/res_syntax/tests/printer/expr/expected/jsx.res.txt index bdc104ff12..4b9e5f970e 100644 --- a/res_syntax/tests/printer/expr/expected/jsx.res.txt +++ b/res_syntax/tests/printer/expr/expected/jsx.res.txt @@ -410,3 +410,10 @@ let v = let x = + +// https://github.com/rescript-lang/rescript-compiler/issues/6002 +let x = props => + diff --git a/res_syntax/tests/printer/expr/jsx.res b/res_syntax/tests/printer/expr/jsx.res index 4b96f6c922..95a7e14ce1 100644 --- a/res_syntax/tests/printer/expr/jsx.res +++ b/res_syntax/tests/printer/expr/jsx.res @@ -402,4 +402,11 @@ let v = -let x = \ No newline at end of file +let x = + +// https://github.com/rescript-lang/rescript-compiler/issues/6002 +let x = props => + \ No newline at end of file