Commit 0d6529f6 authored by Simon Marlow's avatar Simon Marlow

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.
parent 1d1cf4ac
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment