[commit: testsuite] master: Test Trac #7019 (4b8683d)

Simon Peyton Jones simonpj at microsoft.com
Tue Jul 17 17:40:24 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/4b8683db0dbf09fec865f61655c90632f44eef47

>---------------------------------------------------------------

commit 4b8683db0dbf09fec865f61655c90632f44eef47
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Jul 12 17:42:12 2012 +0100

    Test Trac #7019

>---------------------------------------------------------------

 tests/typecheck/should_fail/T7019.hs      |   18 ++++++++++++++++++
 tests/typecheck/should_fail/T7019.stderr  |    6 ++++++
 tests/typecheck/should_fail/T7019a.hs     |   14 ++++++++++++++
 tests/typecheck/should_fail/T7019a.stderr |    6 ++++++
 tests/typecheck/should_fail/all.T         |    2 ++
 5 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/tests/typecheck/should_fail/T7019.hs b/tests/typecheck/should_fail/T7019.hs
new file mode 100644
index 0000000..45df18e
--- /dev/null
+++ b/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/tests/typecheck/should_fail/T7019.stderr b/tests/typecheck/should_fail/T7019.stderr
new file mode 100644
index 0000000..43f1fe5
--- /dev/null
+++ b/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/tests/typecheck/should_fail/T7019a.hs b/tests/typecheck/should_fail/T7019a.hs
new file mode 100644
index 0000000..a4fb4df
--- /dev/null
+++ b/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/tests/typecheck/should_fail/T7019a.stderr b/tests/typecheck/should_fail/T7019a.stderr
new file mode 100644
index 0000000..2859f71
--- /dev/null
+++ b/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/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T
index 0d047bf..9d4367b 100644
--- a/tests/typecheck/should_fail/all.T
+++ b/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,[''])





More information about the Cvs-ghc mailing list