Testsuite: add typecheck/should_fail/T8034 (#8034)
authorThomas Miedema <thomasmiedema@gmail.com>
Mon, 27 Jul 2015 22:15:51 +0000 (00:15 +0200)
committerThomas Miedema <thomasmiedema@gmail.com>
Thu, 30 Jul 2015 20:53:15 +0000 (22:53 +0200)
testsuite/tests/typecheck/should_fail/T8034.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T8034.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T8034.hs b/testsuite/tests/typecheck/should_fail/T8034.hs
new file mode 100644 (file)
index 0000000..e432152
--- /dev/null
@@ -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 (file)
index 0000000..cea9dbc
--- /dev/null
@@ -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’
index 3fdc38b..1a2ff9a 100644 (file)
@@ -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, [''])