<div dir="ltr">Dear ghc devs,<br><br>I am in the process of updating my dev tool, which uses the ghc api, to support ghc-8.8.x.<br><br>However, I have noticed that one of my regression tests is failing, and I have isolated the problem to a change in behaviour in typecheckModule when using a Target with an in-memory buffer (i.e. targetContents is a Just).<br><br>Using debug tracing, I can confirm that in the following code, the ms_hspp_buf of a ModSummary has my in-memory version:<br><br>  <a href="https://gitlab.com/tseenshe/hsinspect/-/blob/dfcb50a4e3437fbb4d0a3eb786b99c3a527d5e23/library/HsInspect/Workarounds.hs#L77-84">https://gitlab.com/tseenshe/hsinspect/-/blob/dfcb50a4e3437fbb4d0a3eb786b99c3a527d5e23/library/HsInspect/Workarounds.hs#L77-84</a><br><br>  minf_rdr_env' :: GHC.GhcMonad m => GHC.ModuleName -> m GlobalRdrEnv<br>  minf_rdr_env' m = do<br>    modSum <- GHC.getModSummary m<br>    pmod <- GHC.parseModule modSum<br>    tmod <- GHC.typecheckModule pmod<br>    let (tc_gbl_env, _) = GHC.tm_internals_ tmod<br>    pure $ tcg_rdr_env tc_gbl_env<br><div><br></div><div>You can see how I setup the session in <br></div><div><br></div><div>  <a href="https://gitlab.com/tseenshe/hsinspect/-/blob/dfcb50a4e3437fbb4d0a3eb786b99c3a527d5e23/library/HsInspect/Imports.hs#L21-35">https://gitlab.com/tseenshe/hsinspect/-/blob/dfcb50a4e3437fbb4d0a3eb786b99c3a527d5e23/library/HsInspect/Imports.hs#L21-35</a></div><div><br></div><div>And whereas in 8.4.4 and 8.6.5 the typecheckModule call is working on the in-memory representation, in 8.8.1 and 8.8.2 it is falling back to the version on disk and therefore failing, because I have made in-memory changes that are necessary.</div><div><br></div><div>Aside: I am able to observe this because I have a function that trims everything except the module declaration and import section, and can therefore tolerate typos in the rest of the file. Now my code fails if the entire file does not typecheck, which is also incredibly slow, because I only want access to the import section.</div><div><br></div><div>Best regards,<br></div><div>Tseen She<br></div></div>