"panic: No skolem info" with invalid instance signature
Summary
The following module (Bug.hs) causes a panic when compiling:
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
type family F a
class Class a where
f :: b -> a
instance Class a where
f :: (F b ~ a) => a
f = undefined
Bug.hs:12:8: error:ghc: panic! (the 'impossible' happened)
(GHC version 9.2.0.20210422:
No skolem info:
[a_auH[ssk:1]]
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/Tc/Errors.hs:2873:17 in ghc:GHC.Tc.Errors
The panic seems to be specific to this combination of a type family, an equality constraint, and the invalid signature in the instance. Changing any of these makes GHC fail with a proper error message.
Steps to reproduce
Compile the above module.
Expected behavior
Fail with a proper error message.
Environment
- GHC version used: 8.10.4, 9.0.1, 9.2.0.20210422 (via
ghcup
)
Optional:
- Operating System: Linux 5.10.31
- System Architecture: x86_64