[commit: ghc] master: Testsuite: add typecheck/should_fail/T8034 (#8034) (58986c4)

git at git.haskell.org git at git.haskell.org
Thu Jul 30 20:54:38 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/58986c4953b045247cb09caa544981cccf14f242/ghc

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

commit 58986c4953b045247cb09caa544981cccf14f242
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Tue Jul 28 00:15:51 2015 +0200

    Testsuite: add typecheck/should_fail/T8034 (#8034)


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

58986c4953b045247cb09caa544981cccf14f242
 testsuite/tests/typecheck/should_fail/T8034.hs     |  6 ++++++
 testsuite/tests/typecheck/should_fail/T8034.stderr | 12 ++++++++++++
 testsuite/tests/typecheck/should_fail/all.T        |  1 +
 3 files changed, 19 insertions(+)

diff --git a/testsuite/tests/typecheck/should_fail/T8034.hs b/testsuite/tests/typecheck/should_fail/T8034.hs
new file mode 100644
index 0000000..e432152
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T8034.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TypeFamilies #-}
+module T8034 where
+
+class C a where
+  type F a
+  foo :: F a -> F a
diff --git a/testsuite/tests/typecheck/should_fail/T8034.stderr b/testsuite/tests/typecheck/should_fail/T8034.stderr
new file mode 100644
index 0000000..cea9dbc
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T8034.stderr
@@ -0,0 +1,12 @@
+
+T8034.hs:6:3: error:
+    Couldn't match type ‘F a0’ with ‘F a’
+    NB: ‘F’ is a type function, and may not be injective
+    The type variable ‘a0’ is ambiguous
+    Expected type: F a -> F a
+      Actual type: F a0 -> F a0
+    In the ambiguity check for the type signature for ‘foo’:
+      foo :: forall a. C a => F a -> F a
+    To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+    When checking the class method: foo :: forall a. C a => F a -> F a
+    In the class declaration for ‘C’
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 3fdc38b..1a2ff9a 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -315,6 +315,7 @@ test('T7869', normal, compile_fail, [''])
 test('T7892', normal, compile_fail, [''])
 test('T7809', normal, compile_fail, [''])
 test('T7989', normal, compile_fail, [''])
+test('T8034', normal, compile_fail, [''])
 test('T8142', normal, compile_fail, [''])
 test('T8262', normal, compile_fail, [''])
 test('TcCoercibleFail', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])



More information about the ghc-commits mailing list