[commit: ghc] master: Fix unused-import warnings (6353efc)

git at git.haskell.org git at git.haskell.org
Thu Nov 22 21:10:44 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6353efc7694ba8ec86c091918e02595662169ae2/ghc

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

commit 6353efc7694ba8ec86c091918e02595662169ae2
Author: David Eichmann <EichmannD at gmail.com>
Date:   Thu Nov 22 14:48:05 2018 -0500

    Fix unused-import warnings
    
    This patch fixes a fairly long-standing bug (dating back to 2015) in
    RdrName.bestImport, namely
    
       commit 9376249b6b78610db055a10d05f6592d6bbbea2f
       Author: Simon Peyton Jones <simonpj at microsoft.com>
       Date:   Wed Oct 28 17:16:55 2015 +0000
    
       Fix unused-import stuff in a better way
    
    In that patch got the sense of the comparison back to front, and
    thereby failed to implement the unused-import rules described in
      Note [Choosing the best import declaration] in RdrName
    
    This led to Trac #13064 and #15393
    
    Fixing this bug revealed a bunch of unused imports in libraries;
    the ones in the GHC repo are part of this commit.
    
    The two important changes are
    
    * Fix the bug in bestImport
    
    * Modified the rules by adding (a) in
         Note [Choosing the best import declaration] in RdrName
      Reason: the previosu rules made Trac #5211 go bad again.  And
      the new rule (a) makes sense to me.
    
    In unravalling this I also ended up doing a few other things
    
    * Refactor RnNames.ImportDeclUsage to use a [GlobalRdrElt] for the
      things that are used, rather than [AvailInfo]. This is simpler
      and more direct.
    
    * Rename greParentName to greParent_maybe, to follow GHC
      naming conventions
    
    * Delete dead code RdrName.greUsedRdrName
    
    Bumps a few submodules.
    
    Reviewers: hvr, goldfire, bgamari, simonmar, jrtc27
    
    Subscribers: rwbarton, carter
    
    Differential Revision: https://phabricator.haskell.org/D5312


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

