elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 656 forks source link

Malformed record modify `{ key | }` creates EXTRA COMMA error #2181

Open jfine2358 opened 3 years ago

jfine2358 commented 3 years ago

Quick Summary: Malformed record modify { key | } creates EXTRA COMMA error.

SSCCE

$ elm repl
---- Elm 0.19.1 ----------------------------------------------------------------
> { key | }
-- EXTRA COMMA ------------------------------------------------------------ REPL
I am partway through parsing a record, but I got stuck here:
3|   { key | }
             ^
Trailing commas are not allowed in records.

There is no comma, let alone an extra comma. The error message could be improved. (I suspect that allowing { key | } would be contrary to Elm practice.)

Additional Details

I suspect that {key | puts the compiler into a prev_token = Comma state.

github-actions[bot] commented 3 years ago

Thanks for reporting this! To set expectations:

Finally, please be patient with the core team. They are trying their best with limited resources.