Skip to content

GHC internal error: `a' is not in scope during type checking, but it passed the renamer

In the attached code the following lines give an internal GHC error. At least this should not happen. I also think this is valid code. Removing either type annotation makes this code compile.

bug :: WrappedR Int -> SomeFunction
bug (Wrap node) = case node of
  (Memo' (emptyT :: t a b) memoize (Var m) :: R' a b Int) -> -- also breaks
/Users/alessandro/Documents/Uni/thesis/test/bug-tvar-passed-renamer.hs:14:104:
    GHC internal error: `a' is not in scope during type checking, but it passed the renamer
    tcl_env of environment: [(am4,
                              Identifier[node::R' a b Int, <NotTopLevel>, 1]),
                             (rgs,
                              Identifier[bug::WrappedR Int -> SomeFunction, <NotTopLevel>, 1])]
    In the type `R' a b Int'
    In a pattern type signature: R' a b Int
    In the pattern:
      Memo' (emptyT :: t a b)
            (memoize :: MVar (t a b) -> (a -> b) -> a -> b)
            (Var m :: R' a b Int) :: R' a b Int
Trac metadata
Trac field Value
Version 7.6.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information