{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/896","labels_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/896/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/896/comments","events_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/896/events","html_url":"https://github.com/elm-lang/elm-compiler/issues/896","id":59091656,"number":896,"title":"Poor error message on parsing incorrect record update syntax","user":{"login":"betaveros","id":3482833,"avatar_url":"https://avatars.githubusercontent.com/u/3482833?v=3","gravatar_id":"","url":"https://api.github.com/users/betaveros","html_url":"https://github.com/betaveros","followers_url":"https://api.github.com/users/betaveros/followers","following_url":"https://api.github.com/users/betaveros/following{/other_user}","gists_url":"https://api.github.com/users/betaveros/gists{/gist_id}","starred_url":"https://api.github.com/users/betaveros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/betaveros/subscriptions","organizations_url":"https://api.github.com/users/betaveros/orgs","repos_url":"https://api.github.com/users/betaveros/repos","events_url":"https://api.github.com/users/betaveros/events{/privacy}","received_events_url":"https://api.github.com/users/betaveros/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-26T15:49:47Z","updated_at":"2015-05-08T00:23:06Z","closed_at":"2015-05-08T00:23:06Z","body":"Code like\r\n\r\n```\r\nbar = { foo | a <- 1, b <- 2, oops, c <- 3, d <- 4 }\r\n```\r\n\r\nfails to parse with the quite confusing error message:\r\n\r\n```\r\nParse error at (line 1, column 13):\r\nunexpected \"|\"\r\nexpecting whitespace, a newline or \"=\"\r\n```\r\n\r\nLooking at the source code I guess this occurs because the parser backtracks to the start of the bracket if it can't parse the whole content as record update syntax ( https://github.com/elm-lang/elm-compiler/blob/69a436680cc7d129ab8ec982a778b007e235c766/src/Parse/Expression.hs#L126 ) and it doesn't look too easy to fix, but I still thought I'd mention it because I spent a painfully long time looking at that error message completely mystified."},"comment":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/comments/100053914","html_url":"https://github.com/elm-lang/elm-compiler/issues/896#issuecomment-100053914","issue_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/896","id":100053914,"user":{"login":"evancz","id":1658058,"avatar_url":"https://avatars.githubusercontent.com/u/1658058?v=3","gravatar_id":"","url":"https://api.github.com/users/evancz","html_url":"https://github.com/evancz","followers_url":"https://api.github.com/users/evancz/followers","following_url":"https://api.github.com/users/evancz/following{/other_user}","gists_url":"https://api.github.com/users/evancz/gists{/gist_id}","starred_url":"https://api.github.com/users/evancz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evancz/subscriptions","organizations_url":"https://api.github.com/users/evancz/orgs","repos_url":"https://api.github.com/users/evancz/repos","events_url":"https://api.github.com/users/evancz/events{/privacy}","received_events_url":"https://api.github.com/users/evancz/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T00:23:06Z","updated_at":"2015-05-08T00:23:06Z","body":"I am revamping the error reporting in the compiler. Right now, we actually point to the part that is messed up:\r\n\r\n```\r\n-- SYNTAX ERROR --------------------------------------- syntax/record-update.elm\r\n\r\nProblem when parsing your code!\r\n\r\n0| \r\n1| bar = { foo | a <- 1, b <- 2, oops, c <- 3, d <- 4 }\r\n2|                                   ^\r\n\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nSysUnExpect: \",\"\r\nUnExpect: \r\nUnExpect: whitespace\r\nUnExpect: a newline\r\nUnExpect: \"<-\"\r\n\r\n```\r\n\r\nI still need to properly display the raw error messages from the parser in a way that works for humans, but the point is that the error message now points to the problematic part, no extreme backtracking!"}}