[refmt] Odd reformatting for side-effectful function and comment
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
Input
{
f(i);
/* some comment here */
}
This is the smallest input I've seen replicate the behavior. I originally found this in a for loop.
Expected Output
The { } seem redundant, so I'd expect refmt to just remove them.
f(i);
/* some comment here */
Actual Output
f(
i,
/* some comment here */
);
Instead it seems to try to call f with more than a single parameter, which at first sight looks like it should be an error. From utop
utop # let f x = x;;
val f : 'a -> 'a = <fun>
utop # f(1,);;
Error: Syntax error: operator expected.
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
Start by reproducing the smallest case with refmt using the Reason input shown, then compare its output with the expected standalone statements. Trace the formatter path responsible for comments inside a block or for-loop and verify that the result preserves the comment without turning it into an extra function argument.
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
- 38/100