diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2022-03-13 18:06:04 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-14 11:36:39 -0400 |
commit | 135888ddc6adc99126b84194a5da3d8736324132 (patch) | |
tree | 70cb2a1d13e5959d802fb4d1fc15f4bcada3e7a9 /compiler/GHC/Iface/Ext/Ast.hs | |
parent | 97db789eec7a49c3ec30a83666720221c26d8f9e (diff) | |
download | haskell-135888ddc6adc99126b84194a5da3d8736324132.tar.gz |
TTG Pull AbsBinds and ABExport out of the main AST
AbsBinds and ABExport both depended on the typechecker, and were thus
removed from the main AST Expr.
CollectPass now has a new function `collectXXHsBindsLR` used for the new
HsBinds extension point
Bumped haddock submodule to work with AST changes.
The removed Notes from Language.Haskell.Syntax.Binds were duplicated
(and not referenced) and the copies in GHC.Hs.Binds are kept (and
referenced there). (See #19252)
Diffstat (limited to 'compiler/GHC/Iface/Ext/Ast.hs')
-rw-r--r-- | compiler/GHC/Iface/Ext/Ast.hs | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/compiler/GHC/Iface/Ext/Ast.hs b/compiler/GHC/Iface/Ext/Ast.hs index 7b4e8bc20e..b6be92301f 100644 --- a/compiler/GHC/Iface/Ext/Ast.hs +++ b/compiler/GHC/Iface/Ext/Ast.hs @@ -267,12 +267,11 @@ instance ModifyState Id where addSubstitution mono poly hs = hs{name_remapping = extendNameEnv (name_remapping hs) (varName mono) poly} -modifyState :: ModifyState (IdP p) => [ABExport p] -> HieState -> HieState +modifyState :: [ABExport] -> HieState -> HieState modifyState = foldr go id where go ABE{abe_poly=poly,abe_mono=mono} f = addSubstitution mono poly . f - go _ f = f type HieM = ReaderT NodeOrigin (State HieState) @@ -847,21 +846,27 @@ instance HiePass p => ToHie (BindContext (LocatedA (HsBind (GhcPass p)))) where VarBind{var_rhs = expr} -> [ toHie expr ] - AbsBinds{ abs_exports = xs, abs_binds = binds - , abs_ev_binds = ev_binds - , abs_ev_vars = ev_vars } -> - [ lift (modify (modifyState xs)) >> -- Note [Name Remapping] - (toHie $ fmap (BC context scope) binds) - , toHie $ map (L span . abe_wrap) xs - , toHie $ - map (EvBindContext (mkScopeA span) (getRealSpanA span) - . L span) ev_binds - , toHie $ - map (C (EvidenceVarBind EvSigBind - (mkScopeA span) - (getRealSpanA span)) - . L span) ev_vars - ] + XHsBindsLR ext -> case hiePass @p of +#if __GLASGOW_HASKELL__ < 811 + HieRn -> dataConCantHappen ext +#endif + HieTc + | AbsBinds{ abs_exports = xs, abs_binds = binds + , abs_ev_binds = ev_binds + , abs_ev_vars = ev_vars } <- ext + -> + [ lift (modify (modifyState xs)) >> -- Note [Name Remapping] + (toHie $ fmap (BC context scope) binds) + , toHie $ map (L span . abe_wrap) xs + , toHie $ + map (EvBindContext (mkScopeA span) (getRealSpanA span) + . L span) ev_binds + , toHie $ + map (C (EvidenceVarBind EvSigBind + (mkScopeA span) + (getRealSpanA span)) + . L span) ev_vars + ] PatSynBind _ psb -> [ toHie $ L (locA span) psb -- PatSynBinds only occur at the top level ] |