[refmt]: Operators precedence is not respected on line breaks
Open
Nobody has claimed this yet.
KIND: BUG
Parser
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
/* Actual */
let isWithinWithOffset = (point: Point.t, rect: Rect.t, offset: Offset.t) =>
point.x >= rect.left
- offset.left
&& point.x <= rect.right
+ offset.right
&& point.y >= rect.top
- offset.top
&& point.y <= rect.bottom
+ offset.bottom;
/* Expected */
let isWithinWithOffset = (point: Point.t, rect: Rect.t, offset: Offset.t) =>
point.x >= rect.left - offset.left
&& point.x <= rect.right + offset.right
&& point.y >= rect.top - offset.top
&& point.y <= rect.bottom + offset.bottom;
If I try to prevent line break by wrapping (rect.left - offset.left), refmt removes ().
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied Reason example with refmt and locate the formatting logic that handles operator precedence across line breaks. Compare the actual and expected output, including the behavior when parentheses are added; done means refmt preserves the intended arithmetic grouping and produces the expected formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100