Incorrect warning about unused import
In cabal-install in four modules we get an incorrect warning about an import that is unused when it is in fact used. It is also used directly or indirectly by exported functions.
The warnings are all of the same form. Here is one:
Hackage/Install.hs:31:0:
Warning: Module `Distribution.Simple.Compiler' is imported, but nothing from it is used,
except perhaps instances visible in `Distribution.Simple.Compiler'
To suppress this warning, use: import Distribution.Simple.Compiler()
We import from that module only once with
import Distribution.Simple.Compiler (Compiler, PackageDB)
Both the Compiler and PackageDB types are used in the type signature for install
which is directly exported.
install :: Verbosity
-> PackageDB
-> [Repo]
-> Compiler
-> ProgramConfiguration
-> Cabal.ConfigFlags
-> [UnresolvedDependency]
-> IO ()
The problem is not restricted to unused types. This import:
import Distribution.Compiler (CompilerFlavor(..), defaultCompilerFlavor)
gives us the following warning:
Hackage/Config.hs:33:0:
Warning: Module `Distribution.Compiler' is imported, but nothing from it is used,
except perhaps instances visible in `Distribution.Compiler'
To suppress this warning, use: import Distribution.Compiler()
Which is used in a value
defaultCompiler :: CompilerFlavor
defaultCompiler = fromMaybe GHC defaultCompilerFlavor
This value is used indirectly by an exported function.
It is not obvious to me what is special about these imports that gives us these incorrect warnings. (Except that they have the module name "Compiler".)
Initially this looks similar to ticket #1148 (closed), however that was diagnosed as being related to qualified imports. This does not appear to be the same.
It should be possible to reproduce these using ghc-6.8.2 and the cabal-install
code from darcs. http://darcs.haskell.org/cabal-install/
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |