From 99d2de860ff82e3f626c8b3d47d355ab16d18fd1 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Thu, 23 Jan 2020 10:44:07 -0500 Subject: plugins: Ensure that loadInterface plugins can see annotations loadInterface replaces the `mi_decls`, `mi_insts`, `mi_fam_insts`, `mi_rules`, `mi_anns` fields of ModIface with `undefined` before inserting the interface into the EPS. However, we still want to give loadInterface plugins access to these fields. Consequently, we want to pass the unmodified `ModIface` the plugin. --- compiler/GHC/Iface/Load.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/GHC/Iface/Load.hs b/compiler/GHC/Iface/Load.hs index c812968b0a..64b25bee75 100644 --- a/compiler/GHC/Iface/Load.hs +++ b/compiler/GHC/Iface/Load.hs @@ -525,8 +525,9 @@ loadInterface doc_str mod from (length new_eps_insts) (length new_eps_rules) } - ; -- invoke plugins - res <- withPlugins dflags interfaceLoadAction final_iface + ; -- invoke plugins with *full* interface, not final_iface, to ensure + -- that plugins have access to declarations, etc. + res <- withPlugins dflags interfaceLoadAction iface ; return (Succeeded res) }}}} -- cgit v1.2.1