[commit: ghc] master: delete shadowed entries from tcg_rdr_env (#5564) (0d6529f)
Simon Marlow
marlowsd at gmail.com
Mon Oct 24 16:10:34 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/0d6529f669104b6f22049d456a9600d949a09018
>---------------------------------------------------------------
commit 0d6529f669104b6f22049d456a9600d949a09018
Author: Simon Marlow <marlowsd at gmail.com>
Date: Wed Oct 19 11:46:20 2011 +0100
delete shadowed entries from tcg_rdr_env (#5564)
This just tidies up the out-of-scope error messages in GHCi by not
suggesting some names twice.
>---------------------------------------------------------------
compiler/typecheck/TcRnDriver.lhs | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs
index aa4c7d7..b021917 100644
--- a/compiler/typecheck/TcRnDriver.lhs
+++ b/compiler/typecheck/TcRnDriver.lhs
@@ -1106,7 +1106,14 @@ setInteractiveContext hsc_env icxt thing_inside
-- Perhaps it would be better to just extend the global TyVar
-- list from the free tyvars in the Ids here? Anyway, at least
-- this hack is localised.
-
+ --
+ -- Note [delete shadowed tcg_rdr_env entries]
+ -- We also *delete* entries from tcg_rdr_env that we have
+ -- shadowed in the local env (see above). This isn't strictly
+ -- necessary, but in an out-of-scope error when GHC suggests
+ -- names it can be confusing to see multiple identical
+ -- entries. (#5564)
+ --
(tmp_ids, types_n_classes) = partitionWith sel_id (ic_tythings icxt)
where sel_id (AnId id) = Left id
sel_id other = Right other
@@ -1123,7 +1130,9 @@ setInteractiveContext hsc_env icxt thing_inside
, c <- tyConDataCons t ]
in
updGblEnv (\env -> env {
- tcg_rdr_env = ic_rn_gbl_env icxt
+ tcg_rdr_env = delListFromOccEnv (ic_rn_gbl_env icxt)
+ (map getOccName visible_tmp_ids)
+ -- Note [delete shadowed tcg_rdr_env entries]
, tcg_type_env = type_env
, tcg_inst_env = extendInstEnvList
(extendInstEnvList (tcg_inst_env env) ic_insts)
More information about the Cvs-ghc
mailing list