[project @ 2001-02-20 08:57:46 by simonpj]
authorsimonpj <unknown>
Tue, 20 Feb 2001 08:57:46 +0000 (08:57 +0000)
committersimonpj <unknown>
Tue, 20 Feb 2001 08:57:46 +0000 (08:57 +0000)
Add fundeps tests

ghc/tests/typecheck/should_compile/tc112.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc112.stderr [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc113.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc113.stderr [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc114.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc114.stderr [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc115.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc115.stderr [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc116.hs [new file with mode: 0644]
ghc/tests/typecheck/should_compile/tc116.stderr [new file with mode: 0644]

diff --git a/ghc/tests/typecheck/should_compile/tc112.hs b/ghc/tests/typecheck/should_compile/tc112.hs
new file mode 100644 (file)
index 0000000..7f50416
--- /dev/null
@@ -0,0 +1,12 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+-- !!! Functional dependencies
+-- This broke an early impl of functional dependencies
+-- (complaint about ambiguity)
+
+module ShouldCompile where
+
+class C a b | a -> b where f :: a -> b
+
+g :: (C a b, Eq b) => a -> Bool
+g x = f x == f x
diff --git a/ghc/tests/typecheck/should_compile/tc112.stderr b/ghc/tests/typecheck/should_compile/tc112.stderr
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ghc/tests/typecheck/should_compile/tc113.hs b/ghc/tests/typecheck/should_compile/tc113.hs
new file mode 100644 (file)
index 0000000..b503aef
--- /dev/null
@@ -0,0 +1,13 @@
+-- !!! Monomorphism restriction
+
+module ShouldCompile
+
+foo :: Eq a => a -> b -> b
+foo x y = y
+
+-- Expect test2 :: forall b. b->b
+-- despite the monomorphism restriction
+poly = foo (3::Int)
+
+-- Check that test2 is polymorphic
+test = (poly True, poly 'c')
diff --git a/ghc/tests/typecheck/should_compile/tc113.stderr b/ghc/tests/typecheck/should_compile/tc113.stderr
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ghc/tests/typecheck/should_compile/tc114.hs b/ghc/tests/typecheck/should_compile/tc114.hs
new file mode 100644 (file)
index 0000000..af8c3ca
--- /dev/null
@@ -0,0 +1,15 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+-- !!! Functional dependencies
+-- This broke an early impl of functional dependencies
+
+module ShouldCompile where
+
+class Foo r a | r -> a where
+    foo :: a -> r
+
+instance Foo (Maybe e) e where
+    foo = Just
+
+bad:: Num e => Maybe e
+bad = foo 0
diff --git a/ghc/tests/typecheck/should_compile/tc114.stderr b/ghc/tests/typecheck/should_compile/tc114.stderr
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ghc/tests/typecheck/should_compile/tc115.hs b/ghc/tests/typecheck/should_compile/tc115.hs
new file mode 100644 (file)
index 0000000..0a12db9
--- /dev/null
@@ -0,0 +1,18 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+-- !!! Functional dependencies
+-- This broke an early impl of functional dependencies
+-- (complaining about ambiguity)
+
+module ShouldCompile where
+
+class Foo r a | r -> a where
+    foo :: r -> a
+
+instance Foo [m a] (m a)
+
+bad:: Monad m => m a
+bad = foo bar
+
+bar:: Monad m => [m a]
+bar = []
diff --git a/ghc/tests/typecheck/should_compile/tc115.stderr b/ghc/tests/typecheck/should_compile/tc115.stderr
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ghc/tests/typecheck/should_compile/tc116.hs b/ghc/tests/typecheck/should_compile/tc116.hs
new file mode 100644 (file)
index 0000000..cb29a43
--- /dev/null
@@ -0,0 +1,18 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+-- !!! Functional dependencies
+-- This broke an early impl of functional dependencies
+-- (caused a panic)
+
+module ShouldCompile where
+
+class Foo r a | r -> a where
+    foo :: r -> a
+
+instance Foo [m a] (m a)
+
+bad:: Monad m => m a
+bad = foo bar
+
+bar:: [m a]
+bar = []
diff --git a/ghc/tests/typecheck/should_compile/tc116.stderr b/ghc/tests/typecheck/should_compile/tc116.stderr
new file mode 100644 (file)
index 0000000..e69de29