summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-12-02 12:08:57 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-12-02 13:28:26 +0000
commit30d260586d46466419b109057ec87d4f097331a1 (patch)
tree3a4a0dc9bb36c9380a2d4afec3f248c41bb2374a
parent26a3d0fe019c52b37ff51d5abcf0d7fdabfa160a (diff)
downloadhaskell-30d260586d46466419b109057ec87d4f097331a1.tar.gz
Test Trac #4921
-rw-r--r--testsuite/tests/typecheck/should_fail/T4921.hs12
-rw-r--r--testsuite/tests/typecheck/should_fail/T4921.stderr19
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
3 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T4921.hs b/testsuite/tests/typecheck/should_fail/T4921.hs
new file mode 100644
index 0000000000..b024967b2e
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T4921.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE MultiParamTypeClasses #-}
+module T4921 where
+
+class C a b where
+ f :: (a,b)
+
+instance C Int Char where
+ f = undefined
+
+x = fst f
+
+y = fst f :: Int
diff --git a/testsuite/tests/typecheck/should_fail/T4921.stderr b/testsuite/tests/typecheck/should_fail/T4921.stderr
new file mode 100644
index 0000000000..c304b05c4b
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T4921.stderr
@@ -0,0 +1,19 @@
+
+T4921.hs:10:9:
+ No instance for (C a0 b1) arising from a use of ‘f’
+ The type variables ‘a0’, ‘b1’ are ambiguous
+ Relevant bindings include x :: a0 (bound at T4921.hs:10:1)
+ Note: there is a potential instance available:
+ instance C Int Char -- Defined at T4921.hs:7:10
+ In the first argument of ‘fst’, namely ‘f’
+ In the expression: fst f
+ In an equation for ‘x’: x = fst f
+
+T4921.hs:12:9:
+ No instance for (C Int b0) arising from a use of ‘f’
+ The type variable ‘b0’ is ambiguous
+ Note: there is a potential instance available:
+ instance C Int Char -- Defined at T4921.hs:7:10
+ In the first argument of ‘fst’, namely ‘f’
+ In the expression: fst f :: Int
+ In an equation for ‘y’: y = fst f :: Int
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 7d1e55867e..d3c8941c65 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -345,3 +345,4 @@ test('T9201', normal, compile_fail, [''])
test('T9109', normal, compile_fail, [''])
test('T9497d', normal, compile_fail, ['-fdefer-type-errors -fno-defer-typed-holes'])
test('T8044', normal, compile_fail, [''])
+test('T4921', normal, compile_fail, [''])