#ifdef GHCI
import {-# SOURCE #-} TcSplice ( tcSpliceDecls )
-import DsMeta ( qTyConName )
+import DsMeta ( templateHaskellNames )
#endif
import CmdLineOpts ( DynFlag(..), opt_PprStyle_Debug, dopt )
(rn_splice_expr, fvs) <- initRn SourceMode $
addSrcLoc splice_loc $
rnExpr splice_expr ;
- tcg_env <- importSupportingDecls (fvs `addOneFV` qTyConName) ;
+ tcg_env <- importSupportingDecls (fvs `plusFV` templateHaskellNames) ;
setGblEnv tcg_env $ do {
-- Execute the splice
-- in this module, which is why the knot is so big
-- Do the main work
- ((tcg_env, binds, rules, fords), lie) <- getLIE (
+ ((tcg_env, lcl_env, binds, rules, fords), lie) <- getLIE (
tc_src_decls unf_env rn_decls
) ;
-- type. (Usually, ambiguous type variables are resolved
-- during the generalisation step.)
traceTc (text "Tc8") ;
- inst_binds <- setGblEnv tcg_env (tcSimplifyTop lie) ;
+ inst_binds <- setGblEnv tcg_env $
+ setLclTypeEnv lcl_env $
+ tcSimplifyTop lie ;
-- The setGblEnv exposes the instances to tcSimplifyTop
+ -- The steLclTypeEnv exposes the local Ids, so that
+ -- we get better error messages (monomorphism restriction)
-- Backsubstitution. This must be done last.
-- Even tcSimplifyTop may do some unification.
cls_dm_binds `AndMonoBinds`
foe_binds } ;
- return (tcg_env, all_binds, src_rules, foe_decls)
+ return (tcg_env, lcl_env, all_binds, src_rules, foe_decls)
}}}}}}}}}
\end{code}