Skip to content

ghc panic: runtimeRepLevity_maybe

Summary

An ill-typed program triggers a panic while printing an error message.

Steps to reproduce

Compile this:

module Bug where

import GHC.Exts (TYPE)

data T (a :: TYPE r) = MkT

f :: T @(f a b) () -> ()
f MkT = ()

GHC tries to print an error message (as can be seen from the error code GHC-83865) but then panics:

Bug.hs:7:17: error: [GHC-83865]ghc: panic! (the 'impossible' happened)
  GHC version 9.7.20230110:
        runtimeRepLevity_maybe

'BoxedRep
Call stack:
    CallStack (from HasCallStack):
      callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
      pprPanic, called at compiler/GHC/Core/Type.hs:796:22 in ghc:GHC.Core.Type

Expected behavior

A proper error message.

Environment

  • GHC version used: HEAD.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information