Ticket #7167 (closed bug: fixed)
Make it a warning (not error) to hide an import that isn't exported
| Reported by: | simonpj | Owned by: | pcapriotti |
|---|---|---|---|
| Priority: | highest | Milestone: | 7.6.1 |
| Component: | Compiler | Version: | 7.4.2 |
| Keywords: | Cc: | jwlato@…, conrad@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | rename/should_compile/T7167 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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.
Change History
Note: See
TracTickets for help on using
tickets.
