diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-08-16 11:01:54 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-08-16 11:01:54 +0100 |
commit | 5bf960ef1f3b3064d3eaf08339a5ec8b83fc5601 (patch) | |
tree | fe6ccb050ff5a372c0f8c590d08ae4d3ee8bce5c | |
parent | 702014518906c60943ffdba27c69b366fdd8d2b1 (diff) | |
download | haskell-5bf960ef1f3b3064d3eaf08339a5ec8b83fc5601.tar.gz |
Test Trac #1897
6 files changed, 31 insertions, 1 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T1897b.hs b/testsuite/tests/indexed-types/should_fail/T1897b.hs new file mode 100644 index 0000000000..17f53cd16b --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T1897b.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE TypeFamilies #-} + +module T1897b where + +import Control.Monad +import Data.Maybe + +class Bug s where + type Depend s + + next :: s -> Depend s -> Maybe s + start :: s + +-- isValid :: (Bug s) => [Depend s] -> Bool +-- Inferred type should be rejected as ambiguous +isValid ds = isJust $ foldM next start ds diff --git a/testsuite/tests/indexed-types/should_fail/T1987b.stderr b/testsuite/tests/indexed-types/should_fail/T1987b.stderr new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T1987b.stderr @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index f2d904d32e..bc3d121f24 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -69,4 +69,4 @@ test('DerivUnsatFam', if_compiler_lt('ghc', '7.1', expect_fail), compile_fail, [ test('T2664', normal, compile_fail, ['']) test('T2664a', normal, compile, ['']) test('T2544', normal, compile_fail, ['']) - +test('T1897b', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/T1897a.hs b/testsuite/tests/typecheck/should_fail/T1897a.hs new file mode 100644 index 0000000000..e4ec66afd0 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T1897a.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE MultiParamTypeClasses #-} + +module Foo where + +class Wob a b where + to :: a -> b + from :: b -> a + +foo x = [x, to (from x)] +-- Ambiguous type: Wob a b => b -> [b] +-- Should be rejected diff --git a/testsuite/tests/typecheck/should_fail/T1987a.stderr b/testsuite/tests/typecheck/should_fail/T1987a.stderr new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T1987a.stderr @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index fb7938798a..283be2fc69 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -244,3 +244,4 @@ test('T5236',normal,compile_fail,['']) test('T5246',normal,compile_fail,['']) test('T5300',normal,compile_fail,['']) test('T5095',normal,compile_fail,['']) +test('T1897a',normal,compile_fail,['']) |