[GHC] #13064: Incorrect redudant imports warning

GHC ghc-devs at haskell.org
Thu Nov 22 21:10:37 UTC 2018


#13064: Incorrect redudant imports warning
-------------------------------------+-------------------------------------
        Reporter:  phadej            |                Owner:  davide
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15393            |  Differential Rev(s):  Phab:D5312
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"6353efc7694ba8ec86c091918e02595662169ae2/ghc"
 6353efc7/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6353efc7694ba8ec86c091918e02595662169ae2"
 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
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13064#comment:50>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list