Test Trac #7857
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 23 Apr 2013 08:19:47 +0000 (09:19 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 23 Apr 2013 08:19:47 +0000 (09:19 +0100)
testsuite/tests/typecheck/should_fail/T7857.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T7857.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T7857.hs b/testsuite/tests/typecheck/should_fail/T7857.hs
new file mode 100644 (file)
index 0000000..d50efd5
--- /dev/null
@@ -0,0 +1,8 @@
+module T7857 where
+
+import Text.Printf
+
+f :: a -> b
+f = undefined
+
+g i = f $ printf "" i
diff --git a/testsuite/tests/typecheck/should_fail/T7857.stderr b/testsuite/tests/typecheck/should_fail/T7857.stderr
new file mode 100644 (file)
index 0000000..6fdad87
--- /dev/null
@@ -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
index f1bc64f..d551a15 100644 (file)
@@ -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, [''])