[GHC] #10890: Incorrect redundant import warning for type classes

GHC ghc-devs at haskell.org
Fri Sep 18 02:46:24 UTC 2015


#10890: Incorrect redundant import warning for type classes
-------------------------------------+-------------------------------------
        Reporter:  quchen            |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  8.0.1
       Component:  Compiler          |                 Version:  7.10.2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by osa1):

 Here's more stuff:

 GHC actually doesn't even consider `has` as an used symbol(i.e. internally
 it doesn't add it to the set of symbols used in a module,
 `tcg_used_rdrnames` of `TcGblEnv`), so in this case it only considers
 importing `AClass` and `BClass`. (that why in my second example it prints
 warnings about both `has`)

 `BClass` is exported by both `Base` and `Extends`.

 Now let's say we have this:

 {{{#!haskell
 import Base
 import Extends
 }}}

 Which one should be used for importing `BClass`? GHC makes the choice
 based on their locations in the source file. That is, it imports it from
 `Base` and not from `Extends`.

 But if I change imports like this:

 {{{#!haskell
 import Extends
 import Base
 }}}

 Now GHC imports `BClass` from `Extends` because it comes first in the
 source code, so no warnings here.

 Long story short, I think the problem is that GHC doesn't consider `has` a
 used symbol.

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


More information about the ghc-tickets mailing list