Test Trac #5858
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 9 Mar 2012 13:35:41 +0000 (13:35 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 9 Mar 2012 13:35:41 +0000 (13:35 +0000)
testsuite/tests/typecheck/should_fail/T5858.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T5858.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T5858.hs b/testsuite/tests/typecheck/should_fail/T5858.hs
new file mode 100644 (file)
index 0000000..01a991f
--- /dev/null
@@ -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/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr
new file mode 100644 (file)
index 0000000..5e0cf15
--- /dev/null
@@ -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 ([], [])
index 0459783..9d4d6a0 100644 (file)
@@ -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, [''])