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-11-04 05:42:40 -0500
commitefe714d65f5acfdc1da23b85192ff040f36f6b6a (patch)
treedb7e2db3240671a6be882c09774eb7d7d8e87a0d
parent9ecf4bb1703b94516b8407af4c94afb716b860dd (diff)
downloadhaskell-wip/backport-T17296-and-T17384.tar.gz
Parenthesize GADT return types in pprIfaceConDecl (#17384)wip/backport-T17296-and-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.stdout4
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
5 files changed, 16 insertions, 1 deletions
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'])