[commit: testsuite] master: Test Trac #7857 (f2cbb53)

Simon Peyton Jones simonpj at microsoft.com
Tue Apr 23 10:20:03 CEST 2013


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

On branch  : master

https://github.com/ghc/testsuite/commit/f2cbb537a346887d372d6f841b50ab994fbe9ca8

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

commit f2cbb537a346887d372d6f841b50ab994fbe9ca8
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Apr 23 09:19:47 2013 +0100

    Test Trac #7857

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

 tests/typecheck/should_fail/T7857.hs     |    8 ++++++++
 tests/typecheck/should_fail/T7857.stderr |   16 ++++++++++++++++
 tests/typecheck/should_fail/all.T        |    1 +
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/tests/typecheck/should_fail/T7857.hs b/tests/typecheck/should_fail/T7857.hs
new file mode 100644
index 0000000..d50efd5
--- /dev/null
+++ b/tests/typecheck/should_fail/T7857.hs
@@ -0,0 +1,8 @@
+module T7857 where
+
+import Text.Printf
+
+f :: a -> b
+f = undefined
+
+g i = f $ printf "" i
diff --git a/tests/typecheck/should_fail/T7857.stderr b/tests/typecheck/should_fail/T7857.stderr
new file mode 100644
index 0000000..6fdad87
--- /dev/null
+++ b/tests/typecheck/should_fail/T7857.stderr
@@ -0,0 +1,16 @@
+
+T7857.hs:8:11:
+    Could not deduce (PrintfType s0) arising from a use of ‛printf’
+    from the context (PrintfArg t)
+      bound by the inferred type of g :: PrintfArg t => t -> s
+      at T7857.hs:8:1-21
+    The type variable ‛s0’ is ambiguous
+    Note: there are several potential instances:
+      instance [safe] (PrintfArg a, PrintfType r) => PrintfType (a -> r)
+        -- Defined in ‛Text.Printf’
+      instance [safe] PrintfType (IO a) -- Defined in ‛Text.Printf’
+      instance [safe] IsChar c => PrintfType [c]
+        -- Defined in ‛Text.Printf’
+    In the second argument of ‛($)’, namely ‛printf "" i’
+    In the expression: f $ printf "" i
+    In an equation for ‛g’: g i = f $ printf "" i
diff --git a/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T
index f1bc64f..d551a15 100644
--- a/tests/typecheck/should_fail/all.T
+++ b/tests/typecheck/should_fail/all.T
@@ -303,3 +303,4 @@ test('T7696', normal, compile_fail, [''])
 test('T7748a', normal, compile_fail, [''])
 test('TcNoNullaryTC', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])
 test('TcNullaryTCFail', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])
+test('T7857', normal, compile_fail, [''])





More information about the ghc-commits mailing list