@@ -220,11 +220,12 @@ getParsedModuleRule =
220
220
221
221
let dflags = ms_hspp_opts ms
222
222
mainParse = getParsedModuleDefinition hsc opt file ms
223
+ reset_ms pm = pm { pm_mod_summary = ms' }
223
224
224
225
-- Parse again (if necessary) to capture Haddock parse errors
225
226
res@ (_,pmod) <- if gopt Opt_Haddock dflags
226
227
then
227
- liftIO mainParse
228
+ liftIO $ fmap ( fmap ( fmap reset_ms)) mainParse
228
229
else do
229
230
let haddockParse = getParsedModuleDefinition hsc opt file (withOptHaddock ms)
230
231
@@ -234,7 +235,7 @@ getParsedModuleRule =
234
235
-- If we can parse Haddocks, might as well use them
235
236
--
236
237
-- HLINT INTEGRATION: might need to save the other parsed module too
237
- ((diags,res),(diagsh,resh)) <- liftIO $ concurrently mainParse haddockParse
238
+ ((diags,res),(diagsh,resh)) <- liftIO $ fmap ( fmap ( fmap ( fmap reset_ms))) $ concurrently mainParse haddockParse
238
239
239
240
-- Merge haddock and regular diagnostics so we can always report haddock
240
241
-- parse errors
@@ -288,8 +289,9 @@ getParsedModuleWithCommentsRule =
288
289
let ms' = withoutOption Opt_Haddock $ withOption Opt_KeepRawTokenStream ms
289
290
modify_dflags <- getModifyDynFlags id dynFlagsModifyParser
290
291
let ms = ms' { ms_hspp_opts = modify_dflags $ ms_hspp_opts ms' }
292
+ reset_ms pm = pm { pm_mod_summary = ms' }
291
293
292
- liftIO $ snd <$> getParsedModuleDefinition (hscEnv sess) opt file ms
294
+ liftIO $ fmap ( fmap reset_ms) $ snd <$> getParsedModuleDefinition (hscEnv sess) opt file ms
293
295
294
296
getModifyDynFlags :: a -> (DynFlagsModifications -> a ) -> Action a
295
297
getModifyDynFlags a f = maybe a (f . dynFlagsMods) <$> getShakeExtra
0 commit comments