reasonml / reasonml/reason

better error message for empty string in objects

Open
#2,387 4 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

Moved from https://github.com/BuckleScript/bucklescript/issues/3494

It would be nice that reason do some sanity check in the first place.

Defining a Js.t object such as let obj = {"": someValue}; throws the following for me:

Fatal error: exception File "lam_methname.ml", line 135, characters 2-8: Assertion failed
File "", line 1:
Error: Error while running external preprocessor

I encountered the problem while trying to define an xstate transient transition which gives special meaning to the empty string key.

Side note: Putting the Js.t example above on the "Try Reason" website currently causes the site to completely crash.

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 empty-string Js.t object example and inspect lam_methname.ml around line 135, where the assertion failure is reported. Confirm that the example produces a useful error instead of an assertion or external-preprocessor failure, and check that the Try Reason website no longer crashes on it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ocaml
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.