summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail
diff options
context:
space:
mode:
authorSimon Peyton Jones <simon.peytonjones@gmail.com>2022-12-19 22:58:07 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-21 14:32:30 -0500
commit3d55d8ab51ece43c51055c43c9e7aba77cce46c0 (patch)
tree5f4450f04c43ca0e56342d2f9f8312f576e4a5bf /testsuite/tests/typecheck/should_fail
parente193e53790dd5886feea3cf4c9c17625d188291b (diff)
downloadhaskell-3d55d8ab51ece43c51055c43c9e7aba77cce46c0.tar.gz
Fix an assertion check in addToEqualCtList
The old assertion saw that a constraint ct could rewrite itself (of course it can) and complained (stupid). Fixes #22645
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
-rw-r--r--testsuite/tests/typecheck/should_fail/T22645.hs9
-rw-r--r--testsuite/tests/typecheck/should_fail/T22645.stderr15
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
3 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T22645.hs b/testsuite/tests/typecheck/should_fail/T22645.hs
new file mode 100644
index 0000000000..ee5f03d180
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T22645.hs
@@ -0,0 +1,9 @@
+module T22645 where
+
+import Data.Coerce
+
+type T :: (* -> *) -> * -> *
+data T m a = MkT (m a)
+
+p :: Coercible a b => T Maybe a -> T Maybe b
+p = coerce
diff --git a/testsuite/tests/typecheck/should_fail/T22645.stderr b/testsuite/tests/typecheck/should_fail/T22645.stderr
new file mode 100644
index 0000000000..359d6c5b73
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T22645.stderr
@@ -0,0 +1,15 @@
+
+T22645.hs:9:5: error: [GHC-25897]
+ • Couldn't match type ‘a’ with ‘b’ arising from a use of ‘coerce’
+ ‘a’ is a rigid type variable bound by
+ the type signature for:
+ p :: forall a b. Coercible a b => T Maybe a -> T Maybe b
+ at T22645.hs:8:1-44
+ ‘b’ is a rigid type variable bound by
+ the type signature for:
+ p :: forall a b. Coercible a b => T Maybe a -> T Maybe b
+ at T22645.hs:8:1-44
+ • In the expression: coerce
+ In an equation for ‘p’: p = coerce
+ • Relevant bindings include
+ p :: T Maybe a -> T Maybe b (bound at T22645.hs:9:1)
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index a99792e5ab..7d7b7f0369 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -666,3 +666,4 @@ test('T21447', normal, compile_fail, [''])
test('T21530a', normal, compile_fail, [''])
test('T21530b', normal, compile_fail, [''])
test('T22570', normal, compile_fail, [''])
+test('T22645', normal, compile_fail, [''])