[project @ 2001-02-22 13:16:48 by simonpj]
authorsimonpj <unknown>
Thu, 22 Feb 2001 13:16:48 +0000 (13:16 +0000)
committersimonpj <unknown>
Thu, 22 Feb 2001 13:16:48 +0000 (13:16 +0000)
Add more tests

ghc/tests/typecheck/should_compile/tc117.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc117.stderr [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc118.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc118.stderr [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc119.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc119.stderr [new file with mode: 0644]

diff --git a/ghc/tests/typecheck/should_compile/tc117.hs b/ghc/tests/typecheck/should_compile/tc117.hs
new file mode 100644 (file)
index 0000000..d66cd34
--- /dev/null
@@ -0,0 +1,17 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+-- !!! Functional dependencies
+-- This one gave another fail in tcReadMutVar
+
+module M1 where
+
+class HasFoo a foo | a -> foo where
+    foo :: a -> foo
+instance HasFoo Int Int where
+    foo = id
+
+instance HasFoo a b => HasFoo [a] b where
+    foo = foo . head
+
+test:: [[Int]] -> Int
+test = foo
diff --git a/ghc/tests/typecheck/should_compile/tc117.stderr b/ghc/tests/typecheck/should_compile/tc117.stderr
new file mode 100644 (file)
index 0000000..8d1c8b6
--- /dev/null
@@ -0,0 +1 @@
diff --git a/ghc/tests/typecheck/should_compile/tc118.hs b/ghc/tests/typecheck/should_compile/tc118.hs
new file mode 100644 (file)
index 0000000..e5aa41f
--- /dev/null
@@ -0,0 +1,16 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+-- !!! An instance decl with a context containing a free type variable
+-- The interest here is that there's a "b" in the instance decl
+-- context that isn't mentioned in the instance head.  
+
+module ShouldCompile where
+
+class HasConverter a b | a -> b where
+   convert :: a -> b
+data Foo a = MkFoo a
+
+instance (HasConverter a b,Show b) => Show (Foo a) where
+   show (MkFoo value) = show (convert value)
+
diff --git a/ghc/tests/typecheck/should_compile/tc118.stderr b/ghc/tests/typecheck/should_compile/tc118.stderr
new file mode 100644 (file)
index 0000000..8d1c8b6
--- /dev/null
@@ -0,0 +1 @@
diff --git a/ghc/tests/typecheck/should_compile/tc119.hs b/ghc/tests/typecheck/should_compile/tc119.hs
new file mode 100644 (file)
index 0000000..7c86751
--- /dev/null
@@ -0,0 +1,14 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+-- !!! Functional dependencies and existentials
+
+-- Hugs (February 2000) doesn't like it. It says
+--  Variable "e" in constraint is not locally bound
+
+module ShouldCompile where
+
+class Collection c e | c -> e where
+   empty :: c
+   put   :: c -> e -> c
+
+data SomeCollection e = forall c . Collection c e => MakeSomeCollection c
diff --git a/ghc/tests/typecheck/should_compile/tc119.stderr b/ghc/tests/typecheck/should_compile/tc119.stderr
new file mode 100644 (file)
index 0000000..e69de29