diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-10-31 12:31:59 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-11-04 10:38:04 +0000 |
commit | 7c79633688238086ad60e1d23e0a424bb4eb325f (patch) | |
tree | 2ec0359754039928c7472e33c38f23964ebc84ea /testsuite/tests | |
parent | c639560d8ad969415033b19201d9626b1a0638bf (diff) | |
download | haskell-7c79633688238086ad60e1d23e0a424bb4eb325f.tar.gz |
Fix the superclass-cycle detection code (Trac #9739)
We were falling into an infinite loop when doing the ambiguity
check on a class method, even though we had previously detected
a superclass cycle. There was code to deal with this, but it
wasn't right.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T9739.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T9739.stderr | 10 |
2 files changed, 11 insertions, 8 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T9739.hs b/testsuite/tests/typecheck/should_fail/T9739.hs index 4b7869d315..18df797100 100644 --- a/testsuite/tests/typecheck/should_fail/T9739.hs +++ b/testsuite/tests/typecheck/should_fail/T9739.hs @@ -1,6 +1,9 @@ +{-# LANGUAGE MultiParamTypeClasses #-} module T9739 where -class Class2 a => Class1 a where - class3 :: (Class2 a) => b +class Class3 a => Class1 a where -class (Class1 a) => Class2 a where +class Class2 t a where + class2 :: (Class3 t) => a -> m + +class (Class1 t, Class2 t t) => Class3 t where diff --git a/testsuite/tests/typecheck/should_fail/T9739.stderr b/testsuite/tests/typecheck/should_fail/T9739.stderr index 95fcf6ad82..34e2f114f8 100644 --- a/testsuite/tests/typecheck/should_fail/T9739.stderr +++ b/testsuite/tests/typecheck/should_fail/T9739.stderr @@ -1,10 +1,10 @@ -T9739.hs:3:1: +T9739.hs:4:1: Cycle in class declaration (via superclasses): - Class1 -> Class2 -> Class1 + Class1 -> Class3 -> Class1 In the class declaration for ‘Class1’ -T9739.hs:6:1: +T9739.hs:9:1: Cycle in class declaration (via superclasses): - Class2 -> Class1 -> Class2 - In the class declaration for ‘Class2’ + Class3 -> Class1 -> Class3 + In the class declaration for ‘Class3’ |