[GHC] #10628: clang's cpp causes incorrect line numbers in type errors

GHC ghc-devs at haskell.org
Fri Jul 10 21:25:14 UTC 2015


#10628: clang's cpp causes incorrect line numbers in type errors
-------------------------------------+-------------------------------------
              Reporter:  gridaphobe  |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  MacOS X
          Architecture:              |   Type of failure:  Incorrect
  Unknown/Multiple                   |  warning at compile-time
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 If I run GHC on

 {{{
 {-# LANGUAGE CPP
   #-}
 module Foo where

 foo :: String
 foo = True
 }}}

 I get an error

 {{{
 Foo.hs:7:7:
     Couldn't match type ‘Bool’ with ‘[Char]’
     Expected type: String
       Actual type: Bool
     In the expression: True
     In an equation for ‘foo’: foo = True
 }}}

 but the type error is on line 6, not line 7. It seems to have something to
 do with the fact that line 2 starts with a `#` since the error is reported
 correctly if I make the language pragma a single line.

 GHC on linux reports the correct location, as does GHC on OS X if I use
 any other language pragma, so I'm pretty sure this is another instance of
 clang's `cpp` causing problems for us.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10628>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list