[project @ 2004-08-18 09:33:03 by simonpj]
authorsimonpj <unknown>
Wed, 18 Aug 2004 09:33:11 +0000 (09:33 +0000)
committersimonpj <unknown>
Wed, 18 Aug 2004 09:33:11 +0000 (09:33 +0000)
commit370765b2f80105d7ca6e6080bab24c76970fdc4e
tree9d45369046c33a06810f3417fcd93c37d79a0b4a
parentca440e06a6cb5661f10ff879c676ba22a56c4ca7
[project @ 2004-08-18 09:33:03 by simonpj]
-------------------------------
Fix a fundep bug
-------------------------------

MERGE TO STABLE

Big thank-you to Martin Sulzmann for finding this functional dependency bug.

The new defn of FunDeps.Equation is:
type Equation = (TyVarSet, [(Type, Type)])
Before it was (TyVarSet, Type, Type), so each pair of types was separately
quantified (wrong).

It's important that we have a *list* of pairs of types.  Consider
  class C a b c | a -> b c where ...
instance C Int x x where ...
Then, given the constraint (C Int Bool v) we should improve v to Bool,
via the equation ({x}, [(Bool,x), (v,x)])
This would not happen if the class had looked like
class C a b c | a -> b, a -> c

Test in typecheck/should_compile/tc180
ghc/compiler/typecheck/TcSimplify.lhs
ghc/compiler/typecheck/TcType.lhs
ghc/compiler/types/FunDeps.lhs