Do pre-subsumption in the main subsumption check
authorsimonpj@microsoft.com <unknown>
Fri, 4 Aug 2006 21:49:42 +0000 (21:49 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 4 Aug 2006 21:49:42 +0000 (21:49 +0000)
commitaf20907ae1c9901b457cbab57e9d533e66e5aa07
tree3f261868d2e9262528be9a0a1d9ca640771f2519
parent6493f9d3305d5af08ad92c8f32b8b6410404eb46
Do pre-subsumption in the main subsumption check

This patch improves the subsumption check (in TcUnify.tc_sub) so that
it does pre-subsumption first.  The key code is in the case with
guard (isSigmaTy actual_ty); note the new call to preSubType.

Shorn of details, the question is this.  Should this hold?

forall a. a->a   <=   Int -> (forall b. Int)

Really, it should; just instantiate 'a' to Int.  This is just what
the pre-subsumption phase (which used in function applications),
will do.

I did a bit of refactoring to achieve this.

Fixes Trac #821.  Test tc205 tests.
compiler/rename/RnExpr.lhs
compiler/typecheck/TcExpr.lhs
compiler/typecheck/TcMType.lhs
compiler/typecheck/TcPat.lhs
compiler/typecheck/TcType.lhs
compiler/typecheck/TcUnify.lhs