id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
4169,TH vs. default function implementation: internal error,verdelyi,,"Testcase:
{{{
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH
class Numeric a where
    fromIntegerNum :: a
    fromIntegerNum = undefined

ast :: Q [Dec]
ast = [d|
    instance Numeric Int
    |]
}}}
It gives an internal error:

{{{
InstanceGenerator.hs:9:13:
    GHC internal error: `Main.$dmfromIntegerNum' is not in scope during type checking, but it passed the renamer
    tcg_type_env of environment: [(rgd, Class `Numeric'),
                                  (rgf, Identifier `fromIntegerNum'),
                                  (rgm, Data constructor `Main.D:Numeric'),
                                  (rgn, Type constructor `Main.T:Numeric'),
                                  (rgr, Type constructor `Main.NTCo:T:Numeric'),
                                  (rgs, Identifier `Main.D:Numeric')]
    In the instance declaration for `Numeric Int'
    In the Template Haskell quotation
      [d| 
          instance Numeric Int where |]
    In the expression:
        [d| 
            instance Numeric Int where |]
Failed, modules loaded: none.
}}}
May be related to Ticket #4056 (?)",bug,closed,normal,7.0.1,Compiler,6.12.3,fixed,,,Unknown/Multiple,Unknown/Multiple,None/Unknown,,th/T4169,,,
