reasonml / reasonml/reason

JSX syntax error - two self-closing elements with no space between

Open
#2,470 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Parser
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

module A = {
  [@react.component]
  let make = () => {
    <>
      <a/><a/>
    </>;
  }
}

This code gives a syntax error on line 5 - <a/><a/>. If you add whitespace between those elements, it fixes it. I'm seeing other issues similar to this, but they are closed, so I'm not sure if this is just a problem with an older version in the playground.

https://reasonml.github.io/try?rrjsx=true&reason=LYewJgrgNgpgBAQTgXjgbwFBzgbQAIBOMAhgMYAuAdKSMAA4gB2Mj5AulnLOXMMQNbxUACgCUKAHzpO2ADwSZ2OLOIB6CSvWLZ6gNycAvhgNA

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example in the linked Reason playground, first with adjacent self-closing elements and then with whitespace between them. Trace the JSX parsing entry point responsible for the syntax error; done means the shown JSX is accepted without requiring whitespace between the two elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ocaml
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.