reasonml / reasonml/reason

Underscore application with infix operator produces invalid syntax with refmt

Open
#2,492 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

let divBy2 = (/)(_, 2);

After running refmt:

let divBy2 = _ / 2;

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

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

Start by reproducing the example with refmt, using the Reason playground link and the let divBy2 = (/)(_, 2); input. Trace how refmt formats an underscore application with an infix operator, then verify that the output remains valid Reason syntax rather than becoming let divBy2 = _ / 2;.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.