[commit: testsuite] master: Test Trac #5858 (6b1fc9d)

Simon Peyton Jones simonpj at microsoft.com
Fri Mar 9 16:07:23 CET 2012


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/6b1fc9d987b8f266f9eaa838616d493b353e880e

>---------------------------------------------------------------

commit 6b1fc9d987b8f266f9eaa838616d493b353e880e
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Mar 9 13:35:41 2012 +0000

    Test Trac #5858

>---------------------------------------------------------------

 tests/typecheck/should_fail/T5858.hs     |   11 +++++++++++
 tests/typecheck/should_fail/T5858.stderr |   13 +++++++++++++
 tests/typecheck/should_fail/all.T        |    3 ++-
 3 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/tests/typecheck/should_fail/T5858.hs b/tests/typecheck/should_fail/T5858.hs
new file mode 100644
index 0000000..01a991f
--- /dev/null
+++ b/tests/typecheck/should_fail/T5858.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE FlexibleInstances, GADTs #-}
+module T5858 where
+
+class InferOverloaded a where
+  infer :: a -> String
+
+-- instance (t1 ~ String, t2 ~ String) => InferOverloaded (t1,t2) where
+instance (t1 ~ String) => InferOverloaded (t1,t1) where
+  infer = show . fst
+  
+foo = infer ([],[])
diff --git a/tests/typecheck/should_fail/T5858.stderr b/tests/typecheck/should_fail/T5858.stderr
new file mode 100644
index 0000000..5e0cf15
--- /dev/null
+++ b/tests/typecheck/should_fail/T5858.stderr
@@ -0,0 +1,13 @@
+
+T5858.hs:11:7:
+    No instance for (InferOverloaded ([a0], [a1]))
+      arising from a use of `infer'
+    The type variables `a0', `a1' are ambiguous
+    Possible fix: add a type signature that fixes these type variable(s)
+    Note: there is a potential instance available:
+      instance t1 ~ String => InferOverloaded (t1, t1)
+        -- Defined at T5858.hs:8:10
+    Possible fix:
+      add an instance declaration for (InferOverloaded ([a0], [a1]))
+    In the expression: infer ([], [])
+    In an equation for `foo': foo = infer ([], [])
diff --git a/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T
index 0459783..9d4d6a0 100644
--- a/tests/typecheck/should_fail/all.T
+++ b/tests/typecheck/should_fail/all.T
@@ -269,4 +269,5 @@ test('T5570', normal, compile_fail, [''])
 test('T5573a', normal, compile_fail, [''])
 test('T5573b', normal, compile_fail, [''])
 test('T5689', normal, compile_fail, [''])
-test('T5684', normal, compile_fail, [''])
\ No newline at end of file
+test('T5684', normal, compile_fail, [''])
+test('T5858', normal, compile_fail, [''])





More information about the Cvs-ghc mailing list