@@ -1075,11 +1075,7 @@ parseHeader dflags filename contents = do
10751075 let loc = mkRealSrcLoc (Util. mkFastString filename) 1 1
10761076 case unP Compat. parseHeader (initParserState (initParserOpts dflags) contents loc) of
10771077 PFailedWithErrorMessages msgs ->
1078- #if MIN_VERSION_ghc(9,5,0)
1079- throwE $ diagFromErrMsgs sourceParser dflags $ msgs dflags
1080- #else
1081- throwE $ diagFromSDocErrMsgs sourceParser dflags $ msgs dflags
1082- #endif
1078+ throwE $ diagFromGhcErrorMessages sourceParser dflags $ msgs dflags
10831079 POk pst rdr_module -> do
10841080 let (warns, errs) = renderMessages $ getPsMessages pst
10851081
@@ -1093,17 +1089,9 @@ parseHeader dflags filename contents = do
10931089 -- errors are those from which a parse tree just can't
10941090 -- be produced.
10951091 unless (null errs) $
1096- #if MIN_VERSION_ghc(9,5,0)
1097- throwE $ diagFromErrMsgs sourceParser dflags errs
1098- #else
1099- throwE $ diagFromSDocErrMsgs sourceParser dflags errs
1100- #endif
1092+ throwE $ diagFromGhcErrorMessages sourceParser dflags errs
11011093
1102- #if MIN_VERSION_ghc(9,5,0)
1103- let warnings = diagFromErrMsgs sourceParser dflags warns
1104- #else
1105- let warnings = diagFromSDocErrMsgs sourceParser dflags warns
1106- #endif
1094+ let warnings = diagFromGhcErrorMessages sourceParser dflags warns
11071095 return (warnings, rdr_module)
11081096
11091097-- | Given a buffer, flags, and file path, produce a
@@ -1121,11 +1109,7 @@ parseFileContents env customPreprocessor filename ms = do
11211109 contents = fromJust $ ms_hspp_buf ms
11221110 case unP Compat. parseModule (initParserState (initParserOpts dflags) contents loc) of
11231111 PFailedWithErrorMessages msgs ->
1124- #if MIN_VERSION_ghc(9,5,0)
1125- throwE $ diagFromErrMsgs sourceParser dflags $ msgs dflags
1126- #else
1127- throwE $ diagFromSDocErrMsgs sourceParser dflags $ msgs dflags
1128- #endif
1112+ throwE $ diagFromGhcErrorMessages sourceParser dflags $ msgs dflags
11291113 POk pst rdr_module ->
11301114 let
11311115 psMessages = getPsMessages pst
@@ -1159,12 +1143,7 @@ parseFileContents env customPreprocessor filename ms = do
11591143 -- errors are those from which a parse tree just can't
11601144 -- be produced.
11611145 unless (null errors) $
1162- #if MIN_VERSION_ghc(9,5,0)
1163- throwE $ diagFromErrMsgs sourceParser dflags errors
1164- #else
1165- throwE $ diagFromSDocErrMsgs sourceParser dflags errors
1166- #endif
1167-
1146+ throwE $ diagFromGhcErrorMessages sourceParser dflags errors
11681147
11691148 -- To get the list of extra source files, we take the list
11701149 -- that the parser gave us,
@@ -1194,11 +1173,7 @@ parseFileContents env customPreprocessor filename ms = do
11941173 srcs2 <- liftIO $ filterM doesFileExist srcs1
11951174
11961175 let pm = ParsedModule ms parsed' srcs2
1197- #if MIN_VERSION_ghc(9,5,0)
1198- warnings = diagFromErrMsgs sourceParser dflags warns
1199- #else
1200- warnings = diagFromSDocErrMsgs sourceParser dflags warns
1201- #endif
1176+ warnings = diagFromGhcErrorMessages sourceParser dflags warns
12021177 pure (warnings ++ preproc_warning_file_diagnostics, pm)
12031178
12041179loadHieFile :: Compat. NameCacheUpdater -> FilePath -> IO GHC. HieFile
0 commit comments