Skip to content

Commit ac50f94

Browse files
Copilottsnobip
andcommitted
Wrap variables in braces inside JSX children
Co-authored-by: tsnobip <2479216+tsnobip@users.noreply.github.com>
1 parent ebd78e7 commit ac50f94

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

compiler/syntax/src/res_parens.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ let jsx_child_expr expr =
373373
| _ when ParsetreeViewer.expr_is_await expr -> Parenthesized
374374
| {
375375
Parsetree.pexp_desc =
376-
( Pexp_ident _ | Pexp_constant _ | Pexp_field _ | Pexp_construct _
376+
( Pexp_constant _ | Pexp_field _ | Pexp_construct _
377377
| Pexp_variant _ | Pexp_array _ | Pexp_pack _ | Pexp_record _
378378
| Pexp_extension _ | Pexp_letmodule _ | Pexp_letexception _
379379
| Pexp_open _ | Pexp_sequence _ | Pexp_let _ | Pexp_jsx_element _ );

tests/syntax_tests/data/printer/comments/expected/jsx.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Cite = {
33
let make = (~author: option<string>, ~children) => {
44
// For semantics, check out
55
// https://css-tricks.com/quoting-in-html-quotations-citations-and-blockquotes/
6-
<div> foo </div>
6+
<div> {foo} </div>
77
}
88
}
99

tests/syntax_tests/data/printer/expr/expected/braced.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ apply({
282282
a
283283
})
284284

285-
let x = {<div> child </div>}
285+
let x = {<div> {child} </div>}
286286

287287
// not valid jsx
288288
let x = {@JSX child}

tests/syntax_tests/data/printer/expr/expected/jsx.res.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ let x =
209209

210210
let x =
211211
<div>
212-
ident
212+
{ident}
213213
"constant"
214214
{
215215
let a = 1
@@ -558,14 +558,14 @@ let fragmented_moo =
558558

559559
let arrow_with_fragment = el => <>
560560
{t(nbsp ++ "(")}
561-
el
561+
{el}
562562
{t(")")}
563563
</>
564564

565565
let arrow_with_container_tag = el =>
566566
<div>
567567
{t(nbsp ++ "(")}
568-
el
568+
{el}
569569
{t(")")}
570570
</div>
571571

tests/syntax_tests/data/printer/other/expected/fatSlider.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let make = (~min=50, ~max=250, ~meterSuffix=?) => {
3434
values
3535
onChange={v => values_set(_ => v)}
3636
renderTrack={({props, children}) => {
37-
let element = <div className="h-16" style=props.style> children </div>
37+
let element = <div className="h-16" style=props.style> {children} </div>
3838

3939
ReasonReact.cloneElement(element, ~props=Obj.magic(props), [children])
4040
}}

0 commit comments

Comments
 (0)