Incorrect imported module not used warning
A test case, with 3 files in.
-- AAA.hs
module AAA where
data Foo = Foo
-- AA.hs
module AA(Foo) where
import AAA
-- A.hs
module A where
import qualified AA
import AAA
type Bar = AA.Foo
Trying it out gives:
$ ghc --make
[3 of 3] Compiling A ( A.hs, A.o )
A.hs:2:0:
Warning: Module `AA' is imported, but nothing from it is used,
except perhaps instances visible in `AA'
To suppress this warning, use: import AA()
Foo comes from AAA, but is used with the import from AA, so it should be saying {{{AAA} is imported but not used. It seems the import warnings are based on final fully resolved names, but this doesn't deal with re-exports or qualification correctly.
I came accross this test case while tracking down a much more complex example which gave a case where an unqualified module was reported as being redundant - despite the fact that it was required - so it seems there are several bugs around this area.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.9 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |