
#13266: Source locations from signature merging/matching are bad -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 (Type checker) | Keywords: backpack | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Example output: {{{ /tmp/ghc3555_0/ghc_7.hscpp:1:1: error: No instance for (GHC.Enum.Enum t) arising when attempting to show that instance [safe] MonadHold t (PushM t) -- Defined in ‘z-reflex-z-common-0.5.0:Reflex.NewPure’ is provided by ‘z-reflex-z-common-0.5.0:Reflex.NewPure’ Possible fix: add (GHC.Enum.Enum t) to the context of the instance declaration | 1 | # 1 "indef/Reflex/Sig.hsig" }}} Unfortunately, this is not so easy to fix. Ordinarily, type errors occur while we are checking the source file in question, so we have plenty of SrcSpans from the parsed syntax tree to attach error to good source locations. However, a signature merge works differently: in general, we will have some interface files from our dependencies which we would like to merge together. If there is an incompatibility, there is NO local source declaration that we can get a SrcSpan for. So, what should we report in this case? One possibility is that we want to report the location of the source file *that produced the interface file.* But that would involve saving file paths in interface files, which seems quite distasteful to me, especially since the source location might be in a temporary directory, in which case you just broke determinism. So... I am not sure what to do here! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13266 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler