diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2022-06-13 14:12:44 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-07-06 13:50:27 -0400 |
commit | e4eea07b808bea530cf4b4fd2468035dd2cad67b (patch) | |
tree | caccdfb05a598410064c0d24b32845d5471d1278 /compiler/GHC/Tc | |
parent | 3547e2640af45ab48187387fb60795a09b662038 (diff) | |
download | haskell-e4eea07b808bea530cf4b4fd2468035dd2cad67b.tar.gz |
TTG: Move CoreTickish out of LHS.Binds
Remove the `[CoreTickish]` fields from datatype `HsBindLR idL idR` and
move them to the extension point instance, according to the plan
outlined in #21592 to separate the base AST from the GHC specific bits.
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r-- | compiler/GHC/Tc/Gen/Bind.hs | 15 | ||||
-rw-r--r-- | compiler/GHC/Tc/TyCl/PatSyn.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Tc/Utils/Zonk.hs | 12 |
3 files changed, 16 insertions, 17 deletions
diff --git a/compiler/GHC/Tc/Gen/Bind.hs b/compiler/GHC/Tc/Gen/Bind.hs index 3db286e3e5..21d1424317 100644 --- a/compiler/GHC/Tc/Gen/Bind.hs +++ b/compiler/GHC/Tc/Gen/Bind.hs @@ -634,8 +634,8 @@ tcPolyCheck prag_fn ; let bind' = FunBind { fun_id = L nm_loc poly_id2 , fun_matches = matches' - , fun_ext = wrap_gen <.> wrap_res - , fun_tick = tick } + , fun_ext = (wrap_gen <.> wrap_res, tick) + } export = ABE { abe_wrap = idHsWrapper , abe_poly = poly_id @@ -1254,7 +1254,7 @@ tcMonoBinds is_rec sig_fn no_gen ; return (unitBag $ L b_loc $ FunBind { fun_id = L nm_loc mono_id, fun_matches = matches', - fun_ext = co_fn, fun_tick = [] }, + fun_ext = (co_fn, []) }, [MBI { mbi_poly_name = name , mbi_sig = Nothing , mbi_mono_id = mono_id }]) } @@ -1275,7 +1275,7 @@ tcMonoBinds is_rec sig_fn no_gen ; return ( unitBag $ L b_loc $ PatBind { pat_lhs = pat', pat_rhs = grhss' - , pat_ext = pat_ty, pat_ticks = ([],[]) } + , pat_ext = (pat_ty, ([],[])) } , mbis ) } where @@ -1507,8 +1507,8 @@ tcRhs (TcFunBind info@(MBI { mbi_sig = mb_sig, mbi_mono_id = mono_id }) matches (mkCheckExpType $ idType mono_id) ; return ( FunBind { fun_id = L (noAnnSrcSpan loc) mono_id , fun_matches = matches' - , fun_ext = co_fn - , fun_tick = [] } ) } + , fun_ext = (co_fn, []) + } ) } tcRhs (TcPatBind infos pat' grhss pat_ty) = -- When we are doing pattern bindings we *don't* bring any scoped @@ -1521,8 +1521,7 @@ tcRhs (TcPatBind infos pat' grhss pat_ty) tcGRHSsPat grhss (mkCheckExpType pat_ty) ; return ( PatBind { pat_lhs = pat', pat_rhs = grhss' - , pat_ext = pat_ty - , pat_ticks = ([],[]) } )} + , pat_ext = (pat_ty, ([],[])) } )} tcExtendTyVarEnvForRhs :: Maybe TcIdSigInst -> TcM a -> TcM a tcExtendTyVarEnvForRhs Nothing thing_inside diff --git a/compiler/GHC/Tc/TyCl/PatSyn.hs b/compiler/GHC/Tc/TyCl/PatSyn.hs index 8da94d2ec0..7fd1f3677f 100644 --- a/compiler/GHC/Tc/TyCl/PatSyn.hs +++ b/compiler/GHC/Tc/TyCl/PatSyn.hs @@ -857,8 +857,8 @@ tcPatSynMatcher (L loc ps_name) lpat prag_fn ; let bind = FunBind{ fun_id = L loc matcher_prag_id , fun_matches = mg - , fun_ext = idHsWrapper - , fun_tick = [] } + , fun_ext = (idHsWrapper, []) + } matcher_bind = unitBag (noLocA bind) ; traceTc "tcPatSynMatcher" (ppr ps_name $$ ppr (idType matcher_id)) ; traceTc "tcPatSynMatcher" (ppr matcher_bind) @@ -959,7 +959,7 @@ tcPatSynBuilderBind prag_fn (PSB { psb_id = ps_lname@(L loc ps_name) bind = FunBind { fun_id = L loc (idName builder_id) , fun_matches = match_group' , fun_ext = emptyNameSet - , fun_tick = [] } + } sig = completeSigFromId (PatSynCtxt ps_name) builder_id diff --git a/compiler/GHC/Tc/Utils/Zonk.hs b/compiler/GHC/Tc/Utils/Zonk.hs index e8b5f8252e..f11bc29000 100644 --- a/compiler/GHC/Tc/Utils/Zonk.hs +++ b/compiler/GHC/Tc/Utils/Zonk.hs @@ -535,12 +535,12 @@ zonk_lbind env = wrapLocMA (zonk_bind env) zonk_bind :: ZonkEnv -> HsBind GhcTc -> TcM (HsBind GhcTc) zonk_bind env bind@(PatBind { pat_lhs = pat, pat_rhs = grhss - , pat_ext = ty}) + , pat_ext = (ty, ticks)}) = do { (_env, new_pat) <- zonkPat env pat -- Env already extended ; new_grhss <- zonkGRHSs env zonkLExpr grhss ; new_ty <- zonkTcTypeToTypeX env ty ; return (bind { pat_lhs = new_pat, pat_rhs = new_grhss - , pat_ext = new_ty }) } + , pat_ext = (new_ty, ticks) }) } zonk_bind env (VarBind { var_ext = x , var_id = var, var_rhs = expr }) @@ -552,13 +552,13 @@ zonk_bind env (VarBind { var_ext = x zonk_bind env bind@(FunBind { fun_id = L loc var , fun_matches = ms - , fun_ext = co_fn }) + , fun_ext = (co_fn, ticks) }) = do { new_var <- zonkIdBndr env var ; (env1, new_co_fn) <- zonkCoFn env co_fn ; new_ms <- zonkMatchGroup env1 zonkLExpr ms ; return (bind { fun_id = L loc new_var , fun_matches = new_ms - , fun_ext = new_co_fn }) } + , fun_ext = (new_co_fn, ticks) }) } zonk_bind env (XHsBindsLR (AbsBinds { abs_tvs = tyvars, abs_ev_vars = evs , abs_ev_binds = ev_binds @@ -585,7 +585,7 @@ zonk_bind env (XHsBindsLR (AbsBinds { abs_tvs = tyvars, abs_ev_vars = evs | has_sig , (L loc bind@(FunBind { fun_id = (L mloc mono_id) , fun_matches = ms - , fun_ext = co_fn })) <- lbind + , fun_ext = (co_fn, ticks) })) <- lbind = do { new_mono_id <- updateIdTypeAndMultM (zonkTcTypeToTypeX env) mono_id -- Specifically /not/ zonkIdBndr; we do not want to -- complain about a representation-polymorphic binder @@ -594,7 +594,7 @@ zonk_bind env (XHsBindsLR (AbsBinds { abs_tvs = tyvars, abs_ev_vars = evs ; return $ L loc $ bind { fun_id = L mloc new_mono_id , fun_matches = new_ms - , fun_ext = new_co_fn } } + , fun_ext = (new_co_fn, ticks) } } | otherwise = zonk_lbind env lbind -- The normal case |