GHC panic: tcLookupGlobalOnly
{-# LANGUAGE ExplicitForAll, KindSignatures, StandaloneKindSignatures,
DataKinds, GADTs #-}
module T18725 where
import Data.Kind (Type)
type U :: Type
data U where P :: forall u. E u -> U
data E (u :: U)
This program results in a panic with GHC HEAD:
GHCi, version 9.1.0.20200918: https://www.haskell.org/ghc/ :? for help
Prelude> :load T18725.hs
[1 of 1] Compiling T18725 ( T18725.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 9.1.0.20200918:
tcLookupGlobalOnly
U
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:185:37 in ghc:GHC.Utils.Pa
nic
pprPanic, called at compiler/GHC/Tc/Utils/Env.hs:256:35 in ghc:GHC.Tc.Utils.En
v
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
However, it gives a reasonable error message with GHC 8.10:
GHCi, version 8.10.1: https://www.haskell.org/ghc/ :? for help
Prelude> :load T18725.hs
[1 of 1] Compiling T18725 ( T18725.hs, interpreted )
T18725.hs:10:14: error:
• Type constructor ‘U’ cannot be used here
(it is defined and used in the same recursive group)
• In the kind ‘U’
|
10 | data E (u :: U)
| ^
Failed, no modules loaded.
The regression appears related to StandaloneKindSignatures
, as removing the type U :: Type
line makes the issue go away.