reasonml / reason

Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
http://reasonml.github.io
MIT License
10.14k stars 428 forks source link

Fix #2591 - non-nil terminated literals spread as children preoperty #2617

Closed jordwalke closed 4 years ago

jordwalke commented 4 years ago

This refactors jsx child printing logic and makes it more correct.

The only regression in this diff right now is that it preserves braces when you explicitly requested them but didn't need to. That's not a terrible regression, but I don't understand why it's happening so I would want to fix that before landing.

Also need to add test cases before landing:

echo "
<head>
  ...{[title, ...other_elements]}
</head>" | esy x refmt

Output:

<head> ...{[title, ...other_elements]} </head>;

edit: Added test cases and better understood/fixed odd behavior.