Commit aef2b429 authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari

Fix #14817 by not double-printing data family instance kind signatures

Within `pprDataFamInstDecl`, we were invoking `pprFamInstLHS` to
pretty-print a data family instance header, and we were passing `Just` a
kind signature to `pprFamInstLHS` to make it pretty-print the kind
signature alongside it (this is a consequence of commit
d1ef223c). But this is silly, because
then invoke `pp_data_defn`, which //also// pretty-prints the kind
signature, resulting in the kind signature being printed twice by

This fix is simple—pass `Nothing` to `pprFamInstLHS` instead.

Test Plan: make test TEST=T14817

Reviewers: alanz, bgamari, mpickering

Reviewed By: mpickering

Subscribers: mpickering, rwbarton, thomie, carter

GHC Trac Issues: #14817

Differential Revision:
parent 125d1518
......@@ -1555,7 +1555,10 @@ pprDataFamInstDecl top_lvl (DataFamInstDecl { dfid_eqn = HsIB { hsib_body =
= pp_data_defn pp_hdr defn
pp_hdr ctxt = ppr_instance_keyword top_lvl
<+> pprFamInstLHS tycon pats fixity ctxt (dd_kindSig defn)
<+> pprFamInstLHS tycon pats fixity ctxt Nothing
-- No need to pass an explicit kind signature to
-- pprFamInstLHS here, since pp_data_defn already
-- pretty-prints that. See #14817.
pprDataFamInstFlavour :: DataFamInstDecl pass -> SDoc
pprDataFamInstFlavour (DataFamInstDecl { dfid_eqn = HsIB { hsib_body =
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module T14817 where
$([d| data family Foo :: *
data instance Foo :: * |])
T14817.hs:(5,3)-(6,31): Splicing declarations
[d| data family Foo :: *
data instance Foo :: * |]
data family Foo :: GHC.Types.Type
data instance Foo :: GHC.Types.Type
......@@ -399,3 +399,4 @@ test('T14204', normal, compile_fail, ['-v0'])
test('T14060', normal, compile_and_run, ['-v0'])
test('T14646', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T14681', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T14817', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment