diff options
author | Alanas Plascinskas <alanas.pla@gmail.com> | 2018-06-02 23:23:48 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-02 23:24:06 -0400 |
commit | 9b7eec8614f531e20a34e8dd2f62293ab0fedf8c (patch) | |
tree | c03947c465309e1caab0a6a9c21492e7cddc46c4 | |
parent | 08073e16cf672d8009309e4e55d4566af1ecaff4 (diff) | |
download | haskell-9b7eec8614f531e20a34e8dd2f62293ab0fedf8c.tar.gz |
tcExtendTyVarEnv2 changed to tcExtendNameTyVarEnv
Reviewers: mpickering, goldfire, bgamari
Reviewed By: mpickering
Subscribers: goldfire, rwbarton, thomie, carter
GHC Trac Issues: #15017
Differential Revision: https://phabricator.haskell.org/D4732
-rw-r--r-- | compiler/typecheck/TcBinds.hs | 6 | ||||
-rw-r--r-- | compiler/typecheck/TcEnv.hs | 8 | ||||
-rw-r--r-- | compiler/typecheck/TcExpr.hs | 6 | ||||
-rw-r--r-- | compiler/typecheck/TcHsType.hs | 6 | ||||
-rw-r--r-- | compiler/typecheck/TcInstDcls.hs | 2 | ||||
-rw-r--r-- | compiler/typecheck/TcPat.hs | 6 | ||||
-rw-r--r-- | compiler/typecheck/TcRules.hs | 2 |
7 files changed, 18 insertions, 18 deletions
diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 4b2cc08e7b..85c1b0ccce 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -710,7 +710,7 @@ tcPolyCheck prag_fn ; (ev_binds, (co_fn, matches')) <- checkConstraints skol_info skol_tvs ev_vars $ tcExtendBinderStack [TcIdBndr mono_id NotTopLevel] $ - tcExtendTyVarEnv2 tv_prs $ + tcExtendNameTyVarEnv tv_prs $ setSrcSpan loc $ tcMatchesFun (L nm_loc mono_name) matches (mkCheckExpType tau) @@ -1457,8 +1457,8 @@ tcExtendTyVarEnvFromSig :: TcIdSigInst -> TcM a -> TcM a tcExtendTyVarEnvFromSig sig_inst thing_inside | TISI { sig_inst_skols = skol_prs, sig_inst_wcs = wcs } <- sig_inst -- Note [Use tcExtendTyVar not scopeTyVars in tcRhs] - = tcExtendTyVarEnv2 wcs $ - tcExtendTyVarEnv2 skol_prs $ + = tcExtendNameTyVarEnv wcs $ + tcExtendNameTyVarEnv skol_prs $ thing_inside tcExtendIdBinderStackForRhs :: [MonoBindInfo] -> TcM a -> TcM a diff --git a/compiler/typecheck/TcEnv.hs b/compiler/typecheck/TcEnv.hs index 81ef54e145..0d875d7380 100644 --- a/compiler/typecheck/TcEnv.hs +++ b/compiler/typecheck/TcEnv.hs @@ -27,7 +27,7 @@ module TcEnv( -- Local environment tcExtendKindEnv, tcExtendKindEnvList, - tcExtendTyVarEnv, tcExtendTyVarEnv2, + tcExtendTyVarEnv, tcExtendNameTyVarEnv, tcExtendLetEnv, tcExtendSigIds, tcExtendRecIds, tcExtendIdEnv, tcExtendIdEnv1, tcExtendIdEnv2, tcExtendBinderStack, tcExtendLocalTypeEnv, @@ -464,13 +464,13 @@ tcExtendKindEnv extra_env thing_inside -- bumps the TcLevel. tcExtendTyVarEnv :: [TyVar] -> TcM r -> TcM r tcExtendTyVarEnv tvs thing_inside - = tcExtendTyVarEnv2 (mkTyVarNamePairs tvs) thing_inside + = tcExtendNameTyVarEnv (mkTyVarNamePairs tvs) thing_inside -- Before using this function, consider using TcHsType.scopeTyVars2, which -- bumps the TcLevel and thus prevents any of these TyVars from appearing -- in kinds of tyvars in an outer scope. -tcExtendTyVarEnv2 :: [(Name,TcTyVar)] -> TcM r -> TcM r -tcExtendTyVarEnv2 binds thing_inside +tcExtendNameTyVarEnv :: [(Name,TcTyVar)] -> TcM r -> TcM r +tcExtendNameTyVarEnv binds thing_inside -- this should be used only for explicitly mentioned scoped variables. -- thus, no coercion variables = do { tc_extend_local_env NotTopLevel diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index dd70aa2678..2588899bcf 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -1583,7 +1583,7 @@ tcExprSig expr (CompleteSig { sig_bndr = poly_id, sig_loc = loc }) ; let skol_info = SigSkol ExprSigCtxt (idType poly_id) tv_prs skol_tvs = map snd tv_prs ; (ev_binds, expr') <- checkConstraints skol_info skol_tvs given $ - tcExtendTyVarEnv2 tv_prs $ + tcExtendNameTyVarEnv tv_prs $ tcPolyExprNC expr tau ; let poly_wrap = mkWpTyLams skol_tvs @@ -1596,8 +1596,8 @@ tcExprSig expr sig@(PartialSig { psig_name = name, sig_loc = loc }) do { (tclvl, wanted, (expr', sig_inst)) <- pushLevelAndCaptureConstraints $ do { sig_inst <- tcInstSig sig - ; expr' <- tcExtendTyVarEnv2 (sig_inst_skols sig_inst) $ - tcExtendTyVarEnv2 (sig_inst_wcs sig_inst) $ + ; expr' <- tcExtendNameTyVarEnv (sig_inst_skols sig_inst) $ + tcExtendNameTyVarEnv (sig_inst_wcs sig_inst) $ tcPolyExprNC expr (sig_inst_tau sig_inst) ; return (expr', sig_inst) } -- See Note [Partial expression signatures] diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 2b2b64b909..40f617a421 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1516,7 +1516,7 @@ tcWildCardBindersX new_wc maybe_skol_info wc_names thing_inside where scope_tvs | Just info <- maybe_skol_info = scopeTyVars2 info - | otherwise = tcExtendTyVarEnv2 + | otherwise = tcExtendNameTyVarEnv -- | Kind-check a 'LHsQTyVars'. If the decl under consideration has a complete, -- user-supplied kind signature (CUSK), generalise the result. @@ -1922,7 +1922,7 @@ scopeTyVars2 :: SkolemInfo -> [(Name, TcTyVar)] -> TcM a -> TcM a scopeTyVars2 skol_info prs thing_inside = fmap snd $ -- discard the TcEvBinds, which will always be empty checkConstraints skol_info (map snd prs) [{- no EvVars -}] $ - tcExtendTyVarEnv2 prs $ + tcExtendNameTyVarEnv prs $ thing_inside ------------------ @@ -2079,7 +2079,7 @@ kcTyClTyVars :: Name -> TcM a -> TcM a kcTyClTyVars tycon_name thing_inside -- See Note [Use SigTvs in kind-checking pass] in TcTyClsDecls = do { tycon <- kcLookupTcTyCon tycon_name - ; tcExtendTyVarEnv2 (tcTyConScopedTyVars tycon) $ thing_inside } + ; tcExtendNameTyVarEnv (tcTyConScopedTyVars tycon) $ thing_inside } tcTyClTyVars :: Name -> ([TyConBinder] -> Kind -> TcM a) -> TcM a diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 7b869fd886..21a8209b5e 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -1303,7 +1303,7 @@ tcMethods dfun_id clas tyvars dfun_ev_vars inst_tys , ib_derived = is_derived }) -- tcExtendTyVarEnv (not scopeTyVars) is OK because the TcLevel is pushed -- in checkInstConstraints - = tcExtendTyVarEnv2 (lexical_tvs `zip` tyvars) $ + = tcExtendNameTyVarEnv (lexical_tvs `zip` tyvars) $ -- The lexical_tvs scope over the 'where' part do { traceTc "tcInstMeth" (ppr sigs $$ ppr binds) ; checkMinimalDefinition diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs index e59d15f375..ed797d389c 100644 --- a/compiler/typecheck/TcPat.hs +++ b/compiler/typecheck/TcPat.hs @@ -409,12 +409,12 @@ tc_pat penv (ViewPat _ expr pat) overall_pat_ty thing_inside tc_pat penv (SigPat sig_ty pat ) pat_ty thing_inside = do { (inner_ty, tv_binds, wcs, wrap) <- tcPatSig (inPatBind penv) sig_ty pat_ty - -- Using tcExtendTyVarEnv2 is appropriate here (not scopeTyVars2) + -- Using tcExtendNameTyVarEnv is appropriate here (not scopeTyVars2) -- because we're not really bringing fresh tyvars into scope. -- We're *naming* existing tyvars. Note that it is OK for a tyvar -- from an outer scope to mention one of these tyvars in its kind. - ; (pat', res) <- tcExtendTyVarEnv2 wcs $ - tcExtendTyVarEnv2 tv_binds $ + ; (pat', res) <- tcExtendNameTyVarEnv wcs $ + tcExtendNameTyVarEnv tv_binds $ tc_lpat pat (mkCheckExpType inner_ty) penv thing_inside ; pat_ty <- readExpType pat_ty ; return (mkHsWrapPat wrap (SigPat inner_ty pat') pat_ty, res) } diff --git a/compiler/typecheck/TcRules.hs b/compiler/typecheck/TcRules.hs index 1a55e4a553..421cdd69f9 100644 --- a/compiler/typecheck/TcRules.hs +++ b/compiler/typecheck/TcRules.hs @@ -155,7 +155,7 @@ tcRuleBndrs (L _ (RuleBndrSig _ (L _ name) rn_ty) : rule_bndrs) -- See Note [Pattern signature binders] in TcHsType -- The type variables scope over subsequent bindings; yuk - ; vars <- tcExtendTyVarEnv2 tvs $ + ; vars <- tcExtendNameTyVarEnv tvs $ tcRuleBndrs rule_bndrs ; return (map snd tvs ++ id : vars) } tcRuleBndrs (L _ (XRuleBndr _) : _) = panic "tcRuleBndrs" |