Skip to content

Panic with representation polymorphism check

Similar, but not the same as #22743 (closed).

This invalid program causes a crash in typeKind during representation polymorphism checking in 9.4 and master:

{-# LANGUAGE MagicHash #-}
module M where

import GHC.Exts

i :: forall f g (a :: TYPE (f g)). a -> a
i = i

x = i 0#

GHC 9.2 gives a correct error

M.hs:9:7: error:
    • Couldn't match kind ‘'IntRep’ with ‘f g’
      When matching types
        a :: TYPE (f g)
        Int# :: TYPE 'IntRep
    • In the first argument of ‘i’, namely ‘0#’
      In the expression: i 0#
      In an equation for ‘x’: x = i 0#
    • Relevant bindings include x :: a (bound at M.hs:9:1)
  |
9 | x = i 0#
  |       ^^
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information