[GHC] #8198: One-shot mode is buggy w.r.t. hs-boot files

GHC ghc-devs at haskell.org
Wed Nov 6 15:04:20 UTC 2013


#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):

 Here's a patch of the change I'm proposing.

 {{{
 #!diff
 diff --git a/compiler/main/DriverPipeline.hs
 b/compiler/main/DriverPipeline.hs
 index 44a6fa5..b4f4844 100644
 --- a/compiler/main/DriverPipeline.hs
 +++ b/compiler/main/DriverPipeline.hs
 @@ -928,7 +928,16 @@ 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
 +  --
 +  -- If we're compiling an hs-boot file in one-shot mode, assume that a
 +  -- corresponding source file exists in the same directory and add that
 into
 +  -- the finder cache instead, to maintain the invariant that locations
 in the
 +  -- finder cache correspond to a module's source file only.
 +        mod <- do
 +            src_location <- if isHsBoot src_flavour
 +                                then getLocation HsSrcFile mod_name
 +                                else return location
 +            liftIO $ addHomeModuleToFinder hsc_env' mod_name src_location

    -- Make the ModSummary to hand to hscMain
          let
 }}}

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


More information about the ghc-tickets mailing list