[GHC] #13591: "*** Exception: expectJust showModule" in ghci with hs-boot

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1-rc1 Keywords: ghci hs-boot | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- ghci runs into an exception if there is an error in Foo.hs when there exists a Foo.hs-boot (which compiles fine). - First.hs-boot {{{ module First where one :: Int }}} - Second.hs {{{ module Second where import {-# SOURCE #-} First two :: Int two = one + 1 }}} - First.hs {{{ module First where import Second one :: Int one = _ }}} {{{
ghci Prelude> :l First [1 of 3] Compiling First[boot] ( First.hs-boot, interpreted ) [2 of 3] Compiling Second ( Second.hs, interpreted ) [3 of 3] Compiling First ( First.hs, interpreted )
First.hs:6:7: error: • Found hole: _ :: Int • In the expression: _ In an equation for ‘one’: one = _ • Relevant bindings include one :: Int (bound at First.hs:6:1) *** Exception: expectJust showModule CallStack (from HasCallStack): error, called at compiler/utils/Maybes.hs:48:27 in ghc:Maybes }}} This happens on ghc-8.0.1, 8.0.2 and 8.2.1-rc1. The above output is from 8.0.2, but the error seems to be essentially the same on 8.2.1-rc1. It did not happen on 7.10.3. While ghci continues to work, the exception appears to clear the loaded- modules list, which in turn breaks tooling (ghcid here, which hangs as a consequence). The expected behaviour would be that other modules (which contain no errors) remain loaded. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot
-------------------------------------+-------------------------------------
Reporter: lspitzner | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 8.2.1-rc1
Resolution: | Keywords: ghci hs-boot
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: normal => high * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by lspitzner): #9887 seems related, as it seems to be the main "consumer" of the function that causes this error. Handling the Nothing-case by returning True could mean that #9887 remains open for hs-boot files, but then I don't understand what exactly the test for {{{linkable}}} is supposed to accomplish in the first place. When trying to understand the involved code, I noticed that this seems to be a near-perfect example of boolean blindness. Where {{{isObjectLinkable}}} returns a Bool that might reflect pretty closely what the function's name suggests, the value is then "reinterpreted" without any explanation and exposed as {{{isModuleInterpreted}}}. Further, {{{showModule}}} passes the Bool to {{{showModMsg}}} where the argument then is called "recomp" (another reinterpretation): {{{ showModMsg dflags target recomp mod_summary = ... case target of HscInterpreted | recomp -> ... -- what we have here, really is: -- HscInterpreted | (isModuleInterpreted mod_summary) -> .. -- so we have two interpreted-flags? what? ... }}} At this point I have no idea anymore of what the supposed semantic of this Bool is anymore. All that said, doing {{{ isModuleInterpreted :: GhcMonad m => ModSummary -> m Bool isModuleInterpreted mod_summary = withSession $ \hsc_env -> case lookupUFM (hsc_HPT hsc_env) (ms_mod_name mod_summary) of Nothing -> panic "missing linkable" Just mod_info -> return $ case hm_linkable mod_info of Nothing -> True Just linkable -> not (isObjectLinkable linkable) }}} seems to be a quick fix for this. But it does not display something like {{{ Failed, modules loaded: First(First.o-boot), First, Second. }}} in the case that only First.hs-boot was compiled before. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9450 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #9450 Comment: The program in #9450 also experiences this error. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: patch Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9450 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch Comment: lspitzner posted a fix for this issue at https://github.com/ghc/ghc/pull/37. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: patch Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9450 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * cc: ezyang (added) Comment: Edward, you know about `hs-boot` stuff. Might you look? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: patch Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9450 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Note that we have a patch for this which resolves the issue as reported. However, I suspect that this bit of code could do with some refactoring. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot
-------------------------------------+-------------------------------------
Reporter: lspitzner | Owner: (none)
Type: bug | Status: patch
Priority: high | Milestone: 8.2.1
Component: GHCi | Version: 8.2.1-rc1
Resolution: | Keywords: ghci hs-boot
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #9450 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: merge Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9450 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13591: "*** Exception: expectJust showModule" in ghci with hs-boot -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: GHCi | Version: 8.2.1-rc1 Resolution: fixed | Keywords: ghci hs-boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9450 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged with f3ce36846bd3da3d957810f05d387d7699cd23e1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13591#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC