Panic in `lookupIdSubst` when making ModDetails/ModIface by hand
I'm synthesizing a ModDetails
/ModIface
directly without any original Haskell source code, and running into a problem where GHC fails during Core
generation with an internal panic. Also, note the warning (when GHC is compiled with -DDEBUG
) that also only shows up when the instance is used:
Loading module Class
Registering module Class
Registering module Enums
Loading module A
Registering module A
WARNING:
Glomming in A: [EeR :-> Once1]
Call stack:
CallStack (from HasCallStack):
warnPprTrace, called at compiler/GHC/Core/Opt/OccurAnal.hs:85:5 in ghc-lib-0.20211130-7QA7vLTw0OYJmMsraoHe3v:GHC.Core.Opt.OccurAnal
hello: panic! (the 'impossible' happened)
GHC version 9.3.20211130:
lookupIdSubst
$fMyClassFoo
InScope {}
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc-lib-0.20211130-7QA7vLTw0OYJmMsraoHe3v:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Core/Subst.hs:260:17 in ghc-lib-0.20211130-7QA7vLTw0OYJmMsraoHe3v:GHC.Core.Subst
lookupIdSubst, called at compiler/GHC/Core/SimpleOpt.hs:240:10 in ghc-lib-0.20211130-7QA7vLTw0OYJmMsraoHe3v:GHC.Core.SimpleOpt
simple_opt_expr, called at compiler/GHC/Core/SimpleOpt.hs:225:5 in ghc-lib-0.20211130-7QA7vLTw0OYJmMsraoHe3v:GHC.Core.SimpleOpt
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
To reproduce:
Edited by Gergő Érdi