reasonml / reasonml/reason

[refmt] Fast-pipe + record + placeholder

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

Nobody has claimed this yet.

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

Description

I faced this issue today: https://cl.ly/58cdf74f7256

Simple case (hit refmt to repro): https://reasonml.github.io/try?rrjsx=true&reason=C4TwDgpgBMULxQN4DMB2AuKAKAzsATgJaoDmANFMcAJTwB8UeRpAvgNwBQANhLAB7wkaTLgqFacBjigBqGZQC0dJsRIB9APbI1Vdhw4BGJVj4A6NFgBEOSxTXVqnIA

Local bug here is that when placeholder is used refmt removes ().

But IMO there's more important issue here: precedence of -> over the . when dot is a record accessor. Since it's not possible to apply anything to record it makes sense to have precedence of . over ->.

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 with the linked Reason Try example and reproduce the behavior by running refmt. Compare the placeholder case with the record-accessor and fast-pipe expression, then verify that refmt preserves the required parentheses and applies the intended dot-over-arrow precedence.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.