- 
                Notifications
    
You must be signed in to change notification settings  - Fork 471
 
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 5 commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      41580b0
              
                Pass existing location to children prop
              
              
                nojaf e2f9c7a
              
                No sure about this
              
              
                nojaf 747e4c5
              
                Add changelog entry
              
              
                nojaf cd4e819
              
                Update roundtrip tests
              
              
                nojaf 3fc4841
              
                Revert loc to React.someElement
              
              
                nojaf e90cb2f
              
                Merge branch 'master' into jsx-ast-children-loc
              
              
                nojaf File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
        
          
          
            11 changes: 11 additions & 0 deletions
          
          11 
        
  tests/build_tests/super_errors/expected/missing_required_prop.res.expected
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | 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 | 
        
          
          
            13 changes: 13 additions & 0 deletions
          
          13 
        
  tests/build_tests/super_errors/expected/missing_required_prop_when_children.res.expected
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | 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 | 
        
          
          
            12 changes: 12 additions & 0 deletions
          
          12 
        
  tests/build_tests/super_errors/expected/missing_required_prop_when_single_child.res.expected
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | 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 | 
        
          
          
            31 changes: 31 additions & 0 deletions
          
          31 
        
  tests/build_tests/super_errors/fixtures/missing_required_prop.res
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | 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> | ||
| } | ||
| } | 
        
          
          
            35 changes: 35 additions & 0 deletions
          
          35 
        
  tests/build_tests/super_errors/fixtures/missing_required_prop_when_children.res
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | 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> | ||
| } | ||
| } | 
        
          
          
            31 changes: 31 additions & 0 deletions
          
          31 
        
  tests/build_tests/super_errors/fixtures/missing_required_prop_when_single_child.res
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | 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> | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            21 changes: 3 additions & 18 deletions
          
          21 
        
  tests/syntax_tests/data/ppx/react/expected/fragment.res.txt
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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.
A few more of these missing - perhaps another exp apply with loc?
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.
@cristianoc, I'm not entirely sure how this works, but since
addValueReference ComponentAsProp.res:9:6 --> ComponentAsProp.res:6:12is mentioned a few lines above in this file, could this mean that it's fine and there's no risk of duplication?Or do you think we should aim for no changes in this file? Does it matter?
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.
Oh removing duplications is pretty likely OK. If that's all there is, I think we can safely push on.