[GHC] #4980: Warning about module abbreviation clashes

GHC cvs-ghc at haskell.org
Thu Feb 24 23:12:47 CET 2011


#4980: Warning about module abbreviation clashes
---------------------------------+------------------------------------------
    Reporter:  Lemming           |       Owner:              
        Type:  feature request   |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  7.0.1             |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 Please add the option -fwarn-module-rename-collision that makes GHC to do
 the following: If GHC encounters an import situation like
 {{{
 module Main where

 import qualified Data.A as A
 import qualified Control.A as A
 }}}
 then GHC should emit a warning like
 {{{
 Main.hs:3:0:
 Main.hs:4:0:
     Warning: Both Data.A and Control.A are renamed to A.
              An identifier like A.ident can only be resolved,
              if it is either in Data.A or Control.A.
              Better rename both modules to different names.
 }}}

 Reason for this warning is, that if 'ident' is from Data.A as of writing
 Main, and later another variable named 'ident' is added to Control.A, then
 A.ident can no longer be resolved in Main. That is, by accidental module
 rename collisions even qualified imports carry the risk of future name
 collisions.

 Related to #4977

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4980>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list