-
Notifications
You must be signed in to change notification settings - Fork 477
Pass existing location to children prop #7540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
41580b0
e2f9c7a
747e4c5
cd4e819
3fc4841
e90cb2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,21 +23,6 @@ | |
| addValueReference ComponentAsProp.res:12:24 --> ComponentAsProp.res:12:13 | ||
| addValueReference ComponentAsProp.res:13:16 --> React.res:3:0 | ||
| addValueReference ComponentAsProp.res:11:14 --> ComponentAsProp.res:6:34 | ||
| addValueReference ComponentAsProp.res:9:6 --> ComponentAsProp.res:6:12 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zth, any thoughts on whether this is problematic or not? |
||
| addValueReference ComponentAsProp.res:10:6 --> ComponentAsProp.res:6:20 | ||
| addValueReference ComponentAsProp.res:12:24 --> ComponentAsProp.res:12:13 | ||
| addValueReference ComponentAsProp.res:13:16 --> React.res:3:0 | ||
| addValueReference ComponentAsProp.res:11:14 --> ComponentAsProp.res:6:34 | ||
| addValueReference ComponentAsProp.res:9:6 --> ComponentAsProp.res:6:12 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few more of these missing - perhaps another exp apply with loc?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cristianoc, I'm not entirely sure how this works, but since Or do you think we should aim for no changes in this file? Does it matter?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh removing duplications is pretty likely OK. If that's all there is, I think we can safely push on. |
||
| addValueReference ComponentAsProp.res:10:6 --> ComponentAsProp.res:6:20 | ||
| addValueReference ComponentAsProp.res:12:24 --> ComponentAsProp.res:12:13 | ||
| addValueReference ComponentAsProp.res:13:16 --> React.res:3:0 | ||
| addValueReference ComponentAsProp.res:11:14 --> ComponentAsProp.res:6:34 | ||
| addValueReference ComponentAsProp.res:9:6 --> ComponentAsProp.res:6:12 | ||
| addValueReference ComponentAsProp.res:10:6 --> ComponentAsProp.res:6:20 | ||
| addValueReference ComponentAsProp.res:12:24 --> ComponentAsProp.res:12:13 | ||
| addValueReference ComponentAsProp.res:13:16 --> React.res:3:0 | ||
| addValueReference ComponentAsProp.res:11:14 --> ComponentAsProp.res:6:34 | ||
| addTypeReference _none_:1:-1 --> ComponentAsProp.res:6:12 | ||
| addTypeReference _none_:1:-1 --> ComponentAsProp.res:6:20 | ||
| addTypeReference _none_:1:-1 --> ComponentAsProp.res:6:34 | ||
|
|
@@ -422,52 +407,17 @@ | |
| addValueReference Hooks.res:10:29 --> Hooks.res:4:12 | ||
| addValueReference Hooks.res:10:75 --> Hooks.res:5:7 | ||
| addValueReference Hooks.res:9:7 --> React.res:7:0 | ||
| addTypeReference Hooks.res:10:29 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:10:29 --> Hooks.res:4:12 | ||
| addValueReference Hooks.res:10:75 --> Hooks.res:5:7 | ||
| addValueReference Hooks.res:9:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:13:54 --> React.res:7:0 | ||
| addValueReference Hooks.res:13:54 --> React.res:7:0 | ||
| addValueReference Hooks.res:13:40 --> Hooks.res:5:7 | ||
| addValueReference Hooks.res:13:26 --> Hooks.res:5:14 | ||
| addValueReference Hooks.res:14:5 --> ImportHooks.res:13:0 | ||
| addValueReference Hooks.res:15:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:15:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:15:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:15:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:14:76 --> Hooks.res:14:57 | ||
| addValueReference Hooks.res:14:63 --> React.res:7:0 | ||
| addValueReference Hooks.res:17:5 --> ImportHookDefault.res:6:0 | ||
| addValueReference Hooks.res:19:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:19:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:19:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:19:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:18:74 --> Hooks.res:18:55 | ||
| addValueReference Hooks.res:18:61 --> React.res:7:0 | ||
| addTypeReference Hooks.res:10:29 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:10:29 --> Hooks.res:4:12 | ||
| addValueReference Hooks.res:10:75 --> Hooks.res:5:7 | ||
| addValueReference Hooks.res:9:7 --> React.res:7:0 | ||
| addTypeReference Hooks.res:10:29 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:10:29 --> Hooks.res:4:12 | ||
| addValueReference Hooks.res:10:75 --> Hooks.res:5:7 | ||
| addValueReference Hooks.res:9:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:13:54 --> React.res:7:0 | ||
| addValueReference Hooks.res:13:54 --> React.res:7:0 | ||
| addValueReference Hooks.res:13:40 --> Hooks.res:5:7 | ||
| addValueReference Hooks.res:13:26 --> Hooks.res:5:14 | ||
| addValueReference Hooks.res:14:5 --> ImportHooks.res:13:0 | ||
| addValueReference Hooks.res:15:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:15:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:15:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:15:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:14:76 --> Hooks.res:14:57 | ||
| addValueReference Hooks.res:14:63 --> React.res:7:0 | ||
| addValueReference Hooks.res:17:5 --> ImportHookDefault.res:6:0 | ||
| addValueReference Hooks.res:19:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:19:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:19:7 --> React.res:7:0 | ||
| addValueReference Hooks.res:19:32 --> React.res:7:0 | ||
| addValueReference Hooks.res:18:74 --> Hooks.res:18:55 | ||
| addValueReference Hooks.res:18:61 --> React.res:7:0 | ||
| addTypeReference _none_:1:-1 --> Hooks.res:4:12 | ||
|
|
@@ -478,21 +428,14 @@ | |
| addTypeReference Hooks.res:29:66 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:29:66 --> Hooks.res:29:14 | ||
| addValueReference Hooks.res:29:34 --> React.res:7:0 | ||
| addTypeReference Hooks.res:29:66 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:29:66 --> Hooks.res:29:14 | ||
| addValueReference Hooks.res:29:34 --> React.res:7:0 | ||
| addTypeReference _none_:1:-1 --> Hooks.res:29:14 | ||
| addRecordLabelDeclaration vehicle Hooks.res:33:16 path:+Hooks.Inner.Inner2.props | ||
| addRecordLabelDeclaration vehicle Hooks.res:33:16 path:+Hooks.Inner.Inner2.props | ||
| addTypeReference Hooks.res:33:68 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:33:68 --> Hooks.res:33:16 | ||
| addValueReference Hooks.res:33:36 --> React.res:7:0 | ||
| addTypeReference Hooks.res:33:68 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:33:68 --> Hooks.res:33:16 | ||
| addValueReference Hooks.res:33:36 --> React.res:7:0 | ||
| addTypeReference _none_:1:-1 --> Hooks.res:33:16 | ||
| addValueReference Hooks.res:39:25 --> React.res:3:0 | ||
| addValueReference Hooks.res:39:25 --> React.res:3:0 | ||
| addTypeReference Hooks.res:47:2 --> Hooks.res:1:16 | ||
| addValueReference Hooks.res:45:4 --> Hooks.res:45:31 | ||
| addTypeReference Hooks.res:47:14 --> Hooks.res:1:16 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
|
|
||
| [1;31mWe've found a bug for you![0m | ||
| [36m/.../fixtures/missing_required_prop.res[0m:[2m28:7-37[0m | ||
|
|
||
| 26 [2m┆[0m let make = () => { | ||
| 27 [2m┆[0m <Wrapper> | ||
| [1;31m28[0m [2m┆[0m [1;31m<div> {""->React.string} </div>[0m | ||
| 29 [2m┆[0m </Wrapper> | ||
| 30 [2m┆[0m } | ||
|
|
||
| This JSX component does not accept child elements. It has no [1;31mchildren[0m prop [1;33m<Wrapper />[0m |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
|
|
||
| [1;31mWe've found a bug for you![0m | ||
| [36m/.../fixtures/missing_required_prop_when_children.res[0m:[2m31:7-32:37[0m | ||
|
|
||
| 29 [2m┆[0m let make = () => { | ||
| 30 [2m┆[0m <Wrapper> | ||
| [1;31m31[0m [2m┆[0m [1;31m<button> {"yo"->React.string} </button>[0m | ||
| [1;31m32[0m [2m┆[0m [1;31m <div> {""->React.string} </div>[0m | ||
| 33 [2m┆[0m </Wrapper> | ||
| 34 [2m┆[0m } | ||
|
|
||
| The component [1;33m<Wrapper />[0m is missing these required props: | ||
| value |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
| [1;31mWe've found a bug for you![0m | ||
| [36m/.../fixtures/missing_required_prop_when_single_child.res[0m:[2m28:7-37[0m | ||
|
|
||
| 26 [2m┆[0m let make = () => { | ||
| 27 [2m┆[0m <Wrapper> | ||
| [1;31m28[0m [2m┆[0m [1;31m<div> {""->React.string} </div>[0m | ||
| 29 [2m┆[0m </Wrapper> | ||
| 30 [2m┆[0m } | ||
|
|
||
| The component [1;33m<Wrapper />[0m is missing these required props: | ||
| value |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| module React = { | ||
| type element = Jsx.element | ||
| @val external null: element = "null" | ||
| type componentLike<'props, 'return> = Jsx.componentLike<'props, 'return> | ||
| type component<'props> = Jsx.component<'props> | ||
| external component: componentLike<'props, element> => component<'props> = "%identity" | ||
| @module("react/jsx-runtime") | ||
| external jsx: (component<'props>, 'props) => element = "jsx" | ||
| external string: string => element = "%identity" | ||
| } | ||
| module ReactDOM = { | ||
| external someElement: React.element => option<React.element> = "%identity" | ||
| @module("react/jsx-runtime") | ||
| external jsx: (string, JsxDOM.domProps) => Jsx.element = "jsx" | ||
| } | ||
|
|
||
| module Wrapper = { | ||
| @react.component | ||
| let make = (~value: 'value) => { | ||
| <div> {React.null} </div> | ||
| } | ||
| } | ||
|
|
||
| module SomeComponent = { | ||
| @react.component | ||
| let make = () => { | ||
| <Wrapper> | ||
| <div> {""->React.string} </div> | ||
| </Wrapper> | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| module React = { | ||
| type element = Jsx.element | ||
| @val external null: element = "null" | ||
| type componentLike<'props, 'return> = Jsx.componentLike<'props, 'return> | ||
| type component<'props> = Jsx.component<'props> | ||
| external component: componentLike<'props, element> => component<'props> = "%identity" | ||
| @module("react/jsx-runtime") | ||
| external jsx: (component<'props>, 'props) => element = "jsx" | ||
| @module("react/jsx-runtime") | ||
| external jsxs: (component<'props>, 'props) => element = "jsxs" | ||
| external string: string => element = "%identity" | ||
| external array: array<element> => element = "%identity" | ||
| } | ||
| module ReactDOM = { | ||
| external someElement: React.element => option<React.element> = "%identity" | ||
| @module("react/jsx-runtime") | ||
| external jsx: (string, JsxDOM.domProps) => Jsx.element = "jsx" | ||
| } | ||
|
|
||
| module Wrapper = { | ||
| @react.component | ||
| let make = (~value: 'value, ~children: React.element) => { | ||
| <div> {children} </div> | ||
| } | ||
| } | ||
|
|
||
| module SomeComponent = { | ||
| @react.component | ||
| let make = () => { | ||
| <Wrapper> | ||
| <button> {"yo"->React.string} </button> | ||
| <div> {""->React.string} </div> | ||
| </Wrapper> | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| module React = { | ||
| type element = Jsx.element | ||
| @val external null: element = "null" | ||
| type componentLike<'props, 'return> = Jsx.componentLike<'props, 'return> | ||
| type component<'props> = Jsx.component<'props> | ||
| external component: componentLike<'props, element> => component<'props> = "%identity" | ||
| @module("react/jsx-runtime") | ||
| external jsx: (component<'props>, 'props) => element = "jsx" | ||
| external string: string => element = "%identity" | ||
| } | ||
| module ReactDOM = { | ||
| external someElement: React.element => option<React.element> = "%identity" | ||
| @module("react/jsx-runtime") | ||
| external jsx: (string, JsxDOM.domProps) => Jsx.element = "jsx" | ||
| } | ||
|
|
||
| module Wrapper = { | ||
| @react.component | ||
| let make = (~value: 'value, ~children: React.element) => { | ||
| <div> {children} </div> | ||
| } | ||
| } | ||
|
|
||
| module SomeComponent = { | ||
| @react.component | ||
| let make = () => { | ||
| <Wrapper> | ||
| <div> {""->React.string} </div> | ||
| </Wrapper> | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this change is responsible for the changes in the dead code analysis. But this change does not seem necessary to fix the location issue in error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have an explanation as to why this would happen. More non-dummy locations should lead to more value dependencies found in the dead code analysis, which just traverses the typed ast.
Unless, somehow, this change affects the locations produced during type inference.