From efe714d65f5acfdc1da23b85192ff040f36f6b6a Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Mon, 21 Oct 2019 14:57:01 -0400 Subject: Parenthesize GADT return types in pprIfaceConDecl (#17384) We were using `pprIfaceAppArgs` instead of `pprParendIfaceAppArgs` in `pprIfaceConDecl`. Oops. Fixes #17384. --- compiler/iface/IfaceSyn.hs | 2 +- testsuite/tests/ghci/scripts/T17384.hs | 8 ++++++++ testsuite/tests/ghci/scripts/T17384.script | 2 ++ testsuite/tests/ghci/scripts/T17384.stdout | 4 ++++ testsuite/tests/ghci/scripts/all.T | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 testsuite/tests/ghci/scripts/T17384.hs create mode 100644 testsuite/tests/ghci/scripts/T17384.script create mode 100644 testsuite/tests/ghci/scripts/T17384.stdout diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 562d816938..c3f8933576 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -1114,7 +1114,7 @@ pprIfaceConDecl ss gadt_style tycon tc_binders parent -- [VarBndrs, TyCoVarBinders, TyConBinders, and visibility] in TyCoRep.) ppr_tc_app gadt_subst = pprPrefixIfDeclBndr how_much (occName tycon) - <+> pprIfaceAppArgs + <+> pprParendIfaceAppArgs (substIfaceAppArgs gadt_subst (mk_tc_app_args tc_binders)) mk_tc_app_args :: [IfaceTyConBinder] -> IfaceAppArgs diff --git a/testsuite/tests/ghci/scripts/T17384.hs b/testsuite/tests/ghci/scripts/T17384.hs new file mode 100644 index 0000000000..ce9216b59f --- /dev/null +++ b/testsuite/tests/ghci/scripts/T17384.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +module T17384 where + +import Data.Kind + +data T :: Type -> Type where + MkT :: T (Maybe Bool) diff --git a/testsuite/tests/ghci/scripts/T17384.script b/testsuite/tests/ghci/scripts/T17384.script new file mode 100644 index 0000000000..7274d86aaf --- /dev/null +++ b/testsuite/tests/ghci/scripts/T17384.script @@ -0,0 +1,2 @@ +:load T17384 +:info T diff --git a/testsuite/tests/ghci/scripts/T17384.stdout b/testsuite/tests/ghci/scripts/T17384.stdout new file mode 100644 index 0000000000..189cc4b6cc --- /dev/null +++ b/testsuite/tests/ghci/scripts/T17384.stdout @@ -0,0 +1,4 @@ +type role T nominal +data T a where + MkT :: T (Maybe Bool) + -- Defined at T17384.hs:7:1 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 708bd9f8f9..f5ae669a67 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -299,3 +299,4 @@ test('T16509', normal, ghci_script, ['T16509.script']) test('T16527', normal, ghci_script, ['T16527.script']) test('T16563', extra_hc_opts("-clear-package-db -global-package-db"), ghci_script, ['T16563.script']) test('T16767', normal, ghci_script, ['T16767.script']) +test('T17384', normal, ghci_script, ['T17384.script']) -- cgit v1.2.1