diff --git a/CHANGELOG.md b/CHANGELOG.md index 37259ab9..b0badee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ - Fix parsing of spread props as an expression in JSX V4 https://github.com/rescript-lang/syntax/pull/721 - Fix dropping attributes from props in make function in JSX V4 https://github.com/rescript-lang/syntax/pull/723 - Fix an issue where error messages related to duplicate props were displayed without a loc and were unclear https://github.com/rescript-lang/syntax/pull/728 +- Fix issue where error messages related to non-existent props were displayed without location information https://github.com/rescript-lang/syntax/pull/730 #### :eyeglasses: Spec Compliance diff --git a/cli/reactjs_jsx_v4.ml b/cli/reactjs_jsx_v4.ml index 86568143..1ff40cc3 100644 --- a/cli/reactjs_jsx_v4.ml +++ b/cli/reactjs_jsx_v4.ml @@ -437,11 +437,12 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc ( Exp.ident {loc = Location.none; txt = Ldot (Lident "React", "jsxs")}, [] ) in - Exp.apply ~attrs jsxExpr ([(nolabel, makeID); (nolabel, props)] @ keyAndUnit) + Exp.apply ~loc:jsxExprLoc ~attrs jsxExpr + ([(nolabel, makeID); (nolabel, props)] @ keyAndUnit) | _ -> ( match (!childrenArg, keyProp) with | None, key :: _ -> - Exp.apply ~attrs + Exp.apply ~loc:jsxExprLoc ~attrs (Exp.ident { loc = Location.none; @@ -449,12 +450,12 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc }) [key; (nolabel, makeID); (nolabel, props)] | None, [] -> - Exp.apply ~attrs + Exp.apply ~loc:jsxExprLoc ~attrs (Exp.ident {loc = Location.none; txt = Ldot (Lident "React", "createElement")}) [(nolabel, makeID); (nolabel, props)] | Some children, key :: _ -> - Exp.apply ~attrs + Exp.apply ~loc:jsxExprLoc ~attrs (Exp.ident { loc = Location.none; @@ -463,7 +464,7 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc }) [key; (nolabel, makeID); (nolabel, props); (nolabel, children)] | Some children, [] -> - Exp.apply ~attrs + Exp.apply ~loc:jsxExprLoc ~attrs (Exp.ident { loc = Location.none; @@ -544,7 +545,7 @@ let transformLowercaseCall3 ~config mapper jsxExprLoc callExprLoc attrs ( Exp.ident {loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsxs")}, [] ) in - Exp.apply ~attrs jsxExpr + Exp.apply ~loc:jsxExprLoc ~attrs jsxExpr ([(nolabel, componentNameExpr); (nolabel, props)] @ keyAndUnit) | _ -> let children, nonChildrenProps = diff --git a/tests/ppx/react/expected/forwardRef.res.txt b/tests/ppx/react/expected/forwardRef.res.txt index 45703e47..cb7b143f 100644 --- a/tests/ppx/react/expected/forwardRef.res.txt +++ b/tests/ppx/react/expected/forwardRef.res.txt @@ -166,6 +166,7 @@ module V4A = { @react.component let make = (_: props) => { let input = React.useRef(Js.Nullable.null) + ReactDOM.jsx( "div", {