6353efc7694ba8ec86c091918e02595662169ae2
 compiler/basicTypes/RdrName.hs                     | 102 ++++++---
 compiler/cmm/Bitmap.hs                             |   1 -
 compiler/cmm/CmmCommonBlockElim.hs                 |   1 -
 compiler/cmm/CmmLayoutStack.hs                     |   2 +-
 compiler/cmm/CmmProcPoint.hs                       |   2 +-
 compiler/cmm/Hoopl/Collections.hs                  |   2 +-
 compiler/codeGen/StgCmmProf.hs                     |   1 -
 compiler/coreSyn/CoreOpt.hs                        |   2 +-
 compiler/coreSyn/CorePrep.hs                       |   2 +-
 compiler/coreSyn/CoreStats.hs                      |   2 -
 compiler/deSugar/DsBinds.hs                        |   2 +-
 compiler/ghci/ByteCodeLink.hs                      |   1 -
 compiler/ghci/RtClosureInspect.hs                  |   5 +-
 compiler/hsSyn/Convert.hs                          |   1 -
 compiler/hsSyn/HsBinds.hs                          |   1 -
 compiler/hsSyn/HsExtension.hs                      |   1 -
 compiler/hsSyn/HsImpExp.hs                         |   3 +
 compiler/hsSyn/HsTypes.hs                          |   1 -
 compiler/llvmGen/LlvmCodeGen/CodeGen.hs            |   1 -
 compiler/main/Ar.hs                                |   1 -
 compiler/main/DynFlags.hs                          |   2 +
 compiler/main/DynamicLoading.hs                    |   5 +-
 compiler/main/Finder.hs                            |   1 -
 compiler/main/GHC.hs                               |   2 -
 compiler/main/HscMain.hs                           |   1 -
 compiler/main/HscStats.hs                          |   1 -
 compiler/main/Packages.hs                          |   1 -
 .../nativeGen/RegAlloc/Linear/JoinToTargets.hs     |   2 -
 compiler/nativeGen/RegAlloc/Linear/PPC/FreeRegs.hs |   1 -
 .../nativeGen/RegAlloc/Linear/SPARC/FreeRegs.hs    |   1 -
 compiler/nativeGen/RegAlloc/Linear/X86/FreeRegs.hs |   1 -
 .../nativeGen/RegAlloc/Linear/X86_64/FreeRegs.hs   |   1 -
 compiler/parser/RdrHsSyn.hs                        |   1 -
 compiler/rename/RnEnv.hs                           |  19 +-
 compiler/rename/RnExpr.hs-boot                     |   1 -
 compiler/rename/RnNames.hs                         | 233 +++++++++++----------
 compiler/rename/RnSource.hs                        |   2 +-
 compiler/simplStg/RepType.hs                       |   2 +-
 compiler/specialise/Specialise.hs                  |   1 -
 compiler/typecheck/ClsInst.hs                      |   2 -
 compiler/typecheck/TcBackpack.hs                   |   2 +-
 compiler/typecheck/TcCanonical.hs                  |   2 +-
 compiler/typecheck/TcDeriv.hs                      |   2 +-
 compiler/typecheck/TcErrors.hs                     |   2 +-
 compiler/typecheck/TcHoleErrors.hs                 |   1 -
 compiler/typecheck/TcHsSyn.hs                      |   1 -
 compiler/typecheck/TcInstDcls.hs-boot              |   1 -
 compiler/typecheck/TcInteract.hs                   |   4 +-
 compiler/typecheck/TcPatSyn.hs                     |   4 +-
 compiler/typecheck/TcRnTypes.hs                    |   5 +-
 compiler/typecheck/TcSMonad.hs                     |   3 +-
 compiler/typecheck/TcType.hs                       |   2 +-
 compiler/typecheck/TcTypeable.hs                   |   1 -
 compiler/types/TyCon.hs                            |   4 +-
 compiler/utils/OrdList.hs                          |   1 -
 compiler/utils/Outputable.hs                       |   1 -
 compiler/utils/UniqSet.hs                          |   1 -
 ghc/GHCi/Leak.hs                                   |   2 +-
 hadrian/hadrian.cabal                              |   2 +-
 hadrian/src/Hadrian/Haskell/Cabal/Parse.hs         |   2 +-
 libraries/Cabal                                    |   2 +-
 libraries/base/Data/Functor/Classes.hs             |   1 -
 libraries/base/Data/Functor/Compose.hs             |   2 -
 libraries/base/Data/Functor/Contravariant.hs       |   1 -
 libraries/base/Data/Functor/Product.hs             |   3 -
 libraries/base/Data/Functor/Sum.hs                 |   2 -
 libraries/base/Data/Semigroup.hs                   |   3 -
 libraries/base/GHC/Event/PSQ.hs                    |   1 -
 libraries/base/GHC/Generics.hs                     |   2 +-
 libraries/base/GHC/Show.hs                         |   1 -
 libraries/base/GHC/StaticPtr.hs                    |   1 -
 libraries/bytestring                               |   2 +-
 libraries/ghc-prim/GHC/Magic.hs                    |  10 +-
 libraries/ghci/GHCi/CreateBCO.hs                   |   2 +-
 testsuite/tests/driver/T4437.hs                    |   1 -
 testsuite/tests/module/mod177.stderr               |   2 +-
 testsuite/tests/rename/should_compile/T13064.hs    |   8 +
 .../tests/rename/should_compile/T13064.stderr      |   3 +
 testsuite/tests/rename/should_compile/T4239.stdout |   2 +-
 testsuite/tests/rename/should_compile/all.T        |   1 +
 .../check-api-annotations.cabal                    |   2 +-
 utils/check-ppr/check-ppr.cabal                    |   2 +-
 utils/ghc-cabal/ghc-cabal.cabal                    |   2 +-
 utils/ghctags/Main.hs                              |   2 +-
 utils/ghctags/ghctags.cabal                        |   2 +-
 85 files changed, 277 insertions(+), 240 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6353efc7694ba8ec86c091918e02595662169ae2


More information about the ghc-commits mailing list