reasonml / reasonml/reason

[refmt]: unknown error at "fun%expr" within "switch"

Open
#2,449 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The below snippet causes refmt to say "Unknown error: please file an issue at github.com/facebook/reason":

let foo = () => {
  switch (whatever) {
  | Some(_) =>
    [%expr
    fun
    | Some(_) => ()
    ]
  };
};

It parses fine during build, I get the expected unbound value error:

235 |   switch (whatever) {
                ^^^^^^^^
Error: Unbound value whatever

Reason 3.5.0 @ 8ee1ff66
The OCaml toplevel, version 4.08.1

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 supplied Reason snippet and the refmt entry point, focusing on the [%expr] expression nested inside the switch branch. Run refmt on the reproduction and compare its response with the build parser; done when refmt no longer reports the unknown error for this valid snippet.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.