gren-lang / gren-lang/compiler

Unhelpful error message for case/of

Open
#277 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
503
Forks
29
PR merge metrics
No merged PRs in 30d

Description

If you use the outdated case/of syntax for a when/is expression, this is the error message:

-- UNEXPECTED ARROW ---------------------------------------------- src/Main.gren

I was partway through parsing an expression when I got stuck on this arrow:

9|         True -> 
                ^^
Arrows should only appear in `when` expressions and anonymous functions.
Maybe it was supposed to be a > sign instead?

Note: The syntax for anonymous functions is (\x -> x + 1) so the arguments all
appear after the backslash and before the arrow. Maybe a backslash is missing
earlier?

Seems like something we should explicitly check for. "Looks like you're using outdated syntax..." or something.

Contributor guide

Open the contributing guide

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

The issue names no files or tests. Start by locating the parser diagnostic that reports the unexpected arrow for outdated case/of syntax, then add regression coverage using the shown input; done means the diagnostic explicitly identifies the outdated syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
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.