summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/gadt/T7558.hs8
-rw-r--r--testsuite/tests/gadt/T7558.stderr13
-rw-r--r--testsuite/tests/gadt/all.T1
3 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/T7558.hs b/testsuite/tests/gadt/T7558.hs
new file mode 100644
index 0000000000..129704f955
--- /dev/null
+++ b/testsuite/tests/gadt/T7558.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE GADTs #-}
+module T7558 where
+
+data T a b where
+ MkT :: (a~Maybe b) => a -> Maybe b -> T a b
+
+f :: T a a -> Bool
+f (MkT x y) = [x,y] `seq` True
diff --git a/testsuite/tests/gadt/T7558.stderr b/testsuite/tests/gadt/T7558.stderr
new file mode 100644
index 0000000000..cf5d73dce8
--- /dev/null
+++ b/testsuite/tests/gadt/T7558.stderr
@@ -0,0 +1,13 @@
+
+T7558.hs:8:4:
+ Couldn't match type ‛a’ with ‛Maybe a’
+ ‛a’ is a rigid type variable bound by
+ the type signature for f :: T a a -> Bool at T7558.hs:7:6
+ Inaccessible code in
+ a pattern with constructor
+ MkT :: forall a b. a ~ Maybe b => a -> Maybe b -> T a b,
+ in an equation for ‛f’
+ Relevant bindings include
+ f :: T a a -> Bool (bound at T7558.hs:8:1)
+ In the pattern: MkT x y
+ In an equation for ‛f’: f (MkT x y) = [x, y] `seq` True
diff --git a/testsuite/tests/gadt/all.T b/testsuite/tests/gadt/all.T
index e3e92df69c..1be8260363 100644
--- a/testsuite/tests/gadt/all.T
+++ b/testsuite/tests/gadt/all.T
@@ -121,3 +121,4 @@ test('T7321',
run_command,
['$MAKE -s --no-print-directory T7321'])
test('T7974', normal, compile, [''])
+test('T7558', normal, compile_fail, [''])