summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wolf <ericwolf42@gmail.com>2019-06-25 20:34:55 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-02 16:19:21 -0400
commit294b55dcff51fb9e419889d7262c7f053c919623 (patch)
treeda099fe53b9f8d95251a487805b62ca7663cae29
parentcef80c0b9edca3d21b5c762f51dfbab4c5857d8a (diff)
downloadhaskell-294b55dcff51fb9e419889d7262c7f053c919623.tar.gz
Add test for #16575
just use the test to show the defective behaviour, so we can see the difference, when it gets fixed
-rw-r--r--testsuite/tests/ghci/scripts/T16575.hs9
-rw-r--r--testsuite/tests/ghci/scripts/T16575.script18
-rw-r--r--testsuite/tests/ghci/scripts/T16575.stdout26
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
4 files changed, 54 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T16575.hs b/testsuite/tests/ghci/scripts/T16575.hs
new file mode 100644
index 0000000000..08cd440d5c
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T16575.hs
@@ -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
index 0000000000..0a251bddc0
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T16575.script
@@ -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
index 0000000000..833fb02d80
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T16575.stdout
@@ -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
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 6a16842ac7..e334b7e962 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -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'])