From d79c57bb77d8ed1abd84a09eb15e8c0b6d04b96b Mon Sep 17 00:00:00 2001 From: simonpj Date: Tue, 20 Feb 2001 08:57:46 +0000 Subject: [PATCH] [project @ 2001-02-20 08:57:46 by simonpj] Add fundeps tests --- ghc/tests/typecheck/should_compile/tc112.hs | 12 ++++++++++++ ghc/tests/typecheck/should_compile/tc113.hs | 13 +++++++++++++ ghc/tests/typecheck/should_compile/tc114.hs | 15 +++++++++++++++ ghc/tests/typecheck/should_compile/tc115.hs | 18 ++++++++++++++++++ ghc/tests/typecheck/should_compile/tc116.hs | 18 ++++++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 ghc/tests/typecheck/should_compile/tc112.hs create mode 100644 ghc/tests/typecheck/should_compile/tc112.stderr create mode 100644 ghc/tests/typecheck/should_compile/tc113.hs create mode 100644 ghc/tests/typecheck/should_compile/tc113.stderr create mode 100644 ghc/tests/typecheck/should_compile/tc114.hs create mode 100644 ghc/tests/typecheck/should_compile/tc114.stderr create mode 100644 ghc/tests/typecheck/should_compile/tc115.hs create mode 100644 ghc/tests/typecheck/should_compile/tc115.stderr create mode 100644 ghc/tests/typecheck/should_compile/tc116.hs create mode 100644 ghc/tests/typecheck/should_compile/tc116.stderr diff --git a/ghc/tests/typecheck/should_compile/tc112.hs b/ghc/tests/typecheck/should_compile/tc112.hs new file mode 100644 index 0000000..7f50416 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc112.hs @@ -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 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 index 0000000..b503aef --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc113.hs @@ -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 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 index 0000000..af8c3ca --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc114.hs @@ -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 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 index 0000000..0a12db9 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc115.hs @@ -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 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 index 0000000..cb29a43 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc116.hs @@ -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 index 0000000..e69de29 -- 1.7.10.4