summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-07-12 17:42:12 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-07-12 17:42:12 +0100
commit8197fe804d515d6fff64aa86e662de283ae0fe90 (patch)
tree1e17c88cd60998a4cb95c0b99733379d2fefdafe /testsuite/tests/typecheck/should_fail
parentad859f5c8de95465edbe1f5f174b56d771e8fc57 (diff)
downloadhaskell-8197fe804d515d6fff64aa86e662de283ae0fe90.tar.gz
Test Trac #7019
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
-rw-r--r--testsuite/tests/typecheck/should_fail/T7019.hs18
-rw-r--r--testsuite/tests/typecheck/should_fail/T7019.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/T7019a.hs14
-rw-r--r--testsuite/tests/typecheck/should_fail/T7019a.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T2
5 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T7019.hs b/testsuite/tests/typecheck/should_fail/T7019.hs
new file mode 100644
index 0000000000..45df18ef92
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T7019.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE Rank2Types #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module T7019a where
+
+newtype Free c a = Free { runFree :: forall r. c r => (a -> r) -> r }
+
+type C c = forall a. c (Free c a)
+
+-- Notice that C is a synonym, illegal!
+instance C c => Monad (Free c) where
+ return a = Free ($ a)
+ Free f >>= g = f g
+
+
diff --git a/testsuite/tests/typecheck/should_fail/T7019.stderr b/testsuite/tests/typecheck/should_fail/T7019.stderr
new file mode 100644
index 0000000000..43f1fe5209
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T7019.stderr
@@ -0,0 +1,6 @@
+
+T7019.hs:14:10:
+ Malformed predicate `C c'
+ In the context: (C c)
+ While checking an instance declaration
+ In the instance declaration for `Monad (Free c)'
diff --git a/testsuite/tests/typecheck/should_fail/T7019a.hs b/testsuite/tests/typecheck/should_fail/T7019a.hs
new file mode 100644
index 0000000000..a4fb4df252
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T7019a.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE Rank2Types #-}
+
+module T7019a where
+
+class Context c where
+ func1 :: c -> String
+
+-- Illegal forall in context
+class (forall b. Context (Associated a b)) => Class a where
+ data Associated a :: * -> *
+
+
diff --git a/testsuite/tests/typecheck/should_fail/T7019a.stderr b/testsuite/tests/typecheck/should_fail/T7019a.stderr
new file mode 100644
index 0000000000..2859f716b6
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T7019a.stderr
@@ -0,0 +1,6 @@
+
+T7019a.hs:11:1:
+ Malformed predicate `forall b. Context (Associated a b)'
+ In the context: (forall b. Context (Associated a b))
+ While checking the super-classes of class `Class'
+ In the class declaration for `Class'
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 0d047bf1ad..9d4367b126 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -276,3 +276,5 @@ test('T5853', normal, compile_fail, [''])
test('T6078', normal, compile_fail, [''])
test('FDsFromGivens', normal, compile_fail, [''])
+test('T7019', normal, compile_fail,[''])
+test('T7019a', normal, compile_fail,[''])