summaryrefslogtreecommitdiff
path: root/testsuite/tests/quantified-constraints
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-01-16 12:44:58 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-08 10:21:16 -0500
commit047d3d75b2861e6dd3c0ba21daf50b012e5a7fd3 (patch)
treefbe480d0bc5348860a17e2cdc47e216331ebf89d /testsuite/tests/quantified-constraints
parent545cf1e184a37295245086040750d77a809db16e (diff)
downloadhaskell-047d3d75b2861e6dd3c0ba21daf50b012e5a7fd3.tar.gz
testsuite: Add test for #15316
This is the full testcase for T15316.
Diffstat (limited to 'testsuite/tests/quantified-constraints')
-rw-r--r--testsuite/tests/quantified-constraints/T15316A.hs16
-rw-r--r--testsuite/tests/quantified-constraints/T15316A.stderr11
-rw-r--r--testsuite/tests/quantified-constraints/all.T1
3 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/quantified-constraints/T15316A.hs b/testsuite/tests/quantified-constraints/T15316A.hs
new file mode 100644
index 0000000000..d48c46ed7d
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T15316A.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE RankNTypes, QuantifiedConstraints, ConstraintKinds, UndecidableInstances #-}
+
+-- Should produce a compile time "Reduction stack overflow" error
+module T15316A where
+
+import Data.Proxy
+
+class Class a where
+ method :: a
+
+subsume :: (Class a => Class b) => Proxy a -> Proxy b -> ((Class a => Class b) => r) -> r
+subsume _ _ x = x
+
+value :: Proxy a -> a
+value p = subsume p p method
+
diff --git a/testsuite/tests/quantified-constraints/T15316A.stderr b/testsuite/tests/quantified-constraints/T15316A.stderr
new file mode 100644
index 0000000000..7a4823caa0
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T15316A.stderr
@@ -0,0 +1,11 @@
+
+T15316A.hs:15:23:
+ Reduction stack overflow; size = 201
+ When simplifying the following type: Class 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 third argument of ‘subsume’, namely ‘method’
+ In the expression: subsume p p method
+ In an equation for ‘value’: value p = subsume p p method
diff --git a/testsuite/tests/quantified-constraints/all.T b/testsuite/tests/quantified-constraints/all.T
index ee32339dab..da3a6fecec 100644
--- a/testsuite/tests/quantified-constraints/all.T
+++ b/testsuite/tests/quantified-constraints/all.T
@@ -15,6 +15,7 @@ test('T15290', normal, compile, [''])
test('T15290a', normal, compile_fail, [''])
test('T15290b', normal, compile_fail, [''])
test('T15316', normal, compile_fail, [''])
+test('T15316A', normal, compile_fail, [''])
test('T15334', normal, compile_fail, [''])
test('T15359', normal, compile, [''])
test('T15359a', normal, compile, [''])