summaryrefslogtreecommitdiff
path: root/testsuite/tests/th
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2022-01-14 17:18:21 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-24 20:24:25 -0500
commit06c18990fb6f10aaf1907ba8f0fe3f1a138da159 (patch)
tree65e46821f30a1e31328cdd0f404a245c68ce861c /testsuite/tests/th
parenta5ea78673eae7c837a5ccb7882e908a4df92e75d (diff)
downloadhaskell-06c18990fb6f10aaf1907ba8f0fe3f1a138da159.tar.gz
TH: fix pretty printing of GADTs with multiple constuctors (#20842)
Diffstat (limited to 'testsuite/tests/th')
-rw-r--r--testsuite/tests/th/T19363.stdout3
-rw-r--r--testsuite/tests/th/T20842.hs9
-rw-r--r--testsuite/tests/th/T20842.stdout3
-rw-r--r--testsuite/tests/th/all.T1
4 files changed, 15 insertions, 1 deletions
diff --git a/testsuite/tests/th/T19363.stdout b/testsuite/tests/th/T19363.stdout
index b6d2c30790..fe404302a8 100644
--- a/testsuite/tests/th/T19363.stdout
+++ b/testsuite/tests/th/T19363.stdout
@@ -1,5 +1,6 @@
data Operator_0
- = (:*_1) GHC.Types.Int | (:**_2) {(^**_3) :: GHC.Types.Int}
+ = (:*_1) GHC.Types.Int
+ | (:**_2) {(^**_3) :: GHC.Types.Int}
data (%*%_4) = (:%*%_5)
{-# COMPLETE (:%*%_5) :: (%*%_4) #-}
{-# ANN type (%*%_4) "yargh" #-}
diff --git a/testsuite/tests/th/T20842.hs b/testsuite/tests/th/T20842.hs
new file mode 100644
index 0000000000..6758ea732a
--- /dev/null
+++ b/testsuite/tests/th/T20842.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE TemplateHaskell, GADTs #-}
+module Main where
+
+import Language.Haskell.TH
+
+main :: IO ()
+main = do
+ x <- [d| data MyData where { D1 :: MyData; D2 :: Bool -> MyData } |]
+ putStrLn $ pprint x
diff --git a/testsuite/tests/th/T20842.stdout b/testsuite/tests/th/T20842.stdout
new file mode 100644
index 0000000000..8113be91e4
--- /dev/null
+++ b/testsuite/tests/th/T20842.stdout
@@ -0,0 +1,3 @@
+data MyData_0 where
+ D1_1 :: MyData_0
+ D2_2 :: GHC.Types.Bool -> MyData_0
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index aa953098ce..79cd9ca7d1 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -544,3 +544,4 @@ test('T20590', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T20773', only_ways(['ghci']), ghci_script, ['T20773.script'])
test('T20884', normal, compile_fail, [''])
test('T21038', normal, compile, [''])
+test('T20842', normal, compile_and_run, [''])