Bug: outputs [@explicit_arity] even though it takes a tuple
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
Using refmt --parse re --print ml --interface false, this reason code:
type msg =
| Request (command_msg, option updateOp);
let msgToString = fun
| Request (cmd, _) => "Request\n cmd: " ^ Command.toString cmd;
Converts to this ocaml code:
type msg =
| Request of (command_msg* updateOp option)
let msgToString =
function
| ((Request ((cmd,_)))[@explicit_arity ]) ->
"Request\n cmd: " ^ (Command.toString cmd)
Request is defined as taking a tuple, so [@explicit_arity] should not be present.
I wanted to automatically generate an interface file, but this causes compilation to fail under ocamlc -i with this error message:
Error: The constructor Request expects 1 argument(s),
but is applied here to 2 argument(s)
$ refmt --version
Reason 1.13.7 @ d13c6bd
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 issue with the refmt --parse re --print ml --interface false command and inspect the refmt entry point for Reason-to-OCaml printing. The generated output should not add [@explicit_arity] for this tuple constructor, and the result should compile successfully with ocamlc -i.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100