Skip to content

Incorrect warning about qualified import

GHC HEAD failed to validate recently because of this warning (in combination with -Werror)

Distribution/Simple/Program.hs:222:24:
    Warning: This binding for `update' shadows the existing binding
               imported from Distribution.Compat.Map at Distribution/Simple/Program.hs:87:0-46
             In the definition of `updateUnconfiguredProgs'

The code it was warning about looks like

updateUnconfiguredProgs update conf =
  conf { unconfiguredProgs = update (unconfiguredProgs conf) }

So initially it looks sensible. However the only import of Distribution.Compat.Map in that module is from

import qualified Distribution.Compat.Map as Map

So actually there is no update in scope at all and thus there is no name shadowing. The warning is incorrect.

This is a regression in ghc-6.9. The warning is not present with ghc-6.8.2.

It should be possible to reproduce this problem using ghc's branch of the Cabal lib and by reverting the patch that is currently masking the incorrect warning:

Fri Jan 18 11:12:30 PST 2008  Ian Lynagh <igloo@earth.li>
  * Fix warnings in Cabal
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 Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information