From 6f619e517abaebb868bff16ba4d2aba086d5108a Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 13 Oct 2000 16:00:45 +0000 Subject: [PATCH] [project @ 2000-10-13 16:00:45 by simonpj] Tidy up errors and warnings --- ghc/compiler/main/ErrUtils.lhs | 4 ++-- ghc/compiler/rename/Rename.lhs | 4 ++-- ghc/compiler/rename/RnMonad.lhs | 4 ++-- ghc/compiler/typecheck/TcModule.lhs | 4 ++-- ghc/compiler/typecheck/TcMonad.lhs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ghc/compiler/main/ErrUtils.lhs b/ghc/compiler/main/ErrUtils.lhs index d6a64f3..18b9e38 100644 --- a/ghc/compiler/main/ErrUtils.lhs +++ b/ghc/compiler/main/ErrUtils.lhs @@ -61,9 +61,9 @@ dontAddErrLoc title rest_of_err_msg | otherwise = ( noSrcLoc, hang (text title <> colon) 4 rest_of_err_msg ) -printErrorsAndWarnings :: Bag ErrMsg -> Bag WarnMsg -> IO () +printErrorsAndWarnings :: (Bag WarnMsg, Bag ErrMsg) -> IO () -- Don't print any warnings if there are errors -printErrorsAndWarnings errs warns +printErrorsAndWarnings (warns, errs) | no_errs && no_warns = return () | no_errs = printErrs (pprBagOfWarnings warns) | otherwise = printErrs (pprBagOfErrors errs) diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs index 9d340f2..33cbe0c 100644 --- a/ghc/compiler/rename/Rename.lhs +++ b/ghc/compiler/rename/Rename.lhs @@ -84,14 +84,14 @@ renameModule :: PersistentCompilerState -> RdrNameHsModule -> IO (Maybe RenameRe renameModule pcs this_mod@(HsModule mod_name vers exports imports local_decls _ loc) = -- Initialise the renamer monad do { - ((maybe_rn_stuff, dump_action), rn_errs_bag, rn_warns_bag) + ((maybe_rn_stuff, dump_action), msgs) <- initRn pcs (mkThisModule mod_name) (mkSearchPath opt_HiMap) loc (rename this_mod) ; -- Check for warnings - printErrorsAndWarnings rn_errs_bag rn_warns_bag ; + printErrorsAndWarnings msgs ; -- Dump any debugging output dump_action ; diff --git a/ghc/compiler/rename/RnMonad.lhs b/ghc/compiler/rename/RnMonad.lhs index da68104..d322c20 100644 --- a/ghc/compiler/rename/RnMonad.lhs +++ b/ghc/compiler/rename/RnMonad.lhs @@ -297,7 +297,7 @@ initRn :: DynFlags -> Finder -> GlobalSymbolTable -> PersistentRenamerState -> Module -> SrcLoc -> RnMG t - -> IO (t, Bag WarnMsg, Bag ErrMsg) + -> IO (t, (Bag WarnMsg, Bag ErrMsg)) initRn dflags finder gst prs mod loc do_rn = do uniqs <- mkSplitUniqSupply 'r' @@ -322,7 +322,7 @@ initRn dflags finder gst prs mod loc do_rn -- grab errors and return (warns, errs) <- readIORef errs_var - return (res, errs, warns) + return (res, (warns, errs)) initIfaces :: PersistentRenamerState -> Ifaces diff --git a/ghc/compiler/typecheck/TcModule.lhs b/ghc/compiler/typecheck/TcModule.lhs index 62da34d..8b72465 100644 --- a/ghc/compiler/typecheck/TcModule.lhs +++ b/ghc/compiler/typecheck/TcModule.lhs @@ -87,9 +87,9 @@ typecheckModule typecheckModule pcs hst (HsModule mod_name _ _ _ decls _ src_loc) = do { env <- initTcEnv global_symbol_table global_inst_env ; - (_, (maybe_result, warns, errs)) <- initTc env src_loc tc_module + (_, (maybe_result, msgs)) <- initTc env src_loc tc_module - printErrorsAndWarnings errs warns ; + printErrorsAndWarnings msgs ; printTcDumps maybe_result ; diff --git a/ghc/compiler/typecheck/TcMonad.lhs b/ghc/compiler/typecheck/TcMonad.lhs index f104fbe..21a8d89 100644 --- a/ghc/compiler/typecheck/TcMonad.lhs +++ b/ghc/compiler/typecheck/TcMonad.lhs @@ -126,7 +126,7 @@ type TcRef a = IORef a initTc :: TcEnv -> SrcLoc -> TcM r - -> IO (Maybe r, Bag WarnMsg, Bag ErrMsg) + -> IO (Maybe r, (Bag ErrMsg, Bag WarnMsg)) initTc tc_env src_loc do_this = do { @@ -147,7 +147,7 @@ initTc tc_env src_loc do_this (\_ -> return Nothing) ; (warns,errs) <- readIORef errs_var ; - return (maybe_res, warns, errs) + return (maybe_res, (warns, errs)) } -- Monadic operations -- 1.7.10.4