Error message carets point at the wrong places in the presence of CPP macros
Here's a program which doesn't typecheck:
{-# LANGUAGE CPP #-}
module Bug where
#define FOO putStrLn 4
main :: IO ()
main = FOO
The error message it gives looks kind of strange, however:
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/ryanglscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:7:17: error:
• No instance for (Num String) arising from the literal ‘4’
• In the first argument of ‘putStrLn’, namely ‘4’
In the expression: putStrLn 4
In an equation for ‘main’: main = putStrLn 4
|
7 | main = FOO
| ^
That caret seems to be pointing as if FOO had been replaced by putStrLn 4 in the diagnostic, but since it hadn't, it just points off into space.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.2.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | Rufflewind |
| Operating system | |
| Architecture |