import TypeRep ( Type(..), PredType(..) )
import TyCon ( TyCon, tyConName )
import HscTypes ( ExternalPackageState(..), PackageInstEnv,
- TyThing(..), implicitTyThings,
+ TyThing(..), implicitTyThings, typeEnvIds,
ModIface(..), ModDetails(..), InstPool,
TypeEnv, mkTypeEnv, extendTypeEnvList, lookupTypeEnv,
DeclPool, RulePool, Pool(..), Gated, addRuleToPool )
= do {
-- Make sure the interface is loaded
; let { nd_doc = ptext SLIT("Need decl for") <+> ppr name }
- ; traceIf nd_doc
+ ; traceIf (nd_doc <+> char '{') -- Brace matches the later message
; loadHomeInterface nd_doc name
-- Get the real name of the thing, with a correct nameParent field.
- -- Before the interface is loaded, we may have a non-commital 'Nothing' in
- -- the namePareent field (made up by IfaceEnv.lookupOrig), but
+ -- Before the interface is loaded, we may have a non-committal 'Nothing'
+ -- in the namePareent field (made up by IfaceEnv.lookupOrig), but
-- loading the interface updates the name cache.
-- We need the right nameParent field in getThing
; real_name <- lookupOrig (nameModuleName name) (nameOccName name)
; let { extra | getName main_thing == real_name = empty
| otherwise = brackets (ptext SLIT("when seeking") <+> ppr real_name) }
- ; traceIf (ptext SLIT("...imported decl for") <+> ppr main_thing <+> extra)
+ ; traceIf (ptext SLIT(" ...imported decl for") <+> ppr main_thing <+> extra <+> char '}')
-- Look up the wanted Name in the type envt; it might be
-- Now type-check those rules (which may side-effect the EPS again)
; traceIf (text "tcImport: extend type env" <+> ppr new_things)
+ ; traceIf (text "tcImport: rules" <+> vcat (map ppr iface_rules))
; core_rules <- mapM tc_rule iface_rules
; updateEps_ (\ eps ->
eps { eps_rule_base = extendRuleBaseList (eps_rule_base eps) core_rules }
; let { (inst_pool', iface_insts)
= selectInsts (eps_insts eps) cls_gate tc_gates }
- ; traceTc (text "loadImportedInsts" <+> vcat [ppr cls <+> ppr tys,
- text "new pool" <+> ppr inst_pool',
- text "new insts" <+> ppr iface_insts])
-
-- Empty => finish up rapidly, without writing to eps
; if null iface_insts then
return (eps_inst_env eps)
-- Check for type consistency in the unfolding
ifOptM Opt_DoCoreLinting (
- case lintUnfolding noSrcLoc [{- in scope -}] core_expr' of
+ get_in_scope_ids `thenM` \ in_scope ->
+ case lintUnfolding noSrcLoc in_scope core_expr' of
Nothing -> returnM ()
Just fail_msg -> pprPanic "Iface Lint failure" (doc <+> fail_msg)
) `thenM_`
returnM core_expr'
where
doc = text "Unfolding of" <+> ppr name
+ get_in_scope_ids -- Urgh; but just for linting
+ = setLclEnv () $
+ do { env <- getGblEnv
+ ; case if_rec_types env of {
+ Nothing -> return [] ;
+ Just (_, get_env) -> do
+ { type_env <- get_env
+ ; return (typeEnvIds type_env) }}}
\end{code}