summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Iface')
-rw-r--r--compiler/GHC/Iface/Binary.hs7
-rw-r--r--compiler/GHC/Iface/Ext/Ast.hs3
-rw-r--r--compiler/GHC/Iface/Load.hs21
-rw-r--r--compiler/GHC/Iface/Make.hs8
-rw-r--r--compiler/GHC/Iface/Recomp.hs9
-rw-r--r--compiler/GHC/Iface/Recomp/Binary.hs3
-rw-r--r--compiler/GHC/Iface/Rename.hs5
-rw-r--r--compiler/GHC/Iface/Syntax.hs4
8 files changed, 31 insertions, 29 deletions
diff --git a/compiler/GHC/Iface/Binary.hs b/compiler/GHC/Iface/Binary.hs
index 293058f0ca..c796ed1713 100644
--- a/compiler/GHC/Iface/Binary.hs
+++ b/compiler/GHC/Iface/Binary.hs
@@ -51,7 +51,6 @@ import GHC.Types.SrcLoc
import GHC.Platform
import GHC.Data.FastString
import GHC.Settings.Constants
-import GHC.Utils.Misc
import Data.Array
import Data.Array.IO
@@ -300,7 +299,7 @@ getSymbolTable bh name_cache = do
serialiseName :: BinHandle -> Name -> UniqFM key (Int,Name) -> IO ()
serialiseName bh name _ = do
- let mod = ASSERT2( isExternalName name, ppr name ) nameModule name
+ let mod = assertPpr (isExternalName name) (ppr name) (nameModule name)
put_ bh (moduleUnit mod, moduleName mod, nameOccName name)
@@ -329,7 +328,7 @@ putName _dict BinSymbolTable{
bh name
| isKnownKeyName name
, let (c, u) = unpkUnique (nameUnique name) -- INVARIANT: (ord c) fits in 8 bits
- = -- ASSERT(u < 2^(22 :: Int))
+ = -- assert (u < 2^(22 :: Int))
put_ bh (0x80000000
.|. (fromIntegral (ord c) `shiftL` 22)
.|. (fromIntegral u :: Word32))
@@ -340,7 +339,7 @@ putName _dict BinSymbolTable{
Just (off,_) -> put_ bh (fromIntegral off :: Word32)
Nothing -> do
off <- readFastMutInt symtab_next
- -- MASSERT(off < 2^(30 :: Int))
+ -- massert (off < 2^(30 :: Int))
writeFastMutInt symtab_next (off+1)
writeIORef symtab_map_ref
$! addToUFM symtab_map name (off,name)
diff --git a/compiler/GHC/Iface/Ext/Ast.hs b/compiler/GHC/Iface/Ext/Ast.hs
index 692e4a2213..d2e172dbba 100644
--- a/compiler/GHC/Iface/Ext/Ast.hs
+++ b/compiler/GHC/Iface/Ext/Ast.hs
@@ -57,6 +57,7 @@ import GHC.Types.Var.Env
import GHC.Builtin.Uniques
import GHC.Iface.Make ( mkIfaceExports )
import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import GHC.Utils.Misc
import GHC.Data.Maybe
import GHC.Data.FastString
@@ -907,7 +908,7 @@ instance HiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p))) where
detSpan = case detScope of
LocalScope a -> Just a
_ -> Nothing
- toBind (PrefixCon ts args) = ASSERT(null ts) PrefixCon ts $ map (C Use) args
+ toBind (PrefixCon ts args) = assert (null ts) $ PrefixCon ts $ map (C Use) args
toBind (InfixCon a b) = InfixCon (C Use a) (C Use b)
toBind (RecCon r) = RecCon $ map (PSC detSpan) r
diff --git a/compiler/GHC/Iface/Load.hs b/compiler/GHC/Iface/Load.hs
index 99fcfcd4dd..2d474d0da3 100644
--- a/compiler/GHC/Iface/Load.hs
+++ b/compiler/GHC/Iface/Load.hs
@@ -64,7 +64,8 @@ import GHC.Utils.Binary ( BinData(..) )
import GHC.Utils.Error
import GHC.Utils.Outputable as Outputable
import GHC.Utils.Panic
-import GHC.Utils.Misc
+import GHC.Utils.Panic.Plain
+import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.Logger
import GHC.Settings.Constants
@@ -165,13 +166,13 @@ importDecl :: Name -> IfM lcl (MaybeErr SDoc TyThing)
-- Get the TyThing for this Name from an interface file
-- It's not a wired-in thing -- the caller caught that
importDecl name
- = ASSERT( not (isWiredInName name) )
+ = assert (not (isWiredInName name)) $
do { dflags <- getDynFlags
; logger <- getLogger
; liftIO $ trace_if logger dflags nd_doc
-- Load the interface, which should populate the PTE
- ; mb_iface <- ASSERT2( isExternalName name, ppr name )
+ ; mb_iface <- assertPpr (isExternalName name) (ppr name) $
loadInterface nd_doc (nameModule name) ImportBySystem
; case mb_iface of {
Failed err_msg -> return (Failed err_msg) ;
@@ -245,7 +246,7 @@ checkWiredInTyCon tc
; dflags <- getDynFlags
; logger <- getLogger
; liftIO $ trace_if logger dflags (text "checkWiredInTyCon" <+> ppr tc_name $$ ppr mod)
- ; ASSERT( isExternalName tc_name )
+ ; assert (isExternalName tc_name )
when (mod /= nameModule tc_name)
(initIfaceTcRn (loadWiredInHomeIface tc_name))
-- Don't look for (non-existent) Float.hi when
@@ -268,7 +269,7 @@ ifCheckWiredInThing thing
-- the HPT, so without the test we'll demand-load it into the PIT!
-- C.f. the same test in checkWiredInTyCon above
; let name = getName thing
- ; ASSERT2( isExternalName name, ppr name )
+ ; assertPpr (isExternalName name) (ppr name) $
when (needWiredInHomeIface thing && mod /= nameModule name)
(loadWiredInHomeIface name) }
@@ -348,8 +349,8 @@ loadInterfaceForName :: SDoc -> Name -> TcRn ModIface
loadInterfaceForName doc name
= do { when debugIsOn $ -- Check pre-condition
do { this_mod <- getModule
- ; MASSERT2( not (nameIsLocalOrFrom this_mod name), ppr name <+> parens doc ) }
- ; ASSERT2( isExternalName name, ppr name )
+ ; massertPpr (not (nameIsLocalOrFrom this_mod name)) (ppr name <+> parens doc) }
+ ; assertPpr (isExternalName name) (ppr name) $
initIfaceTcRn $ loadSysInterface doc (nameModule name) }
-- | Only loads the interface for external non-local names.
@@ -368,7 +369,7 @@ loadInterfaceForModule doc m
-- Should not be called with this module
when debugIsOn $ do
this_mod <- getModule
- MASSERT2( this_mod /= m, ppr m <+> parens doc )
+ massertPpr (this_mod /= m) (ppr m <+> parens doc)
initIfaceTcRn $ loadSysInterface doc m
{-
@@ -388,7 +389,7 @@ loadInterfaceForModule doc m
-- See Note [Loading instances for wired-in things]
loadWiredInHomeIface :: Name -> IfM lcl ()
loadWiredInHomeIface name
- = ASSERT( isWiredInName name )
+ = assert (isWiredInName name) $
do _ <- loadSysInterface doc (nameModule name); return ()
where
doc = text "Need home interface for wired-in thing" <+> ppr name
@@ -692,7 +693,7 @@ computeInterface
-> Module
-> IO (MaybeErr SDoc (ModIface, FilePath))
computeInterface hsc_env doc_str hi_boot_file mod0 = do
- MASSERT( not (isHoleModule mod0) )
+ massert (not (isHoleModule mod0))
let name_cache = hsc_NC hsc_env
let fc = hsc_FC hsc_env
let home_unit = hsc_home_unit hsc_env
diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs
index 323f69f0d3..01c547023c 100644
--- a/compiler/GHC/Iface/Make.hs
+++ b/compiler/GHC/Iface/Make.hs
@@ -76,7 +76,7 @@ import GHC.Types.HpcInfo
import GHC.Types.CompleteMatch
import GHC.Utils.Outputable
-import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import GHC.Utils.Misc hiding ( eqListBy )
import GHC.Utils.Logger
@@ -646,7 +646,7 @@ classToIfaceDecl env clas
(env2, if_decl) = tyConToIfaceDecl env1 tc
toIfaceClassOp (sel_id, def_meth)
- = ASSERT( sel_tyvars == binderVars tc_binders )
+ = assert (sel_tyvars == binderVars tc_binders) $
IfaceClassOp (getName sel_id)
(tidyToIfaceType env1 op_ty)
(fmap toDmSpec def_meth)
@@ -689,7 +689,7 @@ instanceToIfaceInst (ClsInst { is_dfun = dfun_id, is_flag = oflag
, is_cls_nm = cls_name, is_cls = cls
, is_tcs = rough_tcs
, is_orphan = orph })
- = ASSERT( cls_name == className cls )
+ = assert (cls_name == className cls) $
IfaceClsInst { ifDFun = idName dfun_id
, ifOFlag = oflag
, ifInstCls = cls_name
@@ -707,7 +707,7 @@ famInstToIfaceFamInst (FamInst { fi_axiom = axiom,
, ifFamInstOrph = orph }
where
fam_decl = tyConName $ coAxiomTyCon axiom
- mod = ASSERT( isExternalName (coAxiomName axiom) )
+ mod = assert (isExternalName (coAxiomName axiom)) $
nameModule (coAxiomName axiom)
is_local name = nameIsLocalOrFrom mod name
diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs
index 409cb712f2..3d84c17565 100644
--- a/compiler/GHC/Iface/Recomp.hs
+++ b/compiler/GHC/Iface/Recomp.hs
@@ -36,6 +36,7 @@ import GHC.Data.FastString
import GHC.Utils.Error
import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import GHC.Utils.Outputable as Outputable
import GHC.Utils.Misc as Utils hiding ( eqListBy )
import GHC.Utils.Binary
@@ -359,7 +360,7 @@ checkHsig :: Logger -> HomeUnit -> DynFlags -> ModSummary -> ModIface -> IO Reco
checkHsig logger home_unit dflags mod_summary iface = do
let outer_mod = ms_mod mod_summary
inner_mod = homeModuleNameInstantiation home_unit (moduleName outer_mod)
- MASSERT( isHomeModule home_unit outer_mod )
+ massert (isHomeModule home_unit outer_mod)
case inner_mod == mi_semantic_module iface of
True -> up_to_date logger dflags (text "implementing module unchanged")
False -> return (RecompBecause "implementing module changed")
@@ -882,7 +883,7 @@ addFingerprints hsc_env iface0
, let out = localOccs $ freeNamesDeclABI abi
]
- name_module n = ASSERT2( isExternalName n, ppr n ) nameModule n
+ name_module n = assertPpr (isExternalName n) (ppr n) (nameModule n)
localOccs =
map (getUnique . getParent . getOccName)
-- NB: names always use semantic module, so
@@ -925,7 +926,7 @@ addFingerprints hsc_env iface0
| isWiredInName name = putNameLiterally bh name
-- wired-in names don't have fingerprints
| otherwise
- = ASSERT2( isExternalName name, ppr name )
+ = assertPpr (isExternalName name) (ppr name) $
let hash | nameModule name /= semantic_mod = global_hash_fn name
-- Get it from the REAL interface!!
-- This will trigger when we compile an hsig file
@@ -1497,7 +1498,7 @@ mkHashFun hsc_env eps name
occ = nameOccName name
orig_mod = nameModule name
lookup mod = do
- MASSERT2( isExternalName name, ppr name )
+ massertPpr (isExternalName name) (ppr name)
iface <- case lookupIfaceByModule hpt pit mod of
Just iface -> return iface
Nothing ->
diff --git a/compiler/GHC/Iface/Recomp/Binary.hs b/compiler/GHC/Iface/Recomp/Binary.hs
index 083ad431af..fd14c86673 100644
--- a/compiler/GHC/Iface/Recomp/Binary.hs
+++ b/compiler/GHC/Iface/Recomp/Binary.hs
@@ -16,7 +16,6 @@ import GHC.Utils.Fingerprint
import GHC.Utils.Binary
import GHC.Types.Name
import GHC.Utils.Panic.Plain
-import GHC.Utils.Misc
fingerprintBinMem :: BinHandle -> IO Fingerprint
fingerprintBinMem bh = withBinBuffer bh f
@@ -43,6 +42,6 @@ computeFingerprint put_nonbinding_name a = do
-- | Used when we want to fingerprint a structure without depending on the
-- fingerprints of external Names that it refers to.
putNameLiterally :: BinHandle -> Name -> IO ()
-putNameLiterally bh name = ASSERT( isExternalName name ) do
+putNameLiterally bh name = assert (isExternalName name) $ do
put_ bh $! nameModule name
put_ bh $! nameOccName name
diff --git a/compiler/GHC/Iface/Rename.hs b/compiler/GHC/Iface/Rename.hs
index 500e12a1db..2df946529a 100644
--- a/compiler/GHC/Iface/Rename.hs
+++ b/compiler/GHC/Iface/Rename.hs
@@ -251,7 +251,8 @@ rnAvailInfo (AvailTC n ns) = do
ns' <- mapM rnGreName ns
case ns' of
[] -> panic "rnAvailInfoEmpty AvailInfo"
- (rep:rest) -> ASSERT2( all ((== childModule rep) . childModule) rest, ppr rep $$ hcat (map ppr rest) ) do
+ (rep:rest) -> assertPpr (all ((== childModule rep) . childModule) rest)
+ (ppr rep $$ hcat (map ppr rest)) $ do
n' <- setNameModule (Just (childModule rep)) n
return (AvailTC n' ns')
where
@@ -376,7 +377,7 @@ rnIfaceNeverExported name = do
iface_semantic_mod <- fmap sh_if_semantic_module getGblEnv
let m = renameHoleModule unit_state hmap $ nameModule name
-- Doublecheck that this DFun/coercion axiom was, indeed, locally defined.
- MASSERT2( iface_semantic_mod == m, ppr iface_semantic_mod <+> ppr m )
+ massertPpr (iface_semantic_mod == m) (ppr iface_semantic_mod <+> ppr m)
setNameModule (Just m) name
-- Note [rnIfaceNeverExported]
diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs
index fe1fa6a58f..1f2cd97937 100644
--- a/compiler/GHC/Iface/Syntax.hs
+++ b/compiler/GHC/Iface/Syntax.hs
@@ -76,7 +76,7 @@ import GHC.Utils.Binary
import GHC.Utils.Binary.Typeable ()
import GHC.Utils.Outputable as Outputable
import GHC.Utils.Panic
-import GHC.Utils.Misc( dropList, filterByList, notNull, unzipWith, debugIsOn,
+import GHC.Utils.Misc( dropList, filterByList, notNull, unzipWith,
seqList, zipWithEqual )
import Control.Monad
@@ -657,7 +657,7 @@ pprAxBranch pp_tc idx (IfaceAxBranch { ifaxbTyVars = tvs
, ifaxbLHS = pat_tys
, ifaxbRHS = rhs
, ifaxbIncomps = incomps })
- = ASSERT2( null _cvs, pp_tc $$ ppr _cvs )
+ = assertPpr (null _cvs) (pp_tc $$ ppr _cvs) $
hang ppr_binders 2 (hang pp_lhs 2 (equals <+> ppr rhs))
$+$
nest 4 maybe_incomps