Parenthesize GADT return types in pprIfaceConDecl (#17384)
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 21 Oct 2019 18:57:01 +0000 (14:57 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Thu, 24 Oct 2019 12:46:19 +0000 (08:46 -0400)
We were using `pprIfaceAppArgs` instead of `pprParendIfaceAppArgs`
in `pprIfaceConDecl`. Oops.

Fixes #17384.

compiler/iface/IfaceSyn.hs
testsuite/tests/ghci/scripts/T17384.hs [new file with mode: 0644]
testsuite/tests/ghci/scripts/T17384.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T17384.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T

index ce4332c..f691300 100644 (file)
@@ -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 (file)
index 0000000..ce9216b
--- /dev/null
@@ -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 (file)
index 0000000..7274d86
--- /dev/null
@@ -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 (file)
index 0000000..c610cc5
--- /dev/null
@@ -0,0 +1,5 @@
+type role T nominal
+type T :: * -> *
+data T a where
+  MkT :: T (Maybe Bool)
+       -- Defined at T17384.hs:7:1
index 96c6314..96ca2eb 100755 (executable)
@@ -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'])