Make unification robust to a boxy type variable meeting itself
authorsimonpj@microsoft.com <unknown>
Tue, 1 Aug 2006 21:43:02 +0000 (21:43 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 1 Aug 2006 21:43:02 +0000 (21:43 +0000)
commit6493f9d3305d5af08ad92c8f32b8b6410404eb46
tree27e84e4f2ade867f03dfb9cb207ceedcf007ed08
parentf5f7d7ad238dab7295e59004e24f9ccebf99331f
Make unification robust to a boxy type variable meeting itself

Previously, the implicit assumption in unification is that a boxy
type variable could never occur on both sides of the unification,
so that we'd never find
bx5 :=: bx5

But the pre-subsumption stuff really means that the same variable
can occur on both sides.  Consider
forall a. a->Int <= bx5->Int
Then pre-subumption will find a->bx5; and the full subsumption step
will find bx5:=bx5.

However, I think there is still no possiblity of a full occurs-check
failure; that is,
bx5 :=: Tree bx5
Although I can't quite see how to prove it!  So I've added a
DEBUG test in uMetaVar to check for this case.
compiler/typecheck/TcUnify.lhs