Syntax error shows in the wrong position
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.4.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Parser) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Linux |
Architecture | x86 |