Commit dbdcacfc authored by Ryan Scott's avatar Ryan Scott

Make ppr_tc_args aware of -fprint-explicit-kinds

Summary:
`ppr_tc_args` was printing invisible kind arguments even
when `-fprint-explicit-kinds` wasn't enabled. Easily fixed.

Test Plan: make test TEST=T15341

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15341

Differential Revision: https://phabricator.haskell.org/D4932
parent b6a33861
......@@ -824,11 +824,15 @@ pprParendIfaceTcArgs = ppr_tc_args appPrec
ppr_tc_args :: PprPrec -> IfaceTcArgs -> SDoc
ppr_tc_args ctx_prec args
= let pprTys t ts = ppr_ty ctx_prec t <+> ppr_tc_args ctx_prec ts
= let ppr_rest = ppr_tc_args ctx_prec
pprTys t ts = ppr_ty ctx_prec t <+> ppr_rest ts
in case args of
ITC_Nil -> empty
ITC_Vis t ts -> pprTys t ts
ITC_Invis t ts -> pprTys t ts
ITC_Invis t ts -> sdocWithDynFlags $ \dflags ->
if gopt Opt_PrintExplicitKinds dflags
then pprTys t ts
else ppr_rest ts
-------------------
pprIfaceForAllPart :: [IfaceForAllBndr] -> [IfacePredType] -> SDoc -> SDoc
......
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
module T15341 where
type family Foo (a :: k) :: k where
Foo a = a
:load T15341.hs
:info Foo
:set -fprint-explicit-kinds
:info Foo
type family Foo (a :: k) :: k
where Foo a = a
-- Defined at T15341.hs:5:1
type family Foo k (a :: k) :: k
where Foo k a = a
-- Defined at T15341.hs:5:1
......@@ -15,13 +15,13 @@ type family H (a :: Bool) :: Bool
H :: Bool -> Bool
type family J (a :: [k]) :: Bool
where
J k '[] = 'False
J k (h : t) = 'True
J '[] = 'False
J (h : t) = 'True
-- Defined at T7939.hs:17:1
J :: [k] -> Bool
type family K (a1 :: [a]) :: Maybe a
where
K a '[] = 'Nothing
K a (h : t) = 'Just h
K '[] = 'Nothing
K (h : t) = 'Just h
-- Defined at T7939.hs:21:1
K :: [a] -> Maybe a
......@@ -269,3 +269,4 @@ test('T14676', extra_files(['../prog002']), ghci_script, ['T14676.script'])
test('T14796', normal, ghci_script, ['T14796.script'])
test('T14969', normal, ghci_script, ['T14969.script'])
test('T15259', normal, ghci_script, ['T15259.script'])
test('T15341', normal, ghci_script, ['T15341.script'])
......@@ -27,5 +27,5 @@ ClosedFam3.hs-boot:12:1: error:
Main module: type family Baz a :: *
where Baz Int = Bool
Boot file: type family Baz (a :: k) :: *
where Baz * Int = Bool
where Baz Int = Bool
The types have different kinds
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment