summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-06-24 21:53:36 +0530
committerZubin Duggal <zubin.duggal@gmail.com>2021-06-24 21:53:36 +0530
commit9f88adc462cbde8c84043bb1f0d48ba9fb220c14 (patch)
tree11d993ca3ba984427275d7baf9578c9001d4b11b
parent38a6d8b8ce838d09a918a536ac80427d5555ca6d (diff)
downloadhaskell-wip/T19921.tar.gz
Add regression test for #19921wip/T19921
-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, [''])