reasonml / reasonml/reason

Incorrect message about unbalanced parentheses in BS7

Open
#2,514 1 comment 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

moved from https://github.com/BuckleScript/bucklescript/issues/4030
This code:

/* 
   Error is adding names to the parameters of the predicate function;
   ReasonML tells me that parentheses are not closed.
*/
let indexOf = (lookFor: 'a, predicate: (toFind: 'a, item: 'a) => bool, arr: array('a)): option(int) => {
  Some(0);
}

produces this error message:

bad_error> bsb -make-world
[2/4] Building src/Demo.reast
FAILED: src/Demo.reast 
/home/david/.nvm/versions/node/v12.13.1/lib/node_modules/bs-platform/lib/bsc.exe  -w -30-40+6+7+27+32..39+44+45+101 -warn-error +101 -color always  -o src/Demo.reast -bs-syntax-only -bs-binary-ast /home/david/reasonlab/bad_error/src/Demo.re
File "/home/david/reasonlab/bad_error/src/Demo.re", line 5, characters 46-47:
Error: Unclosed "(" (opened line 5, column 39)

  We've found a bug for you!
  /home/david/reasonlab/bad_error/src/Demo.re
  
  There's been an error running Reason's parser on a file.
  The error location should be slightly above this message.
  Please file an issue on github.com/facebook/reason. Thanks!
  
FAILED: subcommand failed.

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

Reproduce the diagnostic using the shown input in src/Demo.re and run bsb -make-world. Trace the Reason parser and diagnostic path responsible for the reported unclosed parenthesis. Done means this valid parameter syntax no longer produces a misleading unbalanced-parentheses message.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.