[GHC] #4150: CPP+QuasiQuotes confuses compilation errors' line numbers

GHC ghc-devs at haskell.org
Sun Jan 4 23:05:15 UTC 2015


#4150: CPP+QuasiQuotes confuses compilation errors' line numbers
-------------------------------------+-------------------------------------
        Reporter:  yairchu           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  low               |               Milestone:  7.12.1
       Component:  Compiler          |                 Version:  6.12.3
  (Parser)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  Incorrect         |               Test Case:
  warning at compile-time            |  quasiquotation/T4150
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by ezyang):

 So, to fix this, we need to augment the multi-line comment and quasi-quote
 lexing in `Lexer.x` to look for and handle the CPP produced line pragmas
 (as handled currently by the `<bol>` state).  It should be possible,
 though a bit delicate since both of these lexers are hand-rolled.

 While I was reading how this code worked, I realized there is a
 workaround: if you force the line-state to resynchronize, e.g. by
 include'ing a blank file outside of the quasiquote/multiline comment,
 you'll get right light numbers for anything afterwards.

 If you want this in 7.10 (there's not much time left) you can help out by
 cooking up a self-contained, minimal example for quasiquoters which we can
 put in the test suite.

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


More information about the ghc-tickets mailing list