reasonml / reasonml/reason

Error formatting: weird indentation on complex type error

Open
#2,281 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

(Following this thread https://twitter.com/MoOx/status/1068970511173074944)

I would like to report something that would need to be improved to help complex types debugging

When playing with graphql (with graphql_ppx), we end up having generated types. If we make a mistake when using graphql response, we will have error that might produce errors with a very unusual formatting

dtw_auexgaalbl3 jpg-large

I think the situation should be improved by offernig a more simple indentation, or even better a diff (with colors/font-weight!). Diff would make sense if type to output is more than one line I guess.

Repro

git clone https://github.com/MoOx/dame.bio
cd dame.bio
git checkout issue-reason-error-formatting
yarn

yarn prepare step should trigger a bs compilation and should output the error.

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

Clone the linked dame.bio reproduction, check out issue-reason-error-formatting, install dependencies, and run yarn prepare to reproduce the formatting. Then trace the compiler path that produces the complex type error; done means the reproduced error has clearer indentation or comparison formatting, with updated coverage for the output.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, 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.