
#13803: Panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): OK, here is as small as I can possibly make this: a "meager" five files: {{{#!hs -- D.hs {-# LANGUAGE TypeFamilies #-} module D (D) where type family D a type instance D Int = Int }}} {{{#!hs -- E.hs {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE TypeFamilies #-} module E where import GHC.Exts (Constraint) import {-# SOURCE #-} Y class C i where type CF i :: * -> Constraint data E instance C E where type CF E = Y }}} {{{#!hs -- E.hs-boot module E where }}} {{{#!hs -- Y.hs module Y where import D () import {-# SOURCE #-} E class Y o }}} {{{#!hs -- Y.hs-boot module Y where class Y o }}} {{{ $ /opt/ghc/8.2.1/bin/ghci Y.hs GHCi, version 8.2.0.20170522: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 5] Compiling D ( D.hs, interpreted ) [2 of 5] Compiling E[boot] ( E.hs-boot, interpreted ) [3 of 5] Compiling Y[boot] ( Y.hs-boot, interpreted ) [4 of 5] Compiling E ( E.hs, interpreted ) [5 of 5] Compiling Y ( Y.hs, interpreted ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170522 for x86_64-unknown-linux): tcIfaceGlobal (local): not found You are in a maze of twisty little passages, all alike. While forcing the thunk for TyThing Y which was lazily initialized by initIfaceCheck typecheckLoop, I tried to tie the knot, but I couldn't find Y in the current type environment. If you are developing GHC, please read Note [Tying the knot] and Note [Type-checking inside the knot]. Consider rebuilding GHC with profiling for a better stack trace. Contents of current type environment: [] Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable pprPanic, called at compiler/iface/TcIface.hs:1689:23 in ghc:TcIface }}} Note that the name of `D.hs` actually matters here. For instance, if you rename `D.hs` to `Z.hs`, it'll actually compile! {{{ $ /opt/ghc/8.2.1/bin/ghci Y.hs GHCi, version 8.2.0.20170522: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 5] Compiling E[boot] ( E.hs-boot, interpreted ) [2 of 5] Compiling Y[boot] ( Y.hs-boot, interpreted ) [3 of 5] Compiling E ( E.hs, interpreted ) [4 of 5] Compiling Z ( Z.hs, interpreted ) [5 of 5] Compiling Y ( Y.hs, interpreted ) Ok, modules loaded: E, E, Y, Y, Z. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13803#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler