summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/typecheck/should_fail/T5858.hs11
-rw-r--r--testsuite/tests/typecheck/should_fail/T5858.stderr13
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T3
3 files changed, 26 insertions, 1 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T5858.hs b/testsuite/tests/typecheck/should_fail/T5858.hs
new file mode 100644
index 0000000000..01a991fb44
--- /dev/null
+++ b/testsuite/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/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr
new file mode 100644
index 0000000000..5e0cf1521b
--- /dev/null
+++ b/testsuite/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/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 0459783281..9d4d6a03c4 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/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, [''])