Test Trac #4921
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 2 Dec 2014 12:08:57 +0000 (12:08 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 2 Dec 2014 13:28:26 +0000 (13:28 +0000)
testsuite/tests/typecheck/should_fail/T4921.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T4921.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T4921.hs b/testsuite/tests/typecheck/should_fail/T4921.hs
new file mode 100644 (file)
index 0000000..b024967
--- /dev/null
@@ -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 (file)
index 0000000..c304b05
--- /dev/null
@@ -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
index 7d1e558..d3c8941 100644 (file)
@@ -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, [''])