summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-10-03 09:25:25 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2013-10-03 09:25:25 +0100
commit65128ed7812c6e8085c0f0258f23f6afad3a6b50 (patch)
tree82c873245ac8181ee8faabcaff2a51f9bf386b76 /testsuite/tests
parent067f78b276f3f3d2d50a2d3134f211ccd099f4a6 (diff)
downloadhaskell-65128ed7812c6e8085c0f0258f23f6afad3a6b50.tar.gz
Test Trac #8392
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/typecheck/should_compile/T8392.hs17
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
-rw-r--r--testsuite/tests/typecheck/should_fail/T8392a.hs7
-rw-r--r--testsuite/tests/typecheck/should_fail/T8392a.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T2
5 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T8392.hs b/testsuite/tests/typecheck/should_compile/T8392.hs
new file mode 100644
index 0000000000..d86d29b8bc
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T8392.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies, UndecidableInstances, AllowAmbiguousTypes #-}
+
+module T8392 where
+
+class Fun f a b where
+ fun :: f -> a -> b
+
+instance (b ~ Int, a ~ Int) => Fun F a b
+ where fun _ = (+1)
+
+data F = F
+
+data Compose a b = Compose a b
+
+-- ghc-7.6 version
+instance (Fun f b c, Fun g a b) => Fun (Compose f g) a c where
+ fun (Compose f g) a = fun f (fun g a :: b) \ No newline at end of file
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index eb0e934220..0ccd90a35e 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -410,3 +410,4 @@ test('T7891', normal, compile, [''])
test('T7903', normal, compile, [''])
test('TcTypeNatSimple', normal, compile, [''])
test('TcCoercibleCompile', when(compiler_lt('ghc', '7.7'), skip), compile, [''])
+test('T8392', normal, compile, [''])
diff --git a/testsuite/tests/typecheck/should_fail/T8392a.hs b/testsuite/tests/typecheck/should_fail/T8392a.hs
new file mode 100644
index 0000000000..6f47b4e331
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T8392a.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE GADTs, AllowAmbiguousTypes #-}
+module T8392a where
+
+-- Should complain even with AllowAmbiguousTypes
+
+foo :: (Int ~ Bool) => a -> a
+foo x = x
diff --git a/testsuite/tests/typecheck/should_fail/T8392a.stderr b/testsuite/tests/typecheck/should_fail/T8392a.stderr
new file mode 100644
index 0000000000..6e102227cf
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T8392a.stderr
@@ -0,0 +1,7 @@
+
+T8392a.hs:6:8:
+ Couldn't match type ‛Int’ with ‛Bool’
+ Inaccessible code in
+ the type signature for foo :: Int ~ Bool => a -> a
+ In the ambiguity check for: forall a. Int ~ Bool => a -> a
+ In the type signature for ‛foo’: foo :: Int ~ Bool => a -> a
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index cac7d92a13..bf11f6c94b 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -320,3 +320,5 @@ test('TcCoercibleFail', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''
test('TcCoercibleFailSafe', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])
test('TcCoercibleFail2', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])
test('T8306', normal, compile_fail, [''])
+test('T8392a', normal, compile_fail, [''])
+