Test Trac #2247
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 24 Jan 2013 13:59:26 +0000 (13:59 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Thu, 24 Jan 2013 13:59:26 +0000 (13:59 +0000)
testsuite/tests/typecheck/should_fail/T2247.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T2247.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T2247.hs b/testsuite/tests/typecheck/should_fail/T2247.hs
new file mode 100644 (file)
index 0000000..3779f2d
--- /dev/null
@@ -0,0 +1,18 @@
+{-# LANGUAGE FunctionalDependencies, MultiParamTypeClasses, UndecidableInstances, FlexibleInstances #-}
+
+module T2247 where
+
+class FD a b | a -> b
+instance CFD a b => FD a b
+
+class {- FD a b => -} CFD a b
+instance CFD Bool Char
+instance CFD Bool Bool
+
+f' :: FD Bool Bool => Bool
+f' = True
+
+g' :: FD Bool Char => Bool
+g' = False
+
+x = f'
diff --git a/testsuite/tests/typecheck/should_fail/T2247.stderr b/testsuite/tests/typecheck/should_fail/T2247.stderr
new file mode 100644 (file)
index 0000000..70ef7f7
--- /dev/null
@@ -0,0 +1,6 @@
+
+T2247.hs:6:10:
+    Illegal instance declaration for `FD a b'
+      Multiple uses of this instance may be inconsistent
+      with the functional dependencies of the class.
+    In the instance declaration for `FD a b'
index a4d0216..ad62ce7 100644 (file)
@@ -293,3 +293,4 @@ test('T7525', normal, compile_fail, [''])
 test('T7368a', normal, compile_fail, [''])
 test('T7545', normal, compile_fail, [''])
 test('T7279', normal, compile_fail, [''])
+test('T2247', normal, compile_fail, [''])