Opened 3 months ago
Source locations from signature merging/matching are bad
|Reported by:||ezyang||Owned by:|
|Component:||Compiler (Type checker)||Version:||8.1|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
/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!