roc icon indicating copy to clipboard operation
roc copied to clipboard

Improve parser error message when there is a missing comma in record

Open Anton-4 opened this issue 4 years ago • 2 comments

Note the missing comma in the definition of foo. Put it back in => no Panic

app "panic"
    packages { base: "platform" }
    imports [base.Task]
    provides [ main ] to base

main : Task.Task {} []
main =

    foo = {a: 1 b: 2}


    foo.a + foo.b |>  Str.fromInt |>
       Task.putLine

Found by @jxxcarlson, thanks Jim!

Anton-4 avatar Aug 15 '21 09:08 Anton-4

No more panic, but the error could be better:

» main =
…
…     foo = {a: 1 b: 2}
…
…
…     foo.a + foo.b

── RECORD PARSE PROBLEM ────────────────────────────────────────────────────────

I am partway through parsing an record, but I got stuck here:

1│  app "app" provides [replOutput] to "./platform"
2│
3│  replOutput =
4│      main =
5│
6│          foo = {a: 1 b: 2}
                  ^

TODO provide more context.

ayazhafiz avatar Aug 17 '22 22:08 ayazhafiz

Still relevant

isaacvando avatar Dec 08 '24 02:12 isaacvando