Attempt at levity polymorphic pattern synonym causes panic
If I say
{-# LANGUAGE StandaloneKindSignatures, MagicHash, ExplicitForAll, PolyKinds,
DataKinds, UnliftedDatatypes, PatternSynonyms #-}
module PatSyns3 where
import GHC.Exts
type LPInt :: forall (l :: Levity) -> TYPE (BoxedRep l)
data LPInt l = MkI Int#
pattern MkIPS :: Int# -> LPInt lev
pattern MkIPS n = MkI n
GHC says
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.3.20210916:
tyConAppTyCon
lev_a2ju
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/Type.hs:1431:52 in ghc:GHC.Core.Type
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
I expected the original program to be rejected, as it seems to be attempting to write a levity-polymorphic pattern synonym. But it shouldn't cause a panic!