summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-06-24 21:53:36 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-25 05:20:27 -0400
commit83dce402043532d43635b305eca76a6f1cf4deff (patch)
tree36b96ed01c92e1bd50c790a96d6c13860bbe9b8a
parenteb39981aa22f9a9e827c53103b813842928e5883 (diff)
downloadhaskell-83dce402043532d43635b305eca76a6f1cf4deff.tar.gz
Add regression test for #19921
-rw-r--r--testsuite/tests/quantified-constraints/T19921.hs29
-rw-r--r--testsuite/tests/quantified-constraints/T19921.stderr9
-rw-r--r--testsuite/tests/quantified-constraints/all.T1
3 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/tests/quantified-constraints/T19921.hs b/testsuite/tests/quantified-constraints/T19921.hs
new file mode 100644
index 0000000000..a0ed436784
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T19921.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE
+ QuantifiedConstraints
+ , StandaloneKindSignatures
+ , TypeOperators
+ , GADTs
+ , ConstraintKinds
+ , RankNTypes
+ , UndecidableInstances
+ , ImpredicativeTypes
+#-}
+module Typelevel.Constraint.Repro where
+
+import Data.Kind (Constraint, Type)
+
+type Dict :: Constraint -> Type
+data Dict c
+ where
+ Dict :: c => Dict c
+
+type (⇒) :: Constraint -> Constraint -> Constraint
+type c ⇒ d = c => d
+infixr 0 ⇒
+
+type (\/) :: Constraint -> Constraint -> Constraint
+type a \/ b = (forall r. (a ⇒ r, b ⇒ r) ⇒ r)
+infixr 5 \/
+
+dict :: Dict ((x \/ y) \/ z ⇒ x \/ y \/ z)
+dict = Dict
diff --git a/testsuite/tests/quantified-constraints/T19921.stderr b/testsuite/tests/quantified-constraints/T19921.stderr
new file mode 100644
index 0000000000..0465b10be9
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T19921.stderr
@@ -0,0 +1,9 @@
+
+T19921.hs:29:8: error:
+ • Could not deduce: r arising from a use of ‘Dict’
+ from the context: (x \/ y) \/ z
+ bound by a quantified context at T19921.hs:1:1
+ or from: (x ⇒ r, (y \/ z) ⇒ r)
+ bound by a quantified context at T19921.hs:1:1
+ • In the expression: Dict
+ In an equation for ‘dict’: dict = Dict
diff --git a/testsuite/tests/quantified-constraints/all.T b/testsuite/tests/quantified-constraints/all.T
index 9bcc30b1a9..799eb09638 100644
--- a/testsuite/tests/quantified-constraints/all.T
+++ b/testsuite/tests/quantified-constraints/all.T
@@ -30,3 +30,4 @@ test('T17267d', normal, compile_and_run, [''])
test('T17267e', normal, compile_fail, [''])
test('T17458', normal, compile_fail, [''])
test('T18432', normal, compile, [''])
+test('T19921', normal, compile_fail, [''])