From 96e8bea4eb86cf0425ba1d799d759fe9a6649fd5 Mon Sep 17 00:00:00 2001 From: Woonki Moon Date: Sat, 28 Jan 2023 22:28:59 +0900 Subject: [PATCH 1/4] add missing loc of jsx call expression --- cli/reactjs_jsx_v4.ml | 13 +++++++------ tests/ppx/react/expected/forwardRef.res.txt | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) 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", { From f675683409a138a637bb06d14b826555ec434cf0 Mon Sep 17 00:00:00 2001 From: Woonki Moon Date: Sat, 28 Jan 2023 22:30:42 +0900 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37259ab9..a17db62d 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 +- Fixed an 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 From 5356913d9be0937ecb74f5c0accfd6b9521bd633 Mon Sep 17 00:00:00 2001 From: Woonki Moon Date: Sat, 28 Jan 2023 22:31:24 +0900 Subject: [PATCH 3/4] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a17db62d..297380b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,7 +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 -- Fixed an issue where error messages related to non-existent props were displayed without location information https://github.com/rescript-lang/syntax/pull/730 +- Fix an 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 From 22463151c881a2a2bd092959107e22433038ec4e Mon Sep 17 00:00:00 2001 From: Woonki Moon Date: Sat, 28 Jan 2023 22:32:47 +0900 Subject: [PATCH 4/4] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 297380b2..b0badee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,7 +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 an issue where error messages related to non-existent props were displayed without location information https://github.com/rescript-lang/syntax/pull/730 +- 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