Opened 9 years ago

Closed 6 years ago

#2436 closed bug (fixed)

Bad warning when exporting data families

Reported by: rl Owned by: chak
Priority: low Milestone: 7.2.1
Component: Compiler Version: 6.9
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: rename/should_compile/T2436
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

module Foo ( T ) where
data family T a
module Bar ( T(..), module Foo ) where
import Foo
data instance T Int = TInt

GHC issues the following warning:

Bar.hs:1:20: Warning: `T' is exported by `module Foo' and `T(..)'

However, that's the only way to export both module Foo and TInt from Bar. I don't think GHC should warn here.

Change History (12)

comment:1 Changed 9 years ago by chak

Owner: set to chak

comment:2 Changed 9 years ago by igloo

difficulty: Unknown
Milestone: 6.10.1

comment:3 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:5 Changed 9 years ago by igloo

Milestone: 6.10.16.10 branch

comment:6 Changed 9 years ago by igloo

Milestone: 6.10 branch6.12 branch

comment:7 Changed 7 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:8 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:9 Changed 7 years ago by igloo

Milestone: 7.0.17.0.2

comment:10 Changed 7 years ago by igloo

Milestone: 7.0.27.2.1

comment:11 Changed 6 years ago by rl

Type of failure: None/Unknown

Here is another related example:

module Foo(C(..),T(..)) where

class C a where
  data T a

instance C Int where
  data T Int = TInt Int

Again, GHC warns about T being exported twice but unless I'm mistaken, there is no other way of exporting the constructor TInt.

Should this be assigned a higher priority now that type families are quite well supported and this makes writing warning-free code impossible in some cases?

comment:12 Changed 6 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: rename/should_compile/T2436

Your word is my command. Fixed by

commit 9992bfb6bd3644384b9a26b810ef68f05fd60879
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Fri Jun 10 19:54:34 2011 +0100

    Kill bogus duplicate-export warnings (fix Trac #2436)
    
    The general rule is now that we don't complain about
    a duplicate export from a "...".  See RnNames.dupExport_ok

>---------------------------------------------------------------

 compiler/rename/RnNames.lhs |   55 ++++++++++++++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 13 deletions(-)

and

commit ceb672554ef7e668eb92f703a3d21c6bd1e3b91e
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Sat Jun 11 14:23:40 2011 +0100

    Further improvents to duplicate-export warnings (Trac #2436)

>---------------------------------------------------------------

 compiler/rename/RnNames.lhs |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

test added.

Simon

Note: See TracTickets for help on using tickets.