$ cabal run Build profile: -w ghc-9.2.2 -O1 In order, the following will be built (use -v for more details): - repro-0.1.0.0 (exe:test) (file Main.hs changed) Preprocessing executable 'test' for repro-0.1.0.0.. Building executable 'test' for repro-0.1.0.0.. [2 of 2] Compiling Main ( Main.hs, /home/tom/code/ghc-refinefrominscope-panic-repro/dist-newstyle/build/x86_64-linux/ghc-9.2.2/repro-0.1.0.0/x/test/build/test/test-tmp/Main.o, /home/tom/code/ghc-refinefrominscope-panic-repro/dist-newstyle/build/x86_64-linux/ghc-9.2.2/repro-0.1.0.0/x/test/build/test/test-tmp/Main.dyn_o ) ghc: panic! (the 'impossible' happened) (GHC version 9.2.2: refineFromInScope InScope {wild_00 $dQuote_a2GD} $tcT Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic pprPanic, called at compiler/GHC/Core/Opt/Simplify/Env.hs:706:30 in ghc:GHC.Core.Opt.Simplify.Env Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug