GHCi discards plugins on reload
Summary
When trying to use plugins in an interactive context, the plugins are unloaded whenever GHCi reloads. This bug appears to have been introduced in 9.2.
Loaded plugins used to live in the DynFlags but were moved to the InteractiveContext for GHCi, which gets cleared by discardIC during the loading process. I found that simply not emptying out the ic_plugins field in discardIC fixes the issue.
Steps to reproduce
- Load a plugin in a GHCi session:
:set -fplugin=SomePlugin - Use the
:reloadcommand - The plugin is no longer in the context
Expected behavior
Plugins should persist across reloads.
Environment
- GHC version used: 9.2.0.20210821