diff --git a/cli/reactjs_jsx_v4.ml b/cli/reactjs_jsx_v4.ml index c2783972..b118406e 100644 --- a/cli/reactjs_jsx_v4.ml +++ b/cli/reactjs_jsx_v4.ml @@ -188,7 +188,7 @@ let recordFromProps ~loc ~removeKey callArguments = let props, propsToSpread = removeLastPositionUnitAux callArguments [] |> List.rev - |> List.partition (fun (label, _) -> label <> labelled "spreadProps") + |> List.partition (fun (label, _) -> label <> labelled "_spreadProps") in let props = if removeKey then diff --git a/src/res_core.ml b/src/res_core.ml index ba0e4d4d..aa2d6318 100644 --- a/src/res_core.ml +++ b/src/res_core.ml @@ -2635,7 +2635,7 @@ and parseJsxProp p = {e with pexp_attributes = propLocAttr :: e.pexp_attributes} in (* using label "spreadProps" to distinguish from others *) - let label = Asttypes.Labelled "spreadProps" in + let label = Asttypes.Labelled "_spreadProps" in match p.Parser.token with | Rbrace -> Parser.next p; diff --git a/src/res_printer.ml b/src/res_printer.ml index 1f4692dc..f12b653e 100644 --- a/src/res_printer.ml +++ b/src/res_printer.ml @@ -4129,6 +4129,9 @@ and printJsxProp ~customLayout arg cmtTbl = | Nolabel -> Doc.nil | Labelled _lbl -> printIdentLike ident | Optional _lbl -> Doc.concat [Doc.question; printIdentLike ident]) + | Asttypes.Labelled "_spreadProps", expr -> + let doc = printExpressionWithComments ~customLayout expr cmtTbl in + Doc.concat [Doc.lbrace; Doc.dotdotdot; Doc.softLine; doc; Doc.rbrace] | lbl, expr -> let argLoc, expr = match expr.pexp_attributes with diff --git a/tests/parsing/grammar/expressions/expected/jsx.res.txt b/tests/parsing/grammar/expressions/expected/jsx.res.txt index e5d8f14c..35ee8be3 100644 --- a/tests/parsing/grammar/expressions/expected/jsx.res.txt +++ b/tests/parsing/grammar/expressions/expected/jsx.res.txt @@ -577,4 +577,8 @@ let _ = ;;(([(((fun a -> 1))[@ns.braces ])])[@JSX ]) ;;(([((span ~children:[] ())[@JSX ])])[@JSX ]) ;;(([[|a|]])[@JSX ]) -;;(([(1, 2)])[@JSX ]) \ No newline at end of file +;;(([(1, 2)])[@JSX ]) +let _ = + ((A.createElement ~x:(({js|y|js})[@ns.namedArgLoc ]) ~_spreadProps:((str) + [@ns.namedArgLoc ]) ~children:[] ()) + [@JSX ]) \ No newline at end of file diff --git a/tests/parsing/grammar/expressions/jsx.res b/tests/parsing/grammar/expressions/jsx.res index 746a6f75..78287c37 100644 --- a/tests/parsing/grammar/expressions/jsx.res +++ b/tests/parsing/grammar/expressions/jsx.res @@ -513,3 +513,5 @@ let _ = <> ... <> ...[a] <> ...(1, 2) + +let _ = \ No newline at end of file diff --git a/tests/printer/expr/expected/jsx.res.txt b/tests/printer/expr/expected/jsx.res.txt index e6b0c00d..bdc104ff 100644 --- a/tests/printer/expr/expected/jsx.res.txt +++ b/tests/printer/expr/expected/jsx.res.txt @@ -408,3 +408,5 @@ let v = }} + +let x = diff --git a/tests/printer/expr/jsx.res b/tests/printer/expr/jsx.res index d3b86ab3..4b96f6c9 100644 --- a/tests/printer/expr/jsx.res +++ b/tests/printer/expr/jsx.res @@ -401,3 +401,5 @@ let v = }} + +let x = \ No newline at end of file