Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ These are only breaking changes for unformatted code.
#### :bug: Bug Fix

- Prevent inlining of async functions in additional cases https://github.com/rescript-lang/rescript-compiler/issues/5860
- Fix build error where aliasing arguments to `_` in the make function with JSX V4. https://github.com/rescript-lang/rescript-compiler/pull/5881

# 10.1.0

Expand Down
5 changes: 1 addition & 4 deletions res_syntax/src/reactjs_jsx_v4.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1103,10 +1103,7 @@ let transformStructureItem ~config mapper item =
| Pexp_fun
( _arg_label,
_default,
{
ppat_desc =
Ppat_construct ({txt = Lident "()"}, _) | Ppat_any;
},
{ppat_desc = Ppat_construct ({txt = Lident "()"}, _)},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A build error was caused here when meeting Ppat_any stops the loop.

expr ) ->
(patternsWithLabel, patternsWithNolabel, expr)
| Pexp_fun
Expand Down
11 changes: 11 additions & 0 deletions res_syntax/tests/ppx/react/aliasProps.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@@jsxConfig({version: 4, mode: "automatic"})

module C0 = {
@react.component
let make = (~priority as _, ~text="Test") => React.string(text)
}

module C1 = {
@react.component
let make = (~priority as p, ~text="Test") => React.string(p ++ text)
}
45 changes: 45 additions & 0 deletions res_syntax/tests/ppx/react/expected/aliasProps.res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@@jsxConfig({version: 4, mode: "automatic"})

module C0 = {
type props<'priority, 'text> = {
priority: 'priority,
text?: 'text,
}

@react.component
let make = ({priority: _, ?text, _}: props<'priority, 'text>) => {
let text = switch text {
| Some(text) => text
| None => "Test"
}

React.string(text)
}
let make = {
let \"AliasProps$C0" = (props: props<_>) => make(props)

\"AliasProps$C0"
}
}

module C1 = {
type props<'priority, 'text> = {
priority: 'priority,
text?: 'text,
}

@react.component
let make = ({priority: p, ?text, _}: props<'priority, 'text>) => {
let text = switch text {
| Some(text) => text
| None => "Test"
}

React.string(p ++ text)
}
let make = {
let \"AliasProps$C1" = (props: props<_>) => make(props)

\"AliasProps$C1"
}
}