
#8198: One-shot mode is buggy w.r.t. hs-boot files -------------------------------------------------+------------------------- Reporter: parcs | Owner: parcs Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Driver | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect warning at | Unknown/Multiple compile-time | Difficulty: Test Case: | Unknown Blocking: | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by parcs): Sorry, I meant the finder cache and mod location cache. I agree now -- there is no reason to assume that the source module exists in the same directory as the boot module. Does this patch look OK? {{{ #!diff diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 337778e..0ecb5eb 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -928,7 +928,19 @@ runPhase (RealPhase (Hsc src_flavour)) input_fn dflags0 PipeState{hsc_env=hsc_env'} <- getPipeState -- Tell the finder cache about this module - mod <- liftIO $ addHomeModuleToFinder hsc_env' mod_name location + mod <- do + -- We pass in HsSrcFile unconditionally, even if we're compiling a + -- boot module, because every location in the finder cache + -- corresponds to a module's source files only. + src_location0 <- getLocation HsSrcFile mod_name + + -- However, if we're compiling a boot module then don't make any + -- assumptions about the location of the source module. It could + -- be in a different directory than the boot module. + let src_location1 + | isHsBoot src_flavour = src_location0 { ml_hs_file = Nothing } + | otherwise = src_location0 + liftIO $ addHomeModuleToFinder hsc_env' mod_name src_location1 -- Make the ModSummary to hand to hscMain let }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8198#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler