Record usage information using GlobalRdrElt
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 30 Oct 2015 09:41:47 +0000 (09:41 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 30 Oct 2015 09:45:49 +0000 (09:45 +0000)
commit3e94842d4d1258fbd6a1202bf74d41ce1d01c753
tree703ec106f907a72be0d4349a31ca33c44651ee48
parent9376249b6b78610db055a10d05f6592d6bbbea2f
Record usage information using GlobalRdrElt

This patch implements an improvment that I've wanted to do for ages, but
never gotten around to.

Unused imports are computed based on how imported entities occur (qualified,
unqualified).   This info was accumulated in tcg_used_rdrnames :: Set RdrName.
But that was a huge pain, and it got worse when we introduced duplicate
record fields.

The Right Thing is to record tcg_used_gres :: [GlobalRdrElt], which records
the GRE *after* filtering with pickGREs.  See Note [GRE filtering] in RdrName.
This is much, much bette.  This patch deletes quite a bit of code, and is
conceptually much easier to follow.

Hooray.  There should be no change in functionality.
15 files changed:
compiler/basicTypes/RdrName.hs
compiler/rename/RnEnv.hs
compiler/rename/RnNames.hs
compiler/rename/RnPat.hs
compiler/typecheck/TcCanonical.hs
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnMonad.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSMonad.hs
testsuite/tests/module/Mod136_A.hs
testsuite/tests/module/mod136.hs
testsuite/tests/module/mod136.stderr
testsuite/tests/rename/should_compile/T4239.stdout