Fix Trac #2714 (a minor wibble)
authorsimonpj@microsoft.com <unknown>
Wed, 22 Oct 2008 14:51:38 +0000 (14:51 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 22 Oct 2008 14:51:38 +0000 (14:51 +0000)
In boxy_match (which is a pure function used by preSubType) we can
encounter TyVars not just TcTyVars; this patch takes account of that.

compiler/typecheck/TcUnify.lhs

index 72df161..56652c7 100644 (file)
@@ -611,7 +611,10 @@ boxy_match tmpl_tvs orig_tmpl_ty boxy_tvs orig_boxy_ty subst
                         Nothing -> orig_boxy_ty
                         Just ty -> ty `boxyLub` orig_boxy_ty
 
-    go _ (TyVarTy tv) | isMetaTyVar tv
+    go _ (TyVarTy tv) | isTcTyVar tv && isMetaTyVar tv
+                               -- NB: A TyVar (not TcTyVar) is possible here, representing
+                               --     a skolem, because in this pure boxy_match function 
+                               --     we don't instantiate foralls to TcTyVars; cf Trac #2714
         = subst         -- Don't fail if the template has more info than the target!
                         -- Otherwise, with tmpl_tvs = [a], matching (a -> Int) ~ (Bool -> beta)
                         -- would fail to instantiate 'a', because the meta-type-variable