Skip to content
Snippets Groups Projects
Commit 0074a08e authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari
Browse files

Fix #14692 by correcting an off-by-one error in TcGenDeriv

A silly mistake in `gen_Show_binds` was causing derived
`Show` instances for empty data types to case on the precedence
argument instead of the actual value being showed.

Test Plan: make test TEST=drv-empty-data

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14692

Differential Revision: https://phabricator.haskell.org/D4328
parent 765ba657
No related merge requests found
......@@ -1132,7 +1132,7 @@ gen_Show_binds get_fixity loc tycon
= (unitBag shows_prec, emptyBag)
where
data_cons = tyConDataCons tycon
shows_prec = mkFunBindEC 1 loc showsPrec_RDR id (map pats_etc data_cons)
shows_prec = mkFunBindEC 2 loc showsPrec_RDR id (map pats_etc data_cons)
comma_space = nlHsVar showCommaSpace_RDR
pats_etc data_con
......
......@@ -7,7 +7,7 @@ Derived class instances:
GHC.Read.readListPrec = GHC.Read.readListPrecDefault
instance GHC.Show.Show (DrvEmptyData.Void a) where
GHC.Show.showsPrec z = case z of
GHC.Show.showsPrec _ z = case z of
instance GHC.Classes.Ord (DrvEmptyData.Void a) where
GHC.Classes.compare _ z = GHC.Types.EQ
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment