From: simonpj Date: Thu, 28 Mar 2002 15:31:05 +0000 (+0000) Subject: [project @ 2002-03-28 15:31:05 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~2207 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=6433e4f62f2124744ce2276c77a2c243f014d717;p=ghc-hetmet.git [project @ 2002-03-28 15:31:05 by simonpj] Another readHoleResult glitch (fixes rn003) --- diff --git a/ghc/compiler/typecheck/Inst.lhs b/ghc/compiler/typecheck/Inst.lhs index ed0e665..f7a8472 100644 --- a/ghc/compiler/typecheck/Inst.lhs +++ b/ghc/compiler/typecheck/Inst.lhs @@ -41,7 +41,7 @@ import TcHsSyn ( TcExpr, TcId, TypecheckedHsExpr, import TcMonad import TcEnv ( TcIdSet, tcGetInstEnv, tcLookupId ) import InstEnv ( InstLookupResult(..), lookupInstEnv ) -import TcMType ( zonkTcType, zonkTcTypes, zonkTcPredType, +import TcMType ( zonkTcType, zonkTcTypes, zonkTcPredType, zapToType, zonkTcThetaType, tcInstTyVar, tcInstType, ) import TcType ( Type, TcType, TcThetaType, TcPredType, TcTauType, TcTyVarSet, @@ -415,16 +415,19 @@ newOverloadedLit :: InstOrigin -> HsOverLit -> TcType -> NF_TcM (TcExpr, LIE) -newOverloadedLit orig lit ty - | Just expr <- shortCutLit lit ty +newOverloadedLit orig lit expected_ty + | Just expr <- shortCutLit lit expected_ty = returnNF_Tc (expr, emptyLIE) | otherwise = tcGetInstLoc orig `thenNF_Tc` \ loc -> tcGetUnique `thenNF_Tc` \ new_uniq -> + zapToType expected_ty `thenNF_Tc_` + -- The expected type might be a 'hole' type variable, + -- in which case we must zap it to an ordinary type variable let - lit_inst = LitInst lit_id lit ty loc - lit_id = mkSysLocal FSLIT("lit") new_uniq ty + lit_inst = LitInst lit_id lit expected_ty loc + lit_id = mkSysLocal FSLIT("lit") new_uniq expected_ty in returnNF_Tc (HsVar (instToId lit_inst), unitLIE lit_inst)