#984: Syntax error shows in the wrong position
----------------------------------+-----------------------------------------
    Reporter:  guest              |       Owner:                      
        Type:  bug                |      Status:  new                 
    Priority:  normal             |   Milestone:                      
   Component:  Compiler (Parser)  |     Version:  6.4.2               
    Severity:  normal             |    Keywords:  syntax parse case do
  Difficulty:  Unknown            |    Testcase:                      
Architecture:  x86                |          Os:  Linux               
----------------------------------+-----------------------------------------
This bug concerns the behaviour of GHC on erroneous programs. GHC
 recognizes the illegal syntax, but shows an unrelated error.

 This problem is best illustrated in the following code:
 {{{
 f _ = do
         x <- computation
         case () of
                 _ ->
                         result <- computation
                         case () of () -> undefined
 }}}

 The error in this code is the missing "do" keyword on line 5, and the
 compiler should suspect this when seeing the "<-" on line 6.
 However, GHC gives the following error:
   bug.hs:3:8: Parse error in pattern

 This is misleading, since the line number is incorrect, and the syntax
 error (as well is line 3) is unrelated to patterns.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/984>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to