[commit: testsuite] master: Testing of generating Derived equalities from Given dictionaries (066498c)
dimitris at microsoft.com
dimitris at microsoft.com
Fri Jun 8 17:19:25 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/066498c3801358cacfbd105d61495e8737445e14
>---------------------------------------------------------------
commit 066498c3801358cacfbd105d61495e8737445e14
Author: Dimitrios.Vytiniotis <dimitris at microsoft.com>
Date: Fri Jun 8 15:52:06 2012 +0100
Testing of generating Derived equalities from Given dictionaries
with functional dependencies.
>---------------------------------------------------------------
tests/typecheck/should_fail/FDsFromGivens.hs | 24 ++++++++++++++++++++++
tests/typecheck/should_fail/FDsFromGivens.stderr | 12 +++++++++++
tests/typecheck/should_fail/all.T | 2 +
3 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/tests/typecheck/should_fail/FDsFromGivens.hs b/tests/typecheck/should_fail/FDsFromGivens.hs
new file mode 100644
index 0000000..923dfa1
--- /dev/null
+++ b/tests/typecheck/should_fail/FDsFromGivens.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, GADTs #-}
+
+module FDsFromGivens where
+
+class C a b | a -> b where
+ cop :: a -> b -> ()
+
+
+data KCC where
+ KCC :: C Char Char => () -> KCC
+
+
+{- Failing, as it righteously should!
+g1 :: (C Char [a], C Char Bool) => a -> ()
+g1 x = ()
+-}
+
+f :: C Char [a] => a -> a
+f = undefined
+
+bar (KCC _) = f
+
+
+
\ No newline at end of file
diff --git a/tests/typecheck/should_fail/FDsFromGivens.stderr b/tests/typecheck/should_fail/FDsFromGivens.stderr
new file mode 100644
index 0000000..8a942de
--- /dev/null
+++ b/tests/typecheck/should_fail/FDsFromGivens.stderr
@@ -0,0 +1,12 @@
+
+FDsFromGivens.hs:21:15:
+ Couldn't match type `Char' with `[a0]'
+ When using functional dependencies to combine
+ C Char Char,
+ arising from a pattern with constructor
+ KCC :: C Char Char => () -> KCC,
+ in an equation for `bar'
+ at FDsFromGivens.hs:21:6-10
+ C Char [a0], arising from a use of `f' at FDsFromGivens.hs:21:15
+ In the expression: f
+ In an equation for `bar': bar (KCC _) = f
diff --git a/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T
index e27d0cc..d0ab694 100644
--- a/tests/typecheck/should_fail/all.T
+++ b/tests/typecheck/should_fail/all.T
@@ -277,3 +277,5 @@ test('T6001', normal, compile_fail, [''])
test('T6022', expect_broken(6022), compile_fail, [''])
test('T5853', normal, compile_fail, [''])
test('T6078', normal, compile_fail, [''])
+
+test('FDsFromGivens', normal, compile_fail, [''])
More information about the Cvs-ghc
mailing list