[commit: ghc] master: Use the GlobalRdrEnv when renaming the axuiliary bindings in 'deriving' (4853be2)

git at git.haskell.org git at git.haskell.org
Fri Jan 3 16:14:37 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4853be24dd382f8fafa97077143c67da00b90d6e/ghc

>---------------------------------------------------------------

commit 4853be24dd382f8fafa97077143c67da00b90d6e
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Jan 3 15:35:45 2014 +0000

    Use the GlobalRdrEnv when renaming the axuiliary bindings in 'deriving'
    
    I'm not sure why were were using bindLocalNames before, but it triggers
    an assert failure that checks that local names are Internal.  This
    change makes things more uniform and straightforward.


>---------------------------------------------------------------

4853be24dd382f8fafa97077143c67da00b90d6e
 compiler/typecheck/TcDeriv.lhs |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/compiler/typecheck/TcDeriv.lhs b/compiler/typecheck/TcDeriv.lhs
index bc40d80..a369a60 100644
--- a/compiler/typecheck/TcDeriv.lhs
+++ b/compiler/typecheck/TcDeriv.lhs
@@ -29,10 +29,12 @@ import TcHsType
 import TcMType
 import TcSimplify
 
+import RnNames( extendGlobalRdrEnvRn )
 import RnBinds
 import RnEnv
 import RnSource   ( addTcgDUs )
 import HscTypes
+import Avail
 
 import Unify( tcMatchTy )
 import Id( idType )
@@ -457,8 +459,9 @@ renameDeriv is_boot inst_infos bagBinds
         ; let aux_val_binds = ValBindsIn aux_binds (bagToList aux_sigs)
         ; rn_aux_lhs <- rnTopBindsLHS emptyFsEnv aux_val_binds
         ; let bndrs = collectHsValBinders rn_aux_lhs
-        ; bindLocalNames bndrs $
-    do  { (rn_aux, dus_aux) <- rnValBindsRHS (LocalBindCtxt (mkNameSet bndrs)) rn_aux_lhs
+        ; envs <- extendGlobalRdrEnvRn (map Avail bndrs) emptyFsEnv ;
+        ; setEnvs envs $
+    do  { (rn_aux, dus_aux) <- rnValBindsRHS (TopSigCtxt (mkNameSet bndrs) False) rn_aux_lhs
         ; (rn_inst_infos, fvs_insts) <- mapAndUnzipM rn_inst_info inst_infos
         ; return (listToBag rn_inst_infos, rn_aux,
                   dus_aux `plusDU` usesOnly (plusFVs fvs_insts)) } }



More information about the ghc-commits mailing list