[GHC] #12483: Improve parse error message on indentation mistake

#12483: Improve parse error message on indentation mistake -------------------------------------+------------------------------------- Reporter: harendra | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider the following code fragment: {{{#!hs (ExecGhc, args) -> execCompiler "" args -- NOTE: this won't currently work for GHCJS, because it doesn't have -- a runghcjs binary. It probably will someday, though. (ExecRunGhc, args) -> }}} The last line is indented by one space but it is hard to notice esp when we looking at this along with a screenful of code and there are many comments between the two lines. When this code is compiled ghc throws the following error: {{{ Main.hs:745:40: error: parse error on input ‘->’ }}} I look at the error and then the code and wonder what is wrong with this code, there is nothing noticeably wrong. If ghc can provide some context I can easily make out where the problem is. ghc can perhaps tell me how the current expression is being parsed e.g. `(ExecRunGhc, args) ->` is being considered as a continuation of the expression on the previous line. I have run into this many times. The first time it was really frustrating. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12483 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12483: Improve parse error message on indentation mistake -------------------------------------+------------------------------------- Reporter: harendra | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * failure: Other => Incorrect warning at compile-time * type: bug => feature request Comment: Indeed these are frustratingly poor errors. I remember encountering this exact thing when I was learning the language. Improving this would require that someone take some time to think about how you can robustly catch this issue in the parser without introducing too much complexity. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12483#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC