Ticket #2681 (closed bug: duplicate)

Opened 5 years ago

Last modified 5 years ago

Incorrect imported module not used warning

Reported by: NeilMitchell Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.9
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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.

Change History

Changed 5 years ago by igloo

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to duplicate

Thanks for the report. We already have a ticket for this: #1074.

Note: See TracTickets for help on using tickets.