Opened 4 years ago

Closed 4 years ago

#4302 closed bug (fixed)

Impossible when deriving empty data declaration

Reported by: mitar Owned by:
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 6.12.3
Keywords: Cc: mmitar@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Difficulty:
Test Case: deriving/should_compile/T4302 Blocked By:
Blocking: Related Tickets:

Description

When trying to load following code into GHCi I get an error:

ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.3 for x86_64-unknown-linux):
	TcGenDeriv:mk_FunBind

Code is:

{-# LANGUAGE StandaloneDeriving, EmptyDataDecls #-}
module Test where
data Test
deriving instance Show (Test)

Probably Test cannot be made instance of Show but still error should be less fatal. ;-)

Change History (2)

comment:1 Changed 4 years ago by igloo

  • Milestone set to 7.2.1

Thanks for the report.

comment:2 Changed 4 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to deriving/should_compile/T4302

Excellent point. This is really the same bug as #4220, but needs a more systematic fix. Done with

Mon Sep 13 18:03:55 BST 2010  simonpj@microsoft.com
  * Fix Trac #4302, plus a little refactoring

    M ./compiler/hsSyn/HsUtils.lhs -13 +1
    M ./compiler/typecheck/TcDeriv.lhs -12 +19
    M ./compiler/typecheck/TcGenDeriv.lhs -28 +48

And I added another test

Simon

Note: See TracTickets for help on using tickets.