Opened 2 years ago

Closed 2 years ago

#5628 closed bug (fixed)

Deriving Eq on bottom types breaks reflexivity of (==)

Reported by: tinctorius Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Difficulty:
Test Case: deriving/should_run/T5628 Blocked By:
Blocking: Related Tickets:

Description

Related to #4220 and #4302.

{-# LANGUAGE EmptyDataDecls, StandaloneDeriving #-}
data Z
deriving instance Eq Z
g :: Z
g = g
main :: IO ()
main = print (g == g)

Observed output ((==) not reflexive anymore?):

False

Expected output (this is what TcGenDeriv.mkRdrFunBind does for Show etc.):

"*** Exception: Void (==)

Change History (4)

comment:1 Changed 2 years ago by tinctorius

  • Version changed from 7.0.3 to 7.2.1

Confirmed in 7.2.1.

comment:2 Changed 2 years ago by simonpj@…

commit 078b891f9d64c70cc72637be9e6a274275244990

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Tue Nov 15 17:17:28 2011 +0000

    Fix Trac #5628: equality on data types with no constructors

 compiler/typecheck/TcGenDeriv.lhs |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

comment:3 Changed 2 years ago by simonpj

  • Test Case set to deriving/should_run/T5628

Good point, thank you. Fixed as above.

Simon

comment:4 Changed 2 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.