Skip to content

ASSERT failed when type family used in class TLKS

The following program triggers an ASSERT failure on the wip/top-level-kind-signatures branch when built with the devel2 flavour:

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TopLevelKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where

import Data.Kind

type family Id (x :: Type) :: Type where
  Id x = x

type C :: Type -> Id Constraint
class C a
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.9.0.20190602:
        ASSERT failed!
  C
  Id Constraint
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1173:37 in ghc:Outputable
        pprPanic, called at compiler/utils/Outputable.hs:1240:5 in ghc:Outputable
        assertPprPanic, called at compiler/typecheck/TcTyClsDecls.hs:1756:85 in ghc:TcTyClsDecls
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information