From f750bec77c4f1b6d986dfa237df63a70689e9849 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Wed, 6 Jun 2007 13:00:56 +0000 Subject: [PATCH] FIX #1385: make sure tuple instances are loaded Typechecking of explicit tuples is done "by hand" (rather than using boxySplitTyConApp) so that rigidity is maintained. In making that change I'd forgotten to retain the call to checkWiredInTyCon, which is important to make sure instances are brought into scope. Test is tc227. --- compiler/typecheck/TcExpr.lhs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcExpr.lhs b/compiler/typecheck/TcExpr.lhs index c3bc64b..39e8a5c 100644 --- a/compiler/typecheck/TcExpr.lhs +++ b/compiler/typecheck/TcExpr.lhs @@ -29,6 +29,7 @@ import TcHsType import TcPat import TcMType import TcType +import TcIface ( checkWiredInTyCon ) import Id import DataCon import Name @@ -302,10 +303,11 @@ tcExpr (ExplicitTuple exprs boxity) res_ty = do { tvs <- newBoxyTyVars [argTypeKind | e <- exprs] ; let tup_tc = tupleTyCon boxity (length exprs) tup_res_ty = mkTyConApp tup_tc (mkTyVarTys tvs) - ; arg_tys <- preSubType tvs (mkVarSet tvs) tup_res_ty res_ty - ; exprs' <- tcPolyExprs exprs arg_tys + ; checkWiredInTyCon tup_tc -- Ensure instances are available + ; arg_tys <- preSubType tvs (mkVarSet tvs) tup_res_ty res_ty + ; exprs' <- tcPolyExprs exprs arg_tys ; arg_tys' <- mapM refineBox arg_tys - ; co_fn <- tcFunResTy (tyConName tup_tc) (mkTyConApp tup_tc arg_tys') res_ty + ; co_fn <- tcFunResTy (tyConName tup_tc) (mkTyConApp tup_tc arg_tys') res_ty ; return (mkHsWrap co_fn (ExplicitTuple exprs' boxity)) } tcExpr (HsProc pat cmd) res_ty -- 1.7.10.4