[project @ 2002-02-07 12:51:34 by simonpj]
authorsimonpj <unknown>
Thu, 7 Feb 2002 12:51:35 +0000 (12:51 +0000)
committersimonpj <unknown>
Thu, 7 Feb 2002 12:51:35 +0000 (12:51 +0000)
commit20f50b2a3651ce7dacdcb86a83afb5c5d444cb0b
tree141244ca209a39c52611b9b38caa741efdeca77e
parent35c63bfcf979854cbe034a134dbcb7505313bbef
[project @ 2002-02-07 12:51:34 by simonpj]
----------------------------------------------------
Make TcType.match and TcUnify.uUnboundVar kind-aware
----------------------------------------------------

George Russel had apparently-overlapping (ha) instance decls like

instance .. => C (a b) where
instance .. => C (x y) where

But the a,b and x,y were different kinds!  Turned out that TcType.unify
was kind-aware (so we didn't report a duplicate instance decl, but TcType.match
was not (so we simply selected the wrong one, and got a mis-kinded constraint
popping up from the ".."  part.  Very exciting to track down.

I also make the ordinary unification kind-aware in the same way.  It's
quite legitimate to attempt to unify, say,
(a b)    with     (c d)
but the unification should fail if a's kind differs from c's.
(There was a kind of debug warning before, but it's actually not an error
in the compiler... so it should just make unification fail gracefully.)
ghc/compiler/typecheck/TcType.lhs
ghc/compiler/typecheck/TcUnify.lhs
ghc/compiler/types/Type.lhs