[commit: testsuite] master: Test irreducible-evidence self-interactive (723804d)
Max Bolingbroke
batterseapower at hotmail.com
Sat Sep 10 20:07:27 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/723804de2a49e5013807fb8c2a04569d086ebfd0
>---------------------------------------------------------------
commit 723804de2a49e5013807fb8c2a04569d086ebfd0
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date: Sat Sep 10 14:31:58 2011 +0100
Test irreducible-evidence self-interactive
>---------------------------------------------------------------
tests/typecheck/should_compile/all.T | 1 +
tests/typecheck/should_compile/tc257.hs | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/tests/typecheck/should_compile/all.T b/tests/typecheck/should_compile/all.T
index 0cc90f0..e185708 100644
--- a/tests/typecheck/should_compile/all.T
+++ b/tests/typecheck/should_compile/all.T
@@ -348,6 +348,7 @@ test('tc253', normal, compile, [''])
test('tc254', normal, compile, [''])
test('tc255', normal, compile, [''])
test('tc256', normal, compile, [''])
+test('tc257', normal, compile, [''])
test('GivenOverlapping', normal, compile, [''])
test('SilentParametersOverlapping', normal, compile, [''])
diff --git a/tests/typecheck/should_compile/tc257.hs b/tests/typecheck/should_compile/tc257.hs
new file mode 100644
index 0000000..b1db39f
--- /dev/null
+++ b/tests/typecheck/should_compile/tc257.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE KindSignatures, ConstraintKinds, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
+module Ctx where
+
+data Proxy (ctxt :: * -> Constraint) = Proxy
+
+-- At one time, this one worked:
+nonmeth :: ctxt Int => Proxy ctxt -> a
+nonmeth prox = nonmeth prox
+
+
+class Foo (ctxt :: * -> Constraint) a where
+ meth :: ctxt a => Proxy ctxt -> a
+
+instance ctxt Int => Foo ctxt Int where
+ -- But this one didn't:
+ meth prox = meth prox
+
+-- The error was:
+-- Could not deduce (ctxt Int) arising from a use of `meth'
+-- from the context (ctxt Int)
+
+-- The problem was that irreducible evidence did not interact with
+-- evidence of equal type.
\ No newline at end of file
More information about the Cvs-ghc
mailing list