Refactor the way shadowing in handled in GHCi
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 3 Jan 2014 15:50:39 +0000 (15:50 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 3 Jan 2014 15:50:39 +0000 (15:50 +0000)
commit5dffb4ac14b53362ebe9a67c5c6a01f9c9c25229
tree5ddee77edb4f559c000b5d1bfbac034d43146d46
parente60a841b07d000703e7aceb0faec908ce8f3257f
Refactor the way shadowing in handled in GHCi

If you say
  ghci> import Foo( T )
  ghci> data T = MkT
  ghci> data T = XXX
then the second 'data T' should shadow the first.  But the qualified
Foo.T should still be available.  We really weren't handling this
correctly at all, resulting in Trac #8639 and #8628 among others

This patch:

* Add RdrName.extendGlobalRdrEnv, which does shadowing properly

* Change HscTypes.icExtendGblRdrEnv (was badly-named icPlusGblRdrEnv)
  to use the new function

* Change RnNames.extendGobalRdrEnvRn to use the new function

* Move gresFrom Avails into RdrName
* Better pprGlobalRdrEnv function in RdrName
compiler/basicTypes/Avail.hs
compiler/basicTypes/RdrName.lhs
compiler/deSugar/DsMonad.lhs
compiler/main/HscMain.hs
compiler/main/HscTypes.lhs
compiler/main/InteractiveEval.hs
compiler/rename/RnNames.lhs
compiler/rename/RnSource.lhs