diff options
author | simonpj <simonpj@microsoft.com> | 2010-09-19 19:24:05 +0000 |
---|---|---|
committer | simonpj <simonpj@microsoft.com> | 2010-09-19 19:24:05 +0000 |
commit | 5e9a571169e0fec8f626e738b6e10a40564ce663 (patch) | |
tree | 58d8ea161e24a01b016582d97334f4f5d9829aa9 /testsuite/tests/ghc-regress/typecheck | |
parent | 489f296d007e559b069fa9c30daf681a2477d14f (diff) | |
download | haskell-5e9a571169e0fec8f626e738b6e10a40564ce663.tar.gz |
Add tests for Trac #3851, 4200, 3692, 3500
Diffstat (limited to 'testsuite/tests/ghc-regress/typecheck')
7 files changed, 53 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-regress/typecheck/should_compile/T3692.hs b/testsuite/tests/ghc-regress/typecheck/should_compile/T3692.hs new file mode 100644 index 0000000000..b10e184d94 --- /dev/null +++ b/testsuite/tests/ghc-regress/typecheck/should_compile/T3692.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE RankNTypes #-}
+
+module T3692 where
+
+type Foo a b = () -> (Bar a => a)
+
+class Bar a where {}
+
+foo :: Foo a b
+foo = id (undefined :: Foo a b)
diff --git a/testsuite/tests/ghc-regress/typecheck/should_compile/all.T b/testsuite/tests/ghc-regress/typecheck/should_compile/all.T index 8b04db3cfb..95d858d87a 100644 --- a/testsuite/tests/ghc-regress/typecheck/should_compile/all.T +++ b/testsuite/tests/ghc-regress/typecheck/should_compile/all.T @@ -320,4 +320,5 @@ test('T4284', normal, compile, ['']) test('T2683', normal, compile, ['']) test('T3696', normal, compile, ['']) test('T1123', normal, compile, ['']) +test('T3692', normal, compile, ['']) diff --git a/testsuite/tests/ghc-regress/typecheck/should_run/T3500a.hs b/testsuite/tests/ghc-regress/typecheck/should_run/T3500a.hs new file mode 100644 index 0000000000..c3adeb0c61 --- /dev/null +++ b/testsuite/tests/ghc-regress/typecheck/should_run/T3500a.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeFamilies #-} + +module Main where + +type family F a :: * +type instance F Int = (Int, ()) + +class C a +instance C () +instance (C (F a), C b) => C (a, b) + +f :: C (F a) => a -> Int +f _ = 2 + +main :: IO () +main = print (f (3 :: Int)) + diff --git a/testsuite/tests/ghc-regress/typecheck/should_run/T3500a.stdout b/testsuite/tests/ghc-regress/typecheck/should_run/T3500a.stdout new file mode 100644 index 0000000000..78c6baefdd --- /dev/null +++ b/testsuite/tests/ghc-regress/typecheck/should_run/T3500a.stdout @@ -0,0 +1 @@ +2
diff --git a/testsuite/tests/ghc-regress/typecheck/should_run/T3500b.hs b/testsuite/tests/ghc-regress/typecheck/should_run/T3500b.hs new file mode 100644 index 0000000000..59a2c47983 --- /dev/null +++ b/testsuite/tests/ghc-regress/typecheck/should_run/T3500b.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE TypeFamilies, FlexibleContexts, UndecidableInstances #-} + +module Main where + +newtype Mu f = Mu (f (Mu f)) + +type family Id m +type instance Id m = m + +instance Show (Id (f (Mu f))) => Show (Mu f) where + show (Mu f) = show f + + +showMu :: Mu (Either ()) -> String +showMu = show + +item :: Mu (Either ()) +item = Mu (Right (Mu (Left ()))) + +main = print (showMu item) diff --git a/testsuite/tests/ghc-regress/typecheck/should_run/T3500b.stdout b/testsuite/tests/ghc-regress/typecheck/should_run/T3500b.stdout new file mode 100644 index 0000000000..7acb74ffa3 --- /dev/null +++ b/testsuite/tests/ghc-regress/typecheck/should_run/T3500b.stdout @@ -0,0 +1 @@ +"Right Left ()"
diff --git a/testsuite/tests/ghc-regress/typecheck/should_run/all.T b/testsuite/tests/ghc-regress/typecheck/should_run/all.T index 268600714e..fd2e3c4336 100644 --- a/testsuite/tests/ghc-regress/typecheck/should_run/all.T +++ b/testsuite/tests/ghc-regress/typecheck/should_run/all.T @@ -76,3 +76,5 @@ test('IPRun', normal, compile_and_run, ['']) test('T1735', normal, multimod_compile_and_run, ['T1735','']) test('T3731', expect_broken(3731), compile_and_run, ['']) +test('T3500a', normal, compile_and_run, ['']) +test('T3500b', normal, compile_and_run, ['']) |