-
Notifications
You must be signed in to change notification settings - Fork 456
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
Add @as support for obj ppx #6412
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
725de1b
Support field aliases for obj ppx
DZakh 8ab2fd0
Update changelog
DZakh c5040e2
Format
DZakh f575e0c
Fix ci error
DZakh d66d436
Fixes after review
DZakh 6ef9ca9
Format
DZakh 7382ffc
Update changelog wording
DZakh 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 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 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
37 changes: 27 additions & 10 deletions
37
jscomp/syntax/tests/ppx/react/expected/mangleKeyword.res.txt
This file contains 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 |
---|---|---|
@@ -1,21 +1,38 @@ | ||
@@jsxConfig({version: 3}) | ||
|
||
module C30 = { | ||
@obj external makeProps: (~_open: 'T_open, ~key: string=?, unit) => {"_open": 'T_open} = "" | ||
module C3A0 = { | ||
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. It's not affected in the PR |
||
@obj | ||
external makeProps: ( | ||
~_open: 'T_open, | ||
~_type: string, | ||
~key: string=?, | ||
unit, | ||
) => {"_open": 'T_open, "_type": string} = "" | ||
|
||
@react.component let make = @warning("-16") (~_open) => React.string(_open) | ||
@react.component | ||
let make = | ||
@warning("-16") | ||
(@as("open") ~_open) => @warning("-16") (@as("type") ~_type: string) => React.string(_open) | ||
let make = { | ||
let \"MangleKeyword$C30" = (\"Props": {"_open": 'T_open}) => make(~_open=\"Props"["_open"]) | ||
\"MangleKeyword$C30" | ||
let \"MangleKeyword$C3A0" = (\"Props": {"_open": 'T_open, "_type": string}) => | ||
make(~_type=\"Props"["_type"], ~_open=\"Props"["_open"]) | ||
\"MangleKeyword$C3A0" | ||
} | ||
} | ||
module C31 = { | ||
@obj external makeProps: (~_open: string, ~key: string=?, unit) => {"_open": string} = "" | ||
external make: React.componentLike<{"_open": string}, React.element> = "default" | ||
module C3A1 = { | ||
@obj | ||
external makeProps: ( | ||
~_open: string, | ||
~_type: string, | ||
~key: string=?, | ||
unit, | ||
) => {"_open": string, "_type": string} = "" | ||
external make: @as("open") | ||
React.componentLike<{"_open": string, "_type": string}, React.element> = "default" | ||
} | ||
|
||
let c30 = React.createElement(C30.make, C30.makeProps(~_open="x", ())) | ||
let c31 = React.createElement(C31.make, C31.makeProps(~_open="x", ())) | ||
let c3a0 = React.createElement(C3A0.make, C3A0.makeProps(~_open="x", ~_type="t", ())) | ||
let c3a1 = React.createElement(C3A1.make, C3A1.makeProps(~_open="x", ~_type="t", ())) | ||
|
||
@@jsxConfig({version: 4, mode: "classic"}) | ||
|
||
|
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
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.
Separate from this PR, but these errors would be good to clean up too at some point.