Panic with bad representation polymorphism + hs-boot
Given
X.hs-boot
{-# LANGUAGE TypeFamilies #-}
module X where
import GHC.Exts
type family T :: RuntimeRep
f :: forall (a :: TYPE T). a
X.hs
module X where
import Y
Y.hs
module Y where
import {-# SOURCE #-} X
g () = f
compiling ghc X
crashes:
[2 of 3] Compiling Y ( Y.hs, Y.o )
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.7.20230615:
isUnliftedType
forall (a :: TYPE T). a :: TYPE T
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:191:37 in ghc-9.7-inplace:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Core/Type.hs:2295:22 in ghc-9.7-inplace:GHC.Core.Type
isUnliftedType, called at compiler/GHC/StgToCmm/Closure.hs:211:5 in ghc-9.7-inplace:GHC.StgToCmm.Closure
I suspect this will be fixed by #22109, when we check that top-level binds are lifted in the typechecker rather than the desugarer.