Opened 2 years ago

Closed 2 years ago

#5589 closed bug (fixed)

Duplicate type signature not reported

Reported by: MikolajKonarski Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.3
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: GHC accepts invalid program Difficulty:
Test Case: rename/should_fail/T5589 Blocked By:
Blocking: Related Tickets:

Description

With todays HEAD, as well as one a couple of moths ago (but not with 7.2, I'm told), the attached program does not cause an error or a warning. The crucial fragment is this

bbb, aaa :: Int
aaa :: Int

With the "bbb" removed, it does lead to error. I guess at least a warning should be issued.

Attachments (4)

test.hs (80 bytes) - added by MikolajKonarski 2 years ago.
0001-Fix-duplicate-type-signature-error-ticket-5589.patch (3.4 KB) - added by michalt 2 years ago.
0002-Fix-warnings-and-whitespace-in-HsBinds.patch (31.6 KB) - added by michalt 2 years ago.
Additional cleanup in HsBinds?.
0001-Test-for-5589.patch (1.5 KB) - added by michalt 2 years ago.
Test from the ticket description.

Download all attachments as: .zip

Change History (9)

Changed 2 years ago by MikolajKonarski

Changed 2 years ago by michalt

Additional cleanup in HsBinds?.

Changed 2 years ago by michalt

Test from the ticket description.

comment:1 Changed 2 years ago by michalt

  • Status changed from new to patch

The problem is caused by changes for #1595. Originally checking for duplicates
was performed by equality test (eqHsSig), but now a signature can have a list
of names so testing for equality obviously isn't enough. The patch checks if the
signatures overlap (i.e. there is at least one name that is in both signatures).
And so for the original example we get:

T5589.hs:4:1:
    Duplicate type signature:
      T5589.hs:4:1-10: aaa :: Int
      T5589.hs:3:1-15: bbb, aaa :: Int

comment:2 Changed 2 years ago by michalt

I should also mention that all the patches validate.

comment:3 Changed 2 years ago by simonpj

Thanks very much. Looks right. I'll check and commit.

comment:4 Changed 2 years ago by michal.terepeta@…

commit 82cd019e0ccf9c097e54b80cc94401863ee98ecd

Author: Michal Terepeta <michal.terepeta@gmail.com>
Date:   Sun Oct 30 12:20:44 2011 +0100

    Fix duplicate type signature error (ticket #5589).

 compiler/hsSyn/HsBinds.lhs  |   29 ++++++++++++++++++-----------
 compiler/rename/RnBinds.lhs |    2 +-
 2 files changed, 19 insertions(+), 12 deletions(-)

comment:5 Changed 2 years ago by simonpj

  • Resolution set to fixed
  • Status changed from patch to closed
  • Test Case set to rename/should_fail/T5589

Fixed, thank you Michael.

Simon

Note: See TracTickets for help on using tickets.