#1148: Bad warnings about unused imports that are in fact needed
-----------------------------------+----------------------------------------
 Reporter:  brianh                 |          Owner:         
     Type:  bug                    |         Status:  new    
 Priority:  lowest                 |      Milestone:  6.8    
Component:  Compiler               |        Version:  6.6    
 Severity:  trivial                |     Resolution:         
 Keywords:  warning unused import  |     Difficulty:  Unknown
 Testcase:                         |   Architecture:  x86    
       Os:  Windows                |  
-----------------------------------+----------------------------------------
Comment (by simonpj):

 I took a look.  The whole way that unused-imports are reported is wrong,
 really.  We collect a set of "free variables", which are used '''Names''',
 but that loses the info about whether the program text mentioned the thing
 qualified or unqualified.  And that makes a difference to whether an
 import is unnecessary:
 {{{
   import qualifed Foo( x, y )
   import Foo( x )
   p = x
   q = Foo.x
 }}}
 If (but only if) the binding for `p` is omitted, the second import is
 unnecessary.  So we should really collect the set of used '''RdrNames'''.

 This would not be too big a deal.  In lookupOccRn, record the RdrName for
 non-local lookups in a mutable variable.  Look at that set in
 `reportUnusedNames`.

 But it'd take a couple of hours.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1148>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to