[project @ 1999-01-27 14:51:14 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / Inst.lhs
index f568f4f..63d0433 100644 (file)
@@ -49,7 +49,7 @@ import Class  ( classInstEnv,
 import Id      ( Id, idFreeTyVars, idType, mkUserLocal, mkSysLocal )
 import VarSet  ( elemVarSet )
 import PrelInfo        ( isStandardClass, isCcallishClass, isNoDictClass )
-import Name    ( OccName, Name, mkDictOcc, getOccName )
+import Name    ( OccName, Name, mkDictOcc, mkMethodOcc, getOccName )
 import PprType ( pprConstraint )       
 import SpecEnv ( SpecEnv, lookupSpecEnv )
 import SrcLoc  ( SrcLoc )
@@ -374,10 +374,16 @@ instToId inst = instToIdBndr inst
 
 instToIdBndr :: Inst -> TcId
 instToIdBndr (Dict u clas ty orig loc)
-  = mkUserLocal (mkDictOcc (getOccName clas)) u (mkDictTy clas ty)
+  = mkUserLocal (mkDictOcc (getOccName clas)) u (mkDictTy clas ty) loc
 
 instToIdBndr (Method u id tys theta tau orig loc)
-  = mkUserLocal (getOccName id) u tau
+  = mkUserLocal (getOccName id) u tau loc
+       -- We used to call mkMethodOcc here, but that gives rise to bad
+       -- error messages when we print the function name or pattern
+       -- of an instance-decl binding.  Why? Because the binding is zapped
+       -- to use the method name in place of the selector name.
+       -- The way it is now, -ddump-xx output may look confusing, but
+       -- you can always say -dppr-debug to get the uniques
     
 instToIdBndr (LitInst u list ty orig loc)
   = mkSysLocal SLIT("lit") u ty