From 72aac89b9ca98591b7f936e80021749b5d8dff76 Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 22 Feb 2001 13:16:48 +0000 Subject: [PATCH] [project @ 2001-02-22 13:16:48 by simonpj] Add more tests --- ghc/tests/typecheck/should_compile/tc117.hs | 17 +++++++++++++++++ ghc/tests/typecheck/should_compile/tc117.stderr | 1 + ghc/tests/typecheck/should_compile/tc118.hs | 16 ++++++++++++++++ ghc/tests/typecheck/should_compile/tc118.stderr | 1 + ghc/tests/typecheck/should_compile/tc119.hs | 14 ++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 ghc/tests/typecheck/should_compile/tc117.hs create mode 100644 ghc/tests/typecheck/should_compile/tc117.stderr create mode 100644 ghc/tests/typecheck/should_compile/tc118.hs create mode 100644 ghc/tests/typecheck/should_compile/tc118.stderr create mode 100644 ghc/tests/typecheck/should_compile/tc119.hs create mode 100644 ghc/tests/typecheck/should_compile/tc119.stderr diff --git a/ghc/tests/typecheck/should_compile/tc117.hs b/ghc/tests/typecheck/should_compile/tc117.hs new file mode 100644 index 0000000..d66cd34 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc117.hs @@ -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 index 0000000..8d1c8b6 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc117.stderr @@ -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 index 0000000..e5aa41f --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc118.hs @@ -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 index 0000000..8d1c8b6 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc118.stderr @@ -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 index 0000000..7c86751 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc119.hs @@ -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 index 0000000..e69de29 -- 1.7.10.4