[commit: testsuite] master: Test Trac #1897 (d339313)

Simon Peyton Jones simonpj at microsoft.com
Tue Aug 16 12:46:49 CEST 2011


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d339313eb7efee01207c22a790308d8bf6ffcb48

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

commit d339313eb7efee01207c22a790308d8bf6ffcb48
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Aug 16 11:01:54 2011 +0100

    Test Trac #1897

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

 tests/indexed-types/should_fail/T1897b.hs     |   16 ++++++++++++++++
 tests/indexed-types/should_fail/T1987b.stderr |    1 +
 tests/indexed-types/should_fail/all.T         |    2 +-
 tests/typecheck/should_fail/T1897a.hs         |   11 +++++++++++
 tests/typecheck/should_fail/T1987a.stderr     |    1 +
 tests/typecheck/should_fail/all.T             |    1 +
 6 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/tests/indexed-types/should_fail/T1897b.hs b/tests/indexed-types/should_fail/T1897b.hs
new file mode 100644
index 0000000..17f53cd
--- /dev/null
+++ b/tests/indexed-types/should_fail/T1897b.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module T1897b where
+
+import Control.Monad
+import Data.Maybe
+
+class Bug s where
+  type Depend s 
+ 
+  next  :: s -> Depend s -> Maybe s
+  start :: s
+  
+-- isValid :: (Bug s) => [Depend s] -> Bool
+-- Inferred type should be rejected as ambiguous
+isValid ds = isJust $ foldM next start ds
diff --git a/tests/indexed-types/should_fail/T1987b.stderr b/tests/indexed-types/should_fail/T1987b.stderr
new file mode 100644
index 0000000..0519ecb
--- /dev/null
+++ b/tests/indexed-types/should_fail/T1987b.stderr
@@ -0,0 +1 @@
+ 
\ No newline at end of file
diff --git a/tests/indexed-types/should_fail/all.T b/tests/indexed-types/should_fail/all.T
index f2d904d..bc3d121 100644
--- a/tests/indexed-types/should_fail/all.T
+++ b/tests/indexed-types/should_fail/all.T
@@ -69,4 +69,4 @@ test('DerivUnsatFam', if_compiler_lt('ghc', '7.1', expect_fail), compile_fail, [
 test('T2664', normal, compile_fail, [''])
 test('T2664a', normal, compile, [''])
 test('T2544', normal, compile_fail, [''])
-
+test('T1897b', normal, compile_fail, [''])
diff --git a/tests/typecheck/should_fail/T1897a.hs b/tests/typecheck/should_fail/T1897a.hs
new file mode 100644
index 0000000..e4ec66a
--- /dev/null
+++ b/tests/typecheck/should_fail/T1897a.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE MultiParamTypeClasses #-}
+
+module Foo where
+
+class Wob a b where
+   to :: a -> b
+   from :: b -> a
+
+foo x = [x, to (from x)]
+-- Ambiguous type:  Wob a b => b -> [b]
+-- Should be rejected
diff --git a/tests/typecheck/should_fail/T1987a.stderr b/tests/typecheck/should_fail/T1987a.stderr
new file mode 100644
index 0000000..0519ecb
--- /dev/null
+++ b/tests/typecheck/should_fail/T1987a.stderr
@@ -0,0 +1 @@
+ 
\ No newline at end of file
diff --git a/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T
index fb79387..283be2f 100644
--- a/tests/typecheck/should_fail/all.T
+++ b/tests/typecheck/should_fail/all.T
@@ -244,3 +244,4 @@ test('T5236',normal,compile_fail,[''])
 test('T5246',normal,compile_fail,[''])
 test('T5300',normal,compile_fail,[''])
 test('T5095',normal,compile_fail,[''])
+test('T1897a',normal,compile_fail,[''])





More information about the Cvs-ghc mailing list