[GHC] #11827: InteractiveEval error handling gets a boot ModSummary instead of normal ModSummary

GHC ghc-devs at haskell.org
Wed Apr 13 11:43:49 UTC 2016


#11827: InteractiveEval error handling gets a boot ModSummary instead of normal
ModSummary
-------------------------------------+-------------------------------------
           Reporter:  darchon        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.0.1
          Component:  Compiler       |           Version:  8.0.1-rc3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Given:

 A.hs
 {{{#!hs
 module A where

 data A = A

 f :: A -> Bool
 f C = False
 }}}

 A.hs-boot
 {{{#!hs
 module A where

 data A

 f :: A -> Bool
 }}}

 B.hs
 {{{#!hs
 module B where

 import {-# SOURCE #-} A

 data B = B A

 g :: B -> Bool
 g (B a) = f a
 }}}

 ghci reports:

 {{{
 $ ghci B.hs
 GHCi, version 8.0.0.20160411: http://www.haskell.org/ghc/  :? for help
 [1 of 3] Compiling A[boot]          ( A.hs-boot, interpreted )
 [2 of 3] Compiling A                ( A.hs, interpreted )

 A.hs:6:3: error: Not in scope: data constructor ‘C’
 *** Exception: expectJust showModule
 CallStack (from HasCallStack):
   error, called at compiler/utils/Maybes.hs:48:27 in ghc:Maybes
 >
 }}}

 So instead of a normal error telling me that the C constructor does not
 exist, I get an additional exception from expectJust because something
 went wrong in GHCs internal error reporting routine.

 Looking at
 https://github.com/ghc/ghc/blob/master/compiler/main/InteractiveEval.hs#L956,
 the expectJust exception is due to the fact that while reporting an error
 about A.hs, GHCi somehow got a hold of the ModSummary of A.hs-boot instead
 of A.hs

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


More information about the ghc-tickets mailing list