[Git][ghc/ghc][wip/T25647] Add implicit variable bindings to HsOuterExplicit in various instances
Patrick (@soulomoon)
gitlab at gitlab.haskell.org
Sun Mar 9 16:08:19 UTC 2025
Patrick pushed to branch wip/T25647 at Glasgow Haskell Compiler / GHC
Commits:
67ed0e7c by Patrick at 2025-03-10T00:08:08+08:00
Add implicit variable bindings to HsOuterExplicit in various instances
- - - - -
4 changed files:
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Sig.hs
Changes:
=====================================
compiler/GHC/HsToCore/Quote.hs
=====================================
@@ -1212,9 +1212,10 @@ addHsOuterFamEqnTyVarBinds outer_bndrs thing_inside = do
HsOuterImplicit{hso_ximplicit = imp_tvs} ->
addSimpleTyVarBinds ReuseBoundNames imp_tvs $
thing_inside $ coreNothingList elt_ty
- HsOuterExplicit{hso_bndrs = exp_bndrs} ->
+ HsOuterExplicit{hso_bndrs = exp_bndrs,hso_ximplicit = imp_tvs} ->
addHsTyVarBinds FreshNamesOnly exp_bndrs $ \th_exp_bndrs ->
- thing_inside $ coreJustList elt_ty th_exp_bndrs
+ addSimpleTyVarBinds ReuseBoundNames imp_tvs $
+ thing_inside $ coreJustList elt_ty th_exp_bndrs
addHsOuterSigTyVarBinds ::
HsOuterSigTyVarBndrs GhcRn
=====================================
compiler/GHC/Iface/Ext/Ast.hs
=====================================
@@ -1753,8 +1753,11 @@ instance ToHie (LocatedA (ConDecl GhcRn)) where
HsOuterImplicit{hso_ximplicit = imp_vars} ->
bindingsOnly $ map (C $ TyVarBind (mkScope outer_bndrs_loc) resScope)
imp_vars
- HsOuterExplicit{hso_bndrs = exp_bndrs} ->
- toHie $ tvScopes resScope NoScope exp_bndrs
+ HsOuterExplicit{hso_bndrs = exp_bndrs,hso_ximplicit = imp_vars} -> do
+ exps <- toHie $ tvScopes resScope NoScope exp_bndrs
+ imps <- bindingsOnly $ map (C $ TyVarBind (mkScope outer_bndrs_loc) resScope)
+ imp_vars
+ pure $ exps ++ imps
, toHie ctx
, toHie args
, toHie typ
=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -3403,13 +3403,13 @@ tcOuterTKBndrsX skol_mode skol_info outer_bndrs thing_inside
do { (imp_tvs', thing) <- tcImplicitTKBndrsX skol_mode skol_info imp_tvs thing_inside
; return ( HsOuterImplicit{hso_ximplicit = imp_tvs'}
, thing) }
- HsOuterExplicit{hso_bndrs = exp_bndrs} ->
- do { (exp_tvs', thing) <- tcExplicitTKBndrsX skol_mode exp_bndrs thing_inside
+ HsOuterExplicit{hso_bndrs = exp_bndrs,hso_ximplicit = imp_tvs} ->
+ do { (exp_tvs', (imp_tvs', thing)) <- tcExplicitTKBndrsX skol_mode exp_bndrs $ tcImplicitTKBndrsX skol_mode skol_info imp_tvs thing_inside
; return ( HsOuterExplicit { hso_xexplicit = exp_tvs'
, hso_bndrs = exp_bndrs
-- note nothing should be here since
-- sig
- , hso_ximplicit = [] }
+ , hso_ximplicit = imp_tvs' }
, thing)
}
=====================================
compiler/GHC/Tc/Gen/Sig.hs
=====================================
@@ -401,7 +401,7 @@ tcPatSynSig name sig_ty@(L _ (HsSig{sig_bndrs = hs_outer_bndrs, sig_body = hs_ty
univ_bndrs :: [TcInvisTVBinder]
(implicit_tvs, univ_bndrs) = case outer_bndrs of
HsOuterImplicit{hso_ximplicit = implicit_tvs} -> (implicit_tvs, [])
- HsOuterExplicit{hso_xexplicit = univ_bndrs} -> ([], univ_bndrs)
+ HsOuterExplicit{hso_xexplicit = univ_bndrs,hso_ximplicit = implicit_tvs} -> (implicit_tvs, univ_bndrs)
; implicit_tvs <- zonkAndScopedSort implicit_tvs
; let implicit_bndrs = mkTyVarBinders SpecifiedSpec implicit_tvs
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/67ed0e7c39d8ed80ea8c81ffe26ea6251e07bad2
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/67ed0e7c39d8ed80ea8c81ffe26ea6251e07bad2
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250309/b650f6d3/attachment-0001.html>
More information about the ghc-commits
mailing list