Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/70ab311df5328ec4bbedc50bc642ce767d37fab0 >--------------------------------------------------------------- commit 70ab311df5328ec4bbedc50bc642ce767d37fab0 Author: Simon Peyton Jones <[email protected]> Date: Wed Aug 3 17:07:06 2011 +0100 Test Trac #5095 >--------------------------------------------------------------- tests/typecheck/should_fail/T5095.hs | 11 +++++ tests/typecheck/should_fail/T5095.stderr | 66 ++++++++++++++++++++++++++++++ tests/typecheck/should_fail/all.T | 1 + 3 files changed, 78 insertions(+), 0 deletions(-) diff --git a/tests/typecheck/should_fail/T5095.hs b/tests/typecheck/should_fail/T5095.hs new file mode 100644 index 0000000..80e0808 --- /dev/null +++ b/tests/typecheck/should_fail/T5095.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances #-} + +module Test where + +instance Show a => Eq a where + x == y = length (show x) == length (show y) + +f :: Show a => a -> a -> Bool +f x y = x == y + +p = f (3 :: Int) 4 diff --git a/tests/typecheck/should_fail/T5095.stderr b/tests/typecheck/should_fail/T5095.stderr new file mode 100644 index 0000000..7ada03b --- /dev/null +++ b/tests/typecheck/should_fail/T5095.stderr @@ -0,0 +1,66 @@ + +T5095.hs:9:11: + Overlapping instances for Eq a + arising from a use of `==' + Matching instances: + instance [overlap ok] Show a => Eq a -- Defined at T5095.hs:5:10-23 + instance Eq () -- Defined in GHC.Classes + instance (Eq a, Eq b) => Eq (a, b) -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c) => Eq (a, b, c) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => + Eq (a, b, c, d, e, f) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => + Eq (a, b, c, d, e, f, g) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => + Eq (a, b, c, d, e, f, g, h) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => + Eq (a, b, c, d, e, f, g, h, i) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, + Eq j) => + Eq (a, b, c, d, e, f, g, h, i, j) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, + Eq j, Eq k) => + Eq (a, b, c, d, e, f, g, h, i, j, k) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, + Eq j, Eq k, Eq l) => + Eq (a, b, c, d, e, f, g, h, i, j, k, l) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, + Eq j, Eq k, Eq l, Eq m) => + Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, + Eq j, Eq k, Eq l, Eq m, Eq n) => + Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) + -- Defined in GHC.Classes + instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, + Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => + Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) + -- Defined in GHC.Classes + instance Eq GHC.Generics.Arity -- Defined in GHC.Classes + instance Eq GHC.Generics.Associativity -- Defined in GHC.Classes + instance Eq Bool -- Defined in GHC.Classes + instance Eq Char -- Defined in GHC.Classes + instance Eq Double -- Defined in GHC.Classes + instance Eq GHC.Generics.Fixity -- Defined in GHC.Classes + instance Eq Float -- Defined in GHC.Classes + instance Eq Int -- Defined in GHC.Classes + instance Eq Ordering -- Defined in GHC.Classes + instance Eq a => Eq [a] -- Defined in GHC.Classes + instance Eq Integer -- Defined in integer-gmp:GHC.Integer.Type + (The choice depends on the instantiation of `a' + To pick the first instance above, use -XIncoherentInstances + when compiling the other instance declarations) + In the expression: x == y + In an equation for `f': f x y = x == y diff --git a/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T index 5ea05ef..fb79387 100644 --- a/tests/typecheck/should_fail/all.T +++ b/tests/typecheck/should_fail/all.T @@ -243,3 +243,4 @@ test('LongWayOverlapping', normal, compile_fail, ['']) test('T5236',normal,compile_fail,['']) test('T5246',normal,compile_fail,['']) test('T5300',normal,compile_fail,['']) +test('T5095',normal,compile_fail,['']) _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
