summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2021-11-17 23:57:15 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-18 14:45:20 -0500
commit12d023d1b4706665645cc0783dd1ae67625357a3 (patch)
treee570489aa694be6bd915b78efa63526a59094e44
parentf55ae1803ef0eea3f99243be5dc1bd41eeb69048 (diff)
downloadhaskell-12d023d1b4706665645cc0783dd1ae67625357a3.tar.gz
testsuite: check for FlexibleContexts in T17563
The purpose of testsuite/tests/typecheck/should_fail/T17563.hs is to make sure we do validity checking on quantified constraints. In particular, see the following functions in GHC.Tc.Validity: * check_quant_pred * check_pred_help * check_class_pred The original bug report used a~b constraints as an example of a constraint that requires validity checking. But with GHC Proposal #371, equality constraints no longer require GADTs or TypeFamilies; instead, they require TypeOperators, which are checked earlier in the pipeline, in the renamer. Rather than simply remove this test, we change the example to use another extension: FlexibleContexts. Since we decide whether a constraint requires this extension in check_class_pred, the regression test continues to exercise the relevant code path.
-rw-r--r--testsuite/tests/typecheck/should_fail/T17563.hs6
-rw-r--r--testsuite/tests/typecheck/should_fail/T17563.stderr11
2 files changed, 9 insertions, 8 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T17563.hs b/testsuite/tests/typecheck/should_fail/T17563.hs
index 565cd9f59e..2017db4877 100644
--- a/testsuite/tests/typecheck/should_fail/T17563.hs
+++ b/testsuite/tests/typecheck/should_fail/T17563.hs
@@ -3,5 +3,7 @@
module T17563 where
-blah :: (forall a. a b ~ a c) => b -> c
-blah = undefined
+data T a b
+
+blah :: (forall x. Num (T a x)) => T a b
+blah = 0
diff --git a/testsuite/tests/typecheck/should_fail/T17563.stderr b/testsuite/tests/typecheck/should_fail/T17563.stderr
index 8900a41470..08c077fb7c 100644
--- a/testsuite/tests/typecheck/should_fail/T17563.stderr
+++ b/testsuite/tests/typecheck/should_fail/T17563.stderr
@@ -1,7 +1,6 @@
-T17563.hs:6:9: error:
- • Illegal equational constraint a b ~ a c
- • In the quantified constraint ‘forall (a :: * -> *). a b ~ a c’
- In the type signature: blah :: (forall a. a b ~ a c) => b -> c
- Suggested fix:
- Enable any of the following extensions: GADTs, TypeFamilies
+T17563.hs:8:9: error:
+ • Non type-variable argument in the constraint: Num (T a x)
+ • In the quantified constraint ‘forall x. Num (T a x)’
+ In the type signature: blah :: (forall x. Num (T a x)) => T a b
+ Suggested fix: Perhaps you intended to use FlexibleContexts