summaryrefslogtreecommitdiff
path: root/compiler/rename
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-10-16 15:28:26 +0100
committerIan Lynagh <ian@well-typed.com>2012-10-16 16:08:38 +0100
commitcd33eefd0467ae7ee4d22f16fcaaccfd33f18cb5 (patch)
tree30fb18578f1c5c81fef7ccc6ec5879a41fd4e5c0 /compiler/rename
parent6759e5a482d927870c90efe97b820d492785a6fd (diff)
downloadhaskell-cd33eefd0467ae7ee4d22f16fcaaccfd33f18cb5.tar.gz
Some alpha renaming
Mostly d -> g (matching DynFlag -> GeneralFlag). Also renamed if* to when*, matching the Haskell if/when names
Diffstat (limited to 'compiler/rename')
-rw-r--r--compiler/rename/RnBinds.lhs2
-rw-r--r--compiler/rename/RnEnv.lhs10
-rw-r--r--compiler/rename/RnExpr.lhs2
-rw-r--r--compiler/rename/RnNames.lhs14
-rw-r--r--compiler/rename/RnTypes.lhs2
5 files changed, 15 insertions, 15 deletions
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index a0aea6a582..dfead07797 100644
--- a/compiler/rename/RnBinds.lhs
+++ b/compiler/rename/RnBinds.lhs
@@ -463,7 +463,7 @@ rnBind _ (L loc bind@(PatBind { pat_lhs = pat
-- which (a) is not that different from _v = rhs
-- (b) is sometimes used to give a type sig for,
-- or an occurrence of, a variable on the RHS
- ; ifWOptM Opt_WarnUnusedBinds $
+ ; whenWOptM Opt_WarnUnusedBinds $
when (null bndrs && not is_wild_pat) $
addWarn $ unusedPatBindWarn bind'
diff --git a/compiler/rename/RnEnv.lhs b/compiler/rename/RnEnv.lhs
index 6385e1b52d..f29d64c55c 100644
--- a/compiler/rename/RnEnv.lhs
+++ b/compiler/rename/RnEnv.lhs
@@ -619,7 +619,7 @@ lookupOccRn_maybe rdr_name
-- imports. We can and should instead check the qualified import
-- but at the moment this requires some refactoring so leave as a TODO
; dflags <- getDynFlags
- ; let allow_qual = dopt Opt_ImplicitImportQualified dflags &&
+ ; let allow_qual = gopt Opt_ImplicitImportQualified dflags &&
not (safeDirectImpsReq dflags)
; is_ghci <- getIsGHCi
-- This test is not expensive,
@@ -1307,7 +1307,7 @@ checkDupAndShadowedNames envs names
-------------------------------------
checkShadowedOccs :: (GlobalRdrEnv, LocalRdrEnv) -> [(SrcSpan,OccName)] -> RnM ()
checkShadowedOccs (global_env,local_env) loc_occs
- = ifWOptM Opt_WarnNameShadowing $
+ = whenWOptM Opt_WarnNameShadowing $
do { traceRn (text "shadow" <+> ppr loc_occs)
; mapM_ check_shadow loc_occs }
where
@@ -1359,7 +1359,7 @@ unboundName wl rdr = unboundNameX wl rdr empty
unboundNameX :: WhereLooking -> RdrName -> SDoc -> RnM Name
unboundNameX where_look rdr_name extra
- = do { show_helpful_errors <- doptM Opt_HelpfulErrors
+ = do { show_helpful_errors <- goptM Opt_HelpfulErrors
; let what = pprNonVarNameSpace (occNameSpace (rdrNameOcc rdr_name))
err = unknownNameErr what rdr_name $$ extra
; if not show_helpful_errors
@@ -1538,7 +1538,7 @@ mapFvRnCPS f (x:xs) cont = f x $ \ x' ->
\begin{code}
warnUnusedTopBinds :: [GlobalRdrElt] -> RnM ()
warnUnusedTopBinds gres
- = ifWOptM Opt_WarnUnusedBinds
+ = whenWOptM Opt_WarnUnusedBinds
$ do isBoot <- tcIsHsBoot
let noParent gre = case gre_par gre of
NoParent -> True
@@ -1556,7 +1556,7 @@ warnUnusedMatches = check_unused Opt_WarnUnusedMatches
check_unused :: WarningFlag -> [Name] -> FreeVars -> RnM ()
check_unused flag bound_names used_names
- = ifWOptM flag (warnUnusedLocals (filterOut (`elemNameSet` used_names) bound_names))
+ = whenWOptM flag (warnUnusedLocals (filterOut (`elemNameSet` used_names) bound_names))
-------------------------
-- Helpers
diff --git a/compiler/rename/RnExpr.lhs b/compiler/rename/RnExpr.lhs
index 0d69d252f1..038f754406 100644
--- a/compiler/rename/RnExpr.lhs
+++ b/compiler/rename/RnExpr.lhs
@@ -100,7 +100,7 @@ finishHsVar :: Name -> RnM (HsExpr Name, FreeVars)
-- when renaming infix expressions
-- See Note [Adding the implicit parameter to 'assert']
finishHsVar name
- = do { ignore_asserts <- doptM Opt_IgnoreAsserts
+ = do { ignore_asserts <- goptM Opt_IgnoreAsserts
; if ignore_asserts || not (name `hasKey` assertIdKey)
then return (HsVar name, unitFV name)
else do { e <- mkAssertErrorExpr
diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs
index 3409d77397..50baeffafe 100644
--- a/compiler/rename/RnNames.lhs
+++ b/compiler/rename/RnNames.lhs
@@ -183,7 +183,7 @@ rnImportDecl this_mod
Just (False, _) -> return () -- Explicit import list
_ | implicit -> return () -- Do not bleat for implicit imports
| qual_only -> return ()
- | otherwise -> ifWOptM Opt_WarnMissingImportList $
+ | otherwise -> whenWOptM Opt_WarnMissingImportList $
addWarn (missingImportListWarn imp_mod_name)
iface <- loadSrcInterface doc imp_mod_name want_boot mb_pkg
@@ -314,7 +314,7 @@ rnImportDecl this_mod
}
-- Complain if we import a deprecated module
- ifWOptM Opt_WarnWarningsDeprecations (
+ whenWOptM Opt_WarnWarningsDeprecations (
case warns of
WarnAll txt -> addWarn $ moduleWarn imp_mod_name txt
_ -> return ()
@@ -651,11 +651,11 @@ filterImports iface decl_spec (Just (want_hiding, import_items))
return [ (L loc ie, avail) | (ie,avail) <- stuff ]
where
-- Warn when importing T(..) if T was exported abstractly
- emit_warning (DodgyImport n) = ifWOptM Opt_WarnDodgyImports $
+ emit_warning (DodgyImport n) = whenWOptM Opt_WarnDodgyImports $
addWarn (dodgyImportWarn n)
- emit_warning MissingImportList = ifWOptM Opt_WarnMissingImportList $
+ emit_warning MissingImportList = whenWOptM Opt_WarnMissingImportList $
addWarn (missingImportListItem ieRdr)
- emit_warning BadImportW = ifWOptM Opt_WarnDodgyImports $
+ emit_warning BadImportW = whenWOptM Opt_WarnDodgyImports $
addWarn (lookup_err_msg BadImport)
run_lookup :: IELookupM a -> TcRn (Maybe a)
@@ -1307,10 +1307,10 @@ warnUnusedImportDecls gbl_env
; traceRn (vcat [ ptext (sLit "Uses:") <+> ppr (Set.elems uses)
, ptext (sLit "Import usage") <+> ppr usage])
- ; ifWOptM Opt_WarnUnusedImports $
+ ; whenWOptM Opt_WarnUnusedImports $
mapM_ warnUnusedImport usage
- ; ifDOptM Opt_D_dump_minimal_imports $
+ ; whenGOptM Opt_D_dump_minimal_imports $
printMinimalImports usage }
where
explicit_import (L _ decl) = unLoc (ideclName decl) /= pRELUDE_NAME
diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs
index f8bbc3d68e..7867c5cbb8 100644
--- a/compiler/rename/RnTypes.lhs
+++ b/compiler/rename/RnTypes.lhs
@@ -799,7 +799,7 @@ ppr_opfix (op, fixity) = pp_op <+> brackets (ppr fixity)
\begin{code}
warnUnusedForAlls :: SDoc -> LHsTyVarBndrs RdrName -> [RdrName] -> TcM ()
warnUnusedForAlls in_doc bound mentioned_rdrs
- = ifWOptM Opt_WarnUnusedMatches $
+ = whenWOptM Opt_WarnUnusedMatches $
mapM_ add_warn bound_but_not_used
where
bound_names = hsLTyVarLocNames bound