summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2019-10-29 15:18:22 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-11-01 04:56:38 -0400
commitd2471964ef06219811c03c2ed0710f9ff98e97ef (patch)
treeef56b832f3d30c07387eab8feb82486ce71b2036
parent35c99e720ddbb3ce1355d63c9fb68ef156b9f586 (diff)
downloadhaskell-d2471964ef06219811c03c2ed0710f9ff98e97ef.tar.gz
Add another test for #17267
This one came in a comment from James Payor
-rw-r--r--testsuite/tests/quantified-constraints/T17267e.hs27
-rw-r--r--testsuite/tests/quantified-constraints/T17267e.stderr13
-rw-r--r--testsuite/tests/quantified-constraints/all.T1
3 files changed, 41 insertions, 0 deletions
diff --git a/testsuite/tests/quantified-constraints/T17267e.hs b/testsuite/tests/quantified-constraints/T17267e.hs
new file mode 100644
index 0000000000..0b00995ab2
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T17267e.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE QuantifiedConstraints #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE MonoLocalBinds #-}
+
+module Main where
+
+class Show a => Thing a b
+instance Show a => Thing a b
+
+class (Show a => Thing a ()) => PseudoShow a b
+instance PseudoShow a b
+
+pseudoShow :: PseudoShow a () => a -> String
+pseudoShow = show
+
+
+{-
+ [G] PseudoShow a ()
+(and hence by SC)
+ [G] Show a => Thing a ()
+(and hence by SC)
+ [G] Show a => Show a
+The latter loops
+-}
+
diff --git a/testsuite/tests/quantified-constraints/T17267e.stderr b/testsuite/tests/quantified-constraints/T17267e.stderr
new file mode 100644
index 0000000000..b497fa1009
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T17267e.stderr
@@ -0,0 +1,13 @@
+
+T17267e.hs:1:1: error:
+ The IO action ‘main’ is not defined in module ‘Main’
+
+T17267e.hs:16:14: error:
+ • Reduction stack overflow; size = 201
+ When simplifying the following type: Show a
+ Use -freduction-depth=0 to disable this check
+ (any upper bound you could choose might fail unpredictably with
+ minor updates to GHC, so disabling the check is recommended if
+ you're sure that type checking should terminate)
+ • In the expression: show
+ In an equation for ‘pseudoShow’: pseudoShow = show
diff --git a/testsuite/tests/quantified-constraints/all.T b/testsuite/tests/quantified-constraints/all.T
index 7fb728654a..6a1d41eeee 100644
--- a/testsuite/tests/quantified-constraints/all.T
+++ b/testsuite/tests/quantified-constraints/all.T
@@ -26,3 +26,4 @@ test('T17267a', normal, compile_fail, [''])
test('T17267b', normal, compile_fail, [''])
test('T17267c', normal, compile_fail, [''])
test('T17267d', normal, compile_and_run, [''])
+test('T17267e', normal, compile_fail, [''])