[project @ 2002-07-23 14:58:16 by simonpj]
authorsimonpj <unknown>
Tue, 23 Jul 2002 14:58:16 +0000 (14:58 +0000)
committersimonpj <unknown>
Tue, 23 Jul 2002 14:58:16 +0000 (14:58 +0000)
Use tcLookupId, not tcLookupGlobalId, in Inst.newMethodFromName

    This really only affects the behaviour with -fno-implicit-prelude

*** MERGE TO STABLE BRANCH ***

ghc/compiler/typecheck/Inst.lhs

index d43651c..7cb4a7f 100644 (file)
@@ -39,7 +39,7 @@ import TcHsSyn        ( TcExpr, TcId, TypecheckedHsExpr,
                  mkHsTyApp, mkHsDictApp, mkHsConApp, zonkId
                )
 import TcMonad
-import TcEnv   ( TcIdSet, tcGetInstEnv, tcLookupId, tcLookupGlobalId )
+import TcEnv   ( TcIdSet, tcGetInstEnv, tcLookupId )
 import InstEnv ( InstLookupResult(..), lookupInstEnv )
 import TcMType ( zonkTcType, zonkTcTypes, zonkTcPredType, zapToType,
                  zonkTcThetaType, tcInstTyVar, tcInstType, tcInstTyVars
@@ -393,7 +393,11 @@ tcInstDataCon orig data_con
 
 newMethodFromName :: InstOrigin -> TcType -> Name -> NF_TcM Inst
 newMethodFromName origin ty name
-  = tcLookupGlobalId name              `thenNF_Tc` \ id ->
+  = tcLookupId name            `thenNF_Tc` \ id ->
+       -- Use tcLookupId not tcLookupGlobalId; the method is almost
+       -- always a class op, but with -fno-implicit-prelude GHC is
+       -- meant to find whatever thing is in scope, and that may
+       -- be an ordinary function. 
     newMethod origin id [ty]
 
 newMethod :: InstOrigin