Skip to content

Assertion failure with equality in superclass

The following program, extracted from head.hackage failure in process-extras + ListLike in !10415 (closed), causes an assertion failure in master (as well as in !10415 (closed)).

module M where

class (Char ~ a) => ListLike a where
    mnull :: a -> b

indent :: forall a. (ListLike a) => a -> Bool
indent x = let doText y = const (mnull y) doText
           in const (doText x) doText
$ ./stage1/bin/ghc -O M
[1 of 1] Compiling M                ( M.hs, M.o )

<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.7.20230516:
	ASSERT failed!
  co_ay8
  Call stack:
      CallStack (from HasCallStack):
        assertPpr, called at compiler/GHC/Core/Subst.hs:202:5 in ghc-9.7-inplace:GHC.Core.Subst
        lookupIdSubst_maybe, called at compiler/GHC/Core/Opt/Simplify/Utils.hs:2146:31 in ghc-9.7-inplace:GHC.Core.Opt.Simplify.Utils
  CallStack (from HasCallStack):
    panic, called at compiler/GHC/Utils/Error.hs:479:29 in ghc-9.7-inplace:GHC.Utils.Error
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information