#7167: Make it a warning (not error) to hide an import that isn't exported
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  highest           |   Milestone:  7.6.1           
   Component:  Compiler          |     Version:  7.4.2           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
 We often see build failures like
 {{{
     Module `Prelude' does not export `catch'
 }}}
 elicited by an `import` statement
 {{{
   import Prelude hiding( catch )
 }}}
 John Lato and others suggest making this a warning, not an error.  Simon
 and I agree and we propose to do this for GHC 7.6, thus:

  * Warn, rather than error, when a `hiding` clause mentions something that
 the module does not export.
  * Suppress with warning with `-fno-warn-dodgy-imports`, an existing
 warning-suppression flag.
  * Document the change, in the `-fwarn-docugy-imports` flag, and the
 release notes.

 We propose to make this change without a language extension.  Doing so is
 technically wrong, since H2010 says it's an error to mention something in
 `hiding` that isn't exported, but it seems too heavyweight to make a
 language extension just for this; and in any case it would have to be on
 by default to be any use in practice.

 Paolo, can you do all this?
  * The relevant function is `RnNames.filterImports`.
  * I suggest you make `lookup_ie` return `TcRn [(LIE Name,AvailInfo)]`
 rather than the `MaybeErr ...` that it currently returns.
  * The `want_hiding` flag is `True` if this is a hiding clause; in that
 case `bad_ie` should warn (unless the warning is suppressed) rather than
 error.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to