X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FsimplCore%2FSimplEnv.lhs;h=5049a9fdc933ad78a9a203224537ec5a066b8e27;hb=d9fd6a665237f0e2ab769915db873b9d72bd1c0a;hp=8a3841fbb1670427b118e0e3d8e634d8f05450bc;hpb=7f05f1095e9a2c7b2b378859da00fde7ca907080;p=ghc-hetmet.git diff --git a/ghc/compiler/simplCore/SimplEnv.lhs b/ghc/compiler/simplCore/SimplEnv.lhs index 8a3841f..5049a9f 100644 --- a/ghc/compiler/simplCore/SimplEnv.lhs +++ b/ghc/compiler/simplCore/SimplEnv.lhs @@ -46,9 +46,9 @@ import IdInfo ( IdInfo, vanillaIdInfo, occInfo, setOccInfo, specInfo, setSpecIn unknownArity, workerExists ) import CoreSyn +import Unify ( TypeRefinement ) import Rules ( RuleBase ) import CoreUtils ( needsCaseBinding ) -import PprCore () -- Instances import CostCentre ( CostCentreStack, subsumedCCS ) import Var import VarEnv @@ -62,7 +62,6 @@ import Type ( Type, TvSubst(..), TvSubstEnv, composeTvSubst, isUnLiftedType, seqType, tyVarsOfType ) import BasicTypes ( OccInfo(..), isFragileOcc ) import CmdLineOpts ( SimplifierMode(..) ) -import Util ( mapAccumL ) import Outputable \end{code} @@ -310,22 +309,19 @@ Given an idempotent substitution, generated by the unifier, use it to refine the environment \begin{code} -refineSimplEnv :: SimplEnv -> TvSubstEnv -> [OutTyVar] -> SimplEnv +refineSimplEnv :: SimplEnv -> TypeRefinement -> SimplEnv -- The TvSubstEnv is the refinement, and it refines OutTyVars into OutTypes refineSimplEnv env@(SimplEnv { seTvSubst = tv_subst, seInScope = in_scope }) - refine_tv_subst tvs + (refine_tv_subst, all_bound_here) = env { seTvSubst = composeTvSubst in_scope refine_tv_subst tv_subst, seInScope = in_scope' } where in_scope' - | all bound_here (varEnvKeys refine_tv_subst) = in_scope + | all_bound_here = in_scope -- The tvs are the tyvars bound here. If only they -- are refined, there's no need to do anything | otherwise = mapInScopeSet refine_id in_scope - bound_here uniq = elemVarSetByKey uniq tv_set - tv_set = mkVarSet tvs - refine_id v -- Only refine its type; any rules will get -- refined if they are used (I hope) | isId v = setIdType v (Type.substTy refine_subst (idType v))