[GHC] #15680: Flag for printing absolute paths in diagnostics

GHC ghc-devs at haskell.org
Thu Sep 27 06:32:13 UTC 2018


#15680: Flag for printing absolute paths in diagnostics
-------------------------------------+-------------------------------------
           Reporter:                 |             Owner:  (none)
  quasicomputational                 |
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.6.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Currently, GHC will produce errors and warnings with relative paths
 pointing to the input that caused it.

 This is less than ideal for any tooling consuming these diagnostics,
 because build tools will concurrently build many packages in different
 working directories and interleave the output from multiple GHC
 invocations.

 In particular, this makes using `next-error` in emacs a lot less useful
 than it could be with cabal-install's output.

 [https://github.com/commercialhaskell/stack/blob/0740444175f41e6ea5ed236cd2c53681e4730003/src/Stack/Build/Execute.hs#L1896
 Stack has some rather hackish code to post-process the diagnostics and to
 turn the relative paths absolute.] I can personally report that this makes
 the development process a lot more pleasant!

 I think it'd be much cleaner to have a GHC flag for this at the source.
 `-fabsolute-diagnostic-paths` or something similar, subject to
 bikeshedding.

 I had a look at implementing this myself, and `mkLocMessageAnn` in
 `ErrUtils` would be the locus of the change. However, I can't figure out
 how that function should learn what the current working directory is! Any
 tips? Is that information lurking somewhere in `DynFlags`?

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


More information about the ghc-tickets mailing list