Fix some leaks in GHCi
This patch has 3 changes
-
driver: Ensure we actually clear the interactive context before reloading
Previously we called discardIC, but immediately after set the session back to an old HscEnv that still contained the IC
-
driver: Ensure we force the lookup of old build artifacts before returning the build plan
This prevents us from retaining all previous build artifacts in memory until a recompile finishes, instead only retaining the exact artifacts we need.
-
compiler: Add some strictness annotations to ImportSpec and related constructors This prevents us from retaining entire HscEnvs through this field.
Fixes #24107 (closed)
Fixes #23405 (closed)
Fixes #24118 (closed)