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

#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

#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 Resolution: | 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: -------------------------------------+------------------------------------- Comment (by mpickering): Here is the preprocessed source. There is an extra line inserted after the pragma. {{{ {-# LINE 1 "test.hs" #-} # 1 "test.hs" # 1 "<built-in>" 1 # 16 "<built-in>" # 1 "/Users/matt/Downloads/ghc-7.10.1.app/Contents/lib/ghc-7.10.1/include/ghcversion.h" 1 # 17 "<built-in>" 2 # 1 "test.hs" 2 {-# LANGUAGE CPP #-} module Foo where foo :: String foo = True }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10628#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10628: clang's cpp causes incorrect line numbers in type errors -------------------------------------+------------------------------------- Reporter: gridaphobe | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: duplicate | Keywords: cpp Operating System: MacOS X | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #10044 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * keywords: => cpp * status: new => closed * resolution: => duplicate * related: => #10044 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10628#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC