GHC crash "urk! lookup local fingerprint"
Summary
The following code crashes when compiled with GHC 8.8.3:
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeFamilies #-}
module Main (main) where
import Data.Kind (Type)
type family F :: k -> Type
type family B (a :: k) (b :: k) :: k
main :: IO ()
main =
\(_ :: F n) -> (undefined :: B n 1)
-- this should raise an error, `B n 1' is not a type
Output:
[1 of 1] Compiling Main ( Main.hs, Main.o ) [Optimisation flags changed]
ghc: panic! (the 'impossible' happened)
(GHC version 8.8.3 for x86_64-unknown-linux):
urk! lookup local fingerprint
main
[]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/iface/MkIface.hs:535:37 in ghc:MkIface
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
Steps to reproduce
Run ghc -O2 Main.hs
Expected behavior
GHC should not crash and should output the correct error.
Environment
- GHC version used: 8.8.3
- Operating System: GNU/Linux
- System Architecture: x86_64