From dc372cec4f388f483829d79d2efc2d328766aa04 Mon Sep 17 00:00:00 2001 From: "Zhang, Zheyu" Date: Tue, 14 Feb 2023 12:09:39 +0800 Subject: [PATCH 1/3] fix formatting of jsx spread props --- res_syntax/src/res_printer.ml | 2 +- res_syntax/tests/printer/expr/expected/jsx.res.txt | 6 ++++++ res_syntax/tests/printer/expr/jsx.res | 8 +++++++- 3 files changed, 14 insertions(+), 2 deletions(-) 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..468bd262df 100644 --- a/res_syntax/tests/printer/expr/expected/jsx.res.txt +++ b/res_syntax/tests/printer/expr/expected/jsx.res.txt @@ -410,3 +410,9 @@ 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..862d8e3e6d 100644 --- a/res_syntax/tests/printer/expr/jsx.res +++ b/res_syntax/tests/printer/expr/jsx.res @@ -402,4 +402,10 @@ 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 From 7475e9a6a0c1d3247fc9bd13e04007af58bff7d4 Mon Sep 17 00:00:00 2001 From: "Zhang, Zheyu" Date: Tue, 14 Feb 2023 14:52:27 +0800 Subject: [PATCH 2/3] format --- res_syntax/tests/printer/expr/expected/jsx.res.txt | 1 + res_syntax/tests/printer/expr/jsx.res | 1 + 2 files changed, 2 insertions(+) diff --git a/res_syntax/tests/printer/expr/expected/jsx.res.txt b/res_syntax/tests/printer/expr/expected/jsx.res.txt index 468bd262df..4b9e5f970e 100644 --- a/res_syntax/tests/printer/expr/expected/jsx.res.txt +++ b/res_syntax/tests/printer/expr/expected/jsx.res.txt @@ -410,6 +410,7 @@ let v = let x = + // https://github.com/rescript-lang/rescript-compiler/issues/6002 let x = props => let x = + // https://github.com/rescript-lang/rescript-compiler/issues/6002 let x = props => Date: Thu, 16 Feb 2023 10:26:34 +0800 Subject: [PATCH 3/3] update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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