[GHC] #13388: Caret diagnostics interact badly with hsc2hs

GHC ghc-devs at haskell.org
Wed Mar 8 00:56:20 UTC 2017


#13388: Caret diagnostics interact badly with hsc2hs
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Rufflewind):

 Hm, it seems hsc2hs does not propagate column numbers from the original
 source file.

 One could add spaces as necessary to push tokens to the correct location:

 {{{
 lONG_CONSTANT_NAME = 42                          :: Int32
 }}}

 If the replaced token is longer then it could be worked around as:

 {{{
 lONG_CONSTANT_NAME = someVeryVeryVeryVeryVeryLongConstant
 {-# LINE 5 "Bug.hsc" #-}
                                                  :: Int32
 }}}

 But this might be risky because Haskell is indentation sensitive, so
 perhaps the simpler approach is to teach GHC a more precise `LINE` pragma:

 {{{
 {-# LINE 5 "Bug.hsc" 57 49 #-}
 lONG_CONSTANT_NAME = someVeryVeryVeryVeryVeryLongConstant :: Int32
 }}}

 The syntax of this new pragma could be something like:

 {{{
 {-# LINE <line> <name> <oldCol1> <newCol1> <oldCol2> <newCol2> ... #-}
 }}}

 This can be used to adjust column numbers.

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


More information about the ghc-tickets mailing list