Skip to content

GHC internal error on erroneous program with recursive TLKSs

I don't expect this program to typecheck:

{-# LANGUAGE TopLevelKindSignatures #-}
module Bug where

import Data.Kind

type T1 :: T2
data T1

type T2 :: T1
data T2

But I definitely don't expect it to give me this error:

[1 of 1] Compiling Bug              ( ../Bug.hs, ../Bug.o )

../Bug.hs:9:12: error:
    • GHC internal error: ‘T1’ is not in scope during type checking, but it passed the renamer
      tcl_env of environment: []
    • In a top-level kind signature for ‘T2’: T1
  |
9 | type T2 :: T1
  |            ^^
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information