diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-09-14 14:51:16 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-17 09:45:36 -0400 |
commit | f6a69fb897ba873e2c8cac93d25d770b273278ea (patch) | |
tree | 7d36f145fce429dc3219b42eae64a5a6468faab8 /compiler/GHC/Driver/Main.hs | |
parent | c662ac7e39a0a2fb85d4ab17ae71d54752d24f39 (diff) | |
download | haskell-f6a69fb897ba873e2c8cac93d25d770b273278ea.tar.gz |
Use an ADT for RecompReason
Diffstat (limited to 'compiler/GHC/Driver/Main.hs')
-rw-r--r-- | compiler/GHC/Driver/Main.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs index 647ce0bf26..a01c559c80 100644 --- a/compiler/GHC/Driver/Main.hs +++ b/compiler/GHC/Driver/Main.hs @@ -742,7 +742,7 @@ checkObjects dflags mb_old_linkable summary = do checkDynamicObj k = case dt_state of DT_OK -> case (>=) <$> mb_dyn_obj_date <*> mb_if_date of Just True -> k - _ -> return (RecompBecause "Missing dynamic object", Nothing) + _ -> return (RecompBecause MissingDynObjectFile, Nothing) -- Not in dynamic-too mode _ -> k @@ -755,7 +755,7 @@ checkObjects dflags mb_old_linkable summary = do | isObjectLinkable old_linkable, linkableTime old_linkable == obj_date -> return $ (UpToDate, Just old_linkable) _ -> (UpToDate,) . Just <$> findObjectLinkable this_mod obj_fn obj_date - _ -> return (RecompBecause "Missing object file", Nothing) + _ -> return (RecompBecause MissingObjectFile, Nothing) -- | Check to see if we can reuse the old linkable, by this point we will -- have just checked that the old interface matches up with the source hash, so @@ -766,7 +766,7 @@ checkByteCode mb_old_linkable = Just old_linkable | not (isObjectLinkable old_linkable) -> return $ (UpToDate, Just old_linkable) - _ -> return $ (RecompBecause "Missing bytecode", Nothing) + _ -> return $ (RecompBecause MissingBytecode, Nothing) -------------------------------------------------------------- -- Compilers @@ -1083,17 +1083,20 @@ batchMsg hsc_env mod_index recomp node = case node of UpToDate | logVerbAtLeast logger 2 -> showMsg (text "Skipping ") empty | otherwise -> return () - RecompBecause reason -> showMsg (text "Instantiating ") (text " [" <> text reason <> text "]") + RecompBecause reason -> showMsg (text "Instantiating ") + (text " [" <> pprWithUnitState state (ppr reason) <> text "]") ModuleNode _ -> case recomp of MustCompile -> showMsg (text "Compiling ") empty UpToDate | logVerbAtLeast logger 2 -> showMsg (text "Skipping ") empty | otherwise -> return () - RecompBecause reason -> showMsg (text "Compiling ") (text " [" <> text reason <> text "]") + RecompBecause reason -> showMsg (text "Compiling ") + (text " [" <> pprWithUnitState state (ppr reason) <> text "]") where dflags = hsc_dflags hsc_env logger = hsc_logger hsc_env + state = hsc_units hsc_env showMsg msg reason = compilationProgressMsg logger $ (showModuleIndex mod_index <> |