reasonml / reasonml/reason

Outputs [@explicit_arity ] even if using -e flag

Open
#2,389 0 comments 0 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

This could be related to #1437. Using:

> refmt --version
Reason 3.4.1 @ ea3fc2c

running:

> refmt -e -p ml test.re

on test.re:

let map_ident = str =>
  is_kwds(str, extra_kwds) ? Tokens.KEYWORD(str) : Tokens.IDENT(str);

results in:

let map_ident str =
  match is_kwds str extra_kwds with
  | true -> ((Tokens.KEYWORD (str))[@explicit_arity ])
  | false -> ((Tokens.IDENT (str))[@explicit_arity ])

The added ((...) [@explicit_arity]) makes using refmt to generate ocaml code for ocamlc/ocamlopt a no go without post-processing. The result is what I would expect without the -e flag but not with it unless I'm misunderstanding what the -e flag is meant to do.

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 issue with refmt -e -p ml on test.re and compare it with refmt --version and the output without -e. Trace the formatter path responsible for the OCaml output and check the related issue #1437. Done means -e no longer emits the explicit_arity attributes while the generated output remains usable by ocamlc and ocamlopt.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.