`isUnliftedType` panic with derived Generic1 instance for runtime-polymorphic newtype
The following program will cause GHC 8.10.4 through HEAD to panic:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE UnliftedNewtypes #-}
module Bug where
import GHC.Exts (TYPE)
import GHC.Generics (Generic1)
newtype D (a :: TYPE r) = MkD a
deriving Generic1
$ /opt/ghc/9.0.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 9.0.1:
isUnliftedType
a_aMT :: TYPE r_aMS
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Outputable.hs:1230:37 in ghc:GHC.Utils.Outputable
pprPanic, called at compiler/GHC/Core/Type.hs:1972:10 in ghc:GHC.Core.Type