Add test for #16575
authorEric Wolf <ericwolf42@gmail.com>
Tue, 25 Jun 2019 18:34:55 +0000 (20:34 +0200)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Tue, 2 Jul 2019 20:19:21 +0000 (16:19 -0400)
just use the test to show the defective behaviour, so we can see
the difference, when it gets fixed

testsuite/tests/ghci/scripts/T16575.hs [new file with mode: 0644]
testsuite/tests/ghci/scripts/T16575.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T16575.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T

diff --git a/testsuite/tests/ghci/scripts/T16575.hs b/testsuite/tests/ghci/scripts/T16575.hs
new file mode 100644 (file)
index 0000000..08cd440
--- /dev/null
@@ -0,0 +1,9 @@
+module Ghost where
+
+data X = A | B
+    deriving (Show)
+
+instance Eq X where
+    A == A = True
+    B == B = True
+    _ == _ = False
diff --git a/testsuite/tests/ghci/scripts/T16575.script b/testsuite/tests/ghci/scripts/T16575.script
new file mode 100644 (file)
index 0000000..0a251bd
--- /dev/null
@@ -0,0 +1,18 @@
+:set +c
+:l T16575.hs
+:all-types
+
+-- data X = A | B
+--     deriving (Show)
+--               ^^^^
+:type-at T16575.hs 4 15 4 19
+-- wrongly outputs:
+--  :: [X] -> ShowS
+
+-- instance Eq X where
+--          ^^^^
+:type-at T16575.hs 6 10 6 14
+-- wrongly outputs:
+-- :: X -> X -> Bool
+
+-- also note how :all-types is inconsistent with :type-at
diff --git a/testsuite/tests/ghci/scripts/T16575.stdout b/testsuite/tests/ghci/scripts/T16575.stdout
new file mode 100644 (file)
index 0000000..833fb02
--- /dev/null
@@ -0,0 +1,26 @@
+Collecting type info for 1 module(s) ... 
+T16575.hs:(4,15)-(4,18): GHC.Types.Int -> Ghost.X -> GHC.Show.ShowS
+T16575.hs:(7,7)-(7,8): Ghost.X -> Ghost.X -> GHC.Types.Bool
+T16575.hs:(4,15)-(4,18): GHC.Show.Show Ghost.X
+T16575.hs:(4,15)-(4,18): ([Ghost.X] -> GHC.Show.ShowS) -> GHC.Show.Show Ghost.X
+T16575.hs:(4,15)-(4,18): (Ghost.X -> GHC.Base.String) -> ([Ghost.X] -> GHC.Show.ShowS) -> GHC.Show.Show Ghost.X
+T16575.hs:(4,15)-(4,18): (GHC.Types.Int -> Ghost.X -> GHC.Show.ShowS) -> (Ghost.X -> GHC.Base.String) -> ([Ghost.X] -> GHC.Show.ShowS) -> GHC.Show.Show Ghost.X
+T16575.hs:(4,15)-(4,18): GHC.Types.Int -> Ghost.X -> GHC.Show.ShowS
+T16575.hs:(4,15)-(4,18): Ghost.X -> GHC.Base.String
+T16575.hs:(4,15)-(4,18): [Ghost.X] -> GHC.Show.ShowS
+T16575.hs:(6,10)-(6,13): GHC.Classes.Eq Ghost.X
+T16575.hs:(6,10)-(6,13): (Ghost.X -> Ghost.X -> GHC.Types.Bool) -> GHC.Classes.Eq Ghost.X
+T16575.hs:(6,10)-(6,13): (Ghost.X -> Ghost.X -> GHC.Types.Bool) -> (Ghost.X -> Ghost.X -> GHC.Types.Bool) -> GHC.Classes.Eq Ghost.X
+T16575.hs:(6,10)-(6,13): Ghost.X -> Ghost.X -> GHC.Types.Bool
+T16575.hs:(6,10)-(6,13): Ghost.X -> Ghost.X -> GHC.Types.Bool
+T16575.hs:(7,14)-(7,17): GHC.Types.Bool
+T16575.hs:(8,14)-(8,17): GHC.Types.Bool
+T16575.hs:(9,14)-(9,18): GHC.Types.Bool
+T16575.hs:(7,5)-(7,5): Ghost.X
+T16575.hs:(7,10)-(7,10): Ghost.X
+T16575.hs:(8,5)-(8,5): Ghost.X
+T16575.hs:(8,10)-(8,10): Ghost.X
+T16575.hs:(9,5)-(9,5): Ghost.X
+T16575.hs:(9,10)-(9,10): Ghost.X
+ :: [X] -> ShowS
+ :: X -> X -> Bool
index 6a16842..e334b7e 100755 (executable)
@@ -300,3 +300,4 @@ test('T16527', normal, ghci_script, ['T16527.script'])
 test('T16563', extra_hc_opts("-clear-package-db -global-package-db"), ghci_script, ['T16563.script'])
 test('T16569', normal, ghci_script, ['T16569.script'])
 test('T16767', normal, ghci_script, ['T16767.script'])
+test('T16575', normal, ghci_script, ['T16575.script'])