Skip to content

PolyKinds and recompilation causes internal error

Given these two files:

module A where
-- empty

and

{-# LANGUAGE PolyKinds, TypeFamilies, UndecidableInstances #-}
module B where

import A

data T = TT

type family Compare (m :: T) :: Ordering
type instance Compare TT = Compare TT

type Compare' a = Compare a

We can cause an internal GHC error as follows:

$ rm *.o *.hi
$ ghc B.hs
[1 of 2] Compiling A                ( A.hs, A.o )
[2 of 2] Compiling B                ( B.hs, B.o )
$ sleep 1
$ touch B.hs
$ ghc B.hs
[2 of 2] Compiling B                ( B.hs, B.o )

B.hs:11:19:
    GHC internal error: `Compare' is not in scope during type checking, but it passed the renamer
    tcl_env of environment: [(a9R, AThing k_a9U)]
    In the type `Compare a'
    In the type synonym declaration for Compare'
Trac metadata
Trac field Value
Version 7.4.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system MacOS X
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information