Opened 9 years ago

Closed 9 years ago

#4478 closed bug (fixed)

Exporting the same entity twice should not be a warning

Reported by: kosmikus Owned by:
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 6.12.3
Keywords: Cc: michal.terepeta@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case: T4478
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Here is a minimal sample module:

module Warning (module Prelude, module Data.List) where

import Prelude
import Data.List

This module results in a lot of warnings like this one:

    Warning: `foldl1' is exported by `module Data.List' and `module Prelude'

However, in this case, both occurrences of the identifier refer to the same entity foldl1 that is defined in module Data.List. In such a case, I do not think that a warning should be reported.

Occurs with both 6.12.3 and 7.0.1. Haven't tested other versions.

Attachments (1)

fix-whitespace-improve-warning.dpatch (93.7 KB) - added by michalt 9 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by michalt

Cc: michal.terepeta@… added

Isn't this the whole point of -fwarn-duplicate-exports? As I understand it, the flag will make the compiler issue a warning when you export the same thing twice. Which is exactly what happens in your example. So I'm not sure where is the problem/bug here..

comment:2 Changed 9 years ago by isaacdupree

Probably iff the name isn't mentioned explicitly at all, only through module re-exports, then there shouldn't be a warning here.

If you said (..., module Data.List, module Data.List) then there could still sensibly be a warning for saying you're exporting the same module twice (which exists: "Warning: Duplicate `Module Data.List' in export list" and which already skips the individual duplicate warnings in this case).

comment:3 Changed 9 years ago by igloo

I think we should warn about these three:

(foldr, foldr)
(module Data.List, module Data.List)
(Maybe(..), Just)

but not:

(module Prelude, module Data.List)

and I'm not sure about:

(foldr, module Data.List)

comment:4 Changed 9 years ago by igloo

Milestone: 7.2.1

Changed 9 years ago by michalt

comment:5 Changed 9 years ago by michalt

Status: newpatch

What do you think about this?

This should disable warning only in case of

(module Prelude, module Data.List)

and behave exactly as ghc currently does in all other cases.

comment:6 Changed 9 years ago by igloo

Resolution: fixed
Status: patchclosed
Test Case: T4478

Applied, thanks!

Note: See TracTickets for help on using tickets.