summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2019-10-21 14:57:01 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2019-10-23 17:52:59 -0400
commit67cf29f825361f844d311986e88c1d4b51a75531 (patch)
tree3deb8f7ac3ae8c4f0b1862cf9584be63b5f098e1
parent7f72b540288bbdb32a6750dd64b9d366501ed10c (diff)
downloadhaskell-wip/T17384.tar.gz
Parenthesize GADT return types in pprIfaceConDecl (#17384)wip/T17384
We were using `pprIfaceAppArgs` instead of `pprParendIfaceAppArgs` in `pprIfaceConDecl`. Oops. Fixes #17384.
-rw-r--r--compiler/iface/IfaceSyn.hs2
-rw-r--r--testsuite/tests/ghci/scripts/T17384.hs8
-rw-r--r--testsuite/tests/ghci/scripts/T17384.script2
-rw-r--r--testsuite/tests/ghci/scripts/T17384.stdout5
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
5 files changed, 17 insertions, 1 deletions
diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs
index ce4332c27b..f691300157 100644
--- a/compiler/iface/IfaceSyn.hs
+++ b/compiler/iface/IfaceSyn.hs
@@ -1203,7 +1203,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..c610cc5826
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T17384.stdout
@@ -0,0 +1,5 @@
+type role T nominal
+type T :: * -> *
+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 96c63149fb..96ca2eba24 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -312,3 +312,4 @@ test('T16804', extra_files(['T16804a.hs', 'T16804b.hs', 'T16804c.hs']), ghci_scr
test('T15546', normal, ghci_script, ['T15546.script'])
test('T16876', normal, ghci_script, ['T16876.script'])
test('T17345', normal, ghci_script, ['T17345.script'])
+test('T17384', normal, ghci_script, ['T17384.script'])