From e1202fd33a406f4fc4f78d60a0dd48c030b7c9cf Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Wed, 22 Oct 2008 14:51:38 +0000 Subject: [PATCH] Fix Trac #2714 (a minor wibble) 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcUnify.lhs b/compiler/typecheck/TcUnify.lhs index 72df161..56652c7 100644 --- a/compiler/typecheck/TcUnify.lhs +++ b/compiler/typecheck/TcUnify.lhs @@ -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 -- 1.7.10.4