Internal error while typechecking invalid program
While trying to reduce #12866 (closed) I encountered this program,
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
module T12866 where
type Test2 a = (Eq (TestM a))
class Test a where
type TestM :: *
which gives rise to this internal GHC error during typechecking,
$ ghc Hi2.hs
Hi2.hs:7:21: error:
• GHC internal error: ‘TestM’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: [ap0 :-> Type variable ‘a’ = a]
• In the first argument of ‘Eq’, namely ‘TestM a’
In the type ‘Eq (TestM a)’
In the type declaration for ‘Test2’
Hi2.hs:9:1: error:
• The associated type ‘TestM’
mentions none of the type or kind variables of the class ‘Test a’
• In the class declaration for ‘Test’
Clearly the program is bogus, but the first error message is quite suspicious.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |