summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-01-16 12:44:58 -0500
committerBen Gamari <ben@smart-cactus.org>2020-01-18 09:50:50 -0500
commit65d159ddf577b3167a4f9869bc795d03b69a4b54 (patch)
tree566177640190383266df971cb57f1deb4cd19dd0
parent30be3bf13a6e72247ff561df1f291370dad79ef9 (diff)
downloadhaskell-wip/T15316.tar.gz
testsuite: Add test for #15316wip/T15316
This is the full testcase for T15316.
-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, [''])