@@ -218,13 +218,9 @@ getParsedModuleRule =
218
218
mainParse = getParsedModuleDefinition hsc opt file ms
219
219
reset_ms pm = pm { pm_mod_summary = ms' }
220
220
221
- #if MIN_VERSION_ghc(9,0,1)
222
- -- We no longer need to parse again if GHC version is above 9.0
223
- -- https://github.com/haskell/haskell-language-server/issues/1892
224
- res@ (_,pmod) <- liftIO $ (fmap . fmap . fmap ) reset_ms mainParse
225
- #else
226
221
-- Parse again (if necessary) to capture Haddock parse errors
227
- res@ (_,pmod) <- if gopt Opt_Haddock dflags
222
+ -- We no longer need to parse again if GHC version is above 9.0. https://github.com/haskell/haskell-language-server/issues/1892
223
+ res@ (_,pmod) <- if Compat. ghcVersion >= Compat. GHC90 || gopt Opt_Haddock dflags
228
224
then
229
225
liftIO $ (fmap . fmap . fmap ) reset_ms mainParse
230
226
else do
@@ -250,7 +246,6 @@ getParsedModuleRule =
250
246
-- This seems to be the correct behaviour because the Haddock flag is added
251
247
-- by us and not the user, so our IDE shouldn't stop working because of it.
252
248
_ -> pure (diagsM, res)
253
- #endif
254
249
-- Add dependencies on included files
255
250
_ <- uses GetModificationTime $ map toNormalizedFilePath' (maybe [] pm_extra_src_files pmod)
256
251
pure res
@@ -898,17 +893,14 @@ regenerateHiFile sess f ms compNeeded = do
898
893
899
894
-- Embed haddocks in the interface file
900
895
(diags, mb_pm) <- liftIO $ getParsedModuleDefinition hsc opt f (withOptHaddock ms)
901
- #if MIN_VERSION_ghc(9,0,1)
902
- -- We no longer need to parse again if GHC version is above 9.0
903
- -- https://github.com/haskell/haskell-language-server/issues/1892
904
- #else
905
- (diags, mb_pm) <- case mb_pm of
906
- Just _ -> return (diags, mb_pm)
907
- Nothing -> do
896
+ (diags, mb_pm) <-
897
+ -- We no longer need to parse again if GHC version is above 9.0. https://github.com/haskell/haskell-language-server/issues/1892
898
+ if Compat. ghcVersion >= Compat. GHC90 || isJust mb_pm then do
899
+ return (diags, mb_pm)
900
+ else do
908
901
-- if parsing fails, try parsing again with Haddock turned off
909
902
(diagsNoHaddock, mb_pm) <- liftIO $ getParsedModuleDefinition hsc opt f ms
910
903
return (mergeParseErrorsHaddock diagsNoHaddock diags, mb_pm)
911
- #endif
912
904
case mb_pm of
913
905
Nothing -> return (diags, Nothing )
914
906
Just pm -> do
0 commit comments