Skip to content

Commit de8bfaa

Browse files
dylan-thinnesJaro Reinders
authored and
Jaro Reinders
committed
DRY up definition of closure_errs
From review haskell#4311 (comment)
1 parent 679bc6b commit de8bfaa

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -876,28 +876,22 @@ newComponentCache recorder exts _cfp hsc_env old_cis new_cis = do
876876
hscEnv' <- -- Set up a multi component session with the other units on GHC 9.4
877877
Compat.initUnits dfs hsc_env
878878

879-
#if MIN_VERSION_ghc(9,6,1)
880879
let closure_errs = maybeToList $ checkHomeUnitsClosed' (hsc_unit_env hscEnv') (hsc_all_home_unit_ids hscEnv')
881880
closure_err_to_multi_err err =
882881
ideErrorWithSource
883882
(Just "cradle") (Just DiagnosticSeverity_Warning) _cfp
884883
(T.pack (Compat.printWithoutUniques (singleMessage err)))
884+
#if MIN_VERSION_ghc(9,6,1)
885885
(Just (fmap GhcDriverMessage err))
886-
multi_errs = map closure_err_to_multi_err closure_errs
887-
bad_units = OS.fromList $ concat $ do
888-
x <- map errMsgDiagnostic closure_errs
889-
DriverHomePackagesNotClosed us <- pure x
890-
pure us
891-
isBad ci = (homeUnitId_ (componentDynFlags ci)) `OS.member` bad_units
892886
#else
893-
let closure_errs = maybeToList $ checkHomeUnitsClosed' (hsc_unit_env hscEnv') (hsc_all_home_unit_ids hscEnv')
894-
multi_errs = map (\diag -> ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Warning) _cfp (T.pack (Compat.printWithoutUniques (singleMessage diag))) Nothing) closure_errs
887+
Nothing
888+
#endif
889+
multi_errs = map closure_err_to_multi_err closure_errs
895890
bad_units = OS.fromList $ concat $ do
896891
x <- map errMsgDiagnostic closure_errs
897892
DriverHomePackagesNotClosed us <- pure x
898893
pure us
899894
isBad ci = (homeUnitId_ (componentDynFlags ci)) `OS.member` bad_units
900-
#endif
901895
-- Whenever we spin up a session on Linux, dynamically load libm.so.6
902896
-- in. We need this in case the binary is statically linked, in which
903897
-- case the interactive session will fail when trying to load

0 commit comments

Comments
 (0)