Panic when compiling module with typed TH splice with -fwrite-ide-info
Compiling the following module panics on GHC HEAD:
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fwrite-ide-info #-}
module M where
import Language.Haskell.TH.Syntax
newtype T = T { getT :: Int }
instance Lift T where
liftTyped v = [||T $$(liftTyped (getT v))||]
ghc: panic! (the 'impossible' happened)
GHC version 9.5.20220523:
hsExprType: Unexpected HsSpliceE
unTypeCode (liftTyped (getT v_a1Ww))
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:182:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Hs/Syn/Type.hs:134:30 in ghc:GHC.Hs.Syn.Type
I haven’t investigated what’s going on here yet, so there might be a simpler reproduction case, but this is the one I found.