summaryrefslogtreecommitdiff
path: root/compiler/GHC/Types
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Types')
-rw-r--r--compiler/GHC/Types/Avail.hs1
-rw-r--r--compiler/GHC/Types/Id.hs19
-rw-r--r--compiler/GHC/Types/Id/Info.hs7
-rw-r--r--compiler/GHC/Types/Id/Make.hs16
-rw-r--r--compiler/GHC/Types/Literal.hs24
-rw-r--r--compiler/GHC/Types/Name/Cache.hs3
-rw-r--r--compiler/GHC/Types/Name/Ppr.hs2
-rw-r--r--compiler/GHC/Types/Name/Reader.hs2
-rw-r--r--compiler/GHC/Types/Name/Shape.hs7
-rw-r--r--compiler/GHC/Types/RepType.hs5
-rw-r--r--compiler/GHC/Types/Unique.hs5
-rw-r--r--compiler/GHC/Types/Unique/FM.hs5
-rw-r--r--compiler/GHC/Types/Unique/Supply.hs5
-rw-r--r--compiler/GHC/Types/Var.hs15
14 files changed, 54 insertions, 62 deletions
diff --git a/compiler/GHC/Types/Avail.hs b/compiler/GHC/Types/Avail.hs
index e3e821deca..7c033a9863 100644
--- a/compiler/GHC/Types/Avail.hs
+++ b/compiler/GHC/Types/Avail.hs
@@ -51,6 +51,7 @@ import GHC.Data.List.SetOps
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Misc
+import GHC.Utils.Constants (debugIsOn)
import Data.Data ( Data )
import Data.Either ( partitionEithers )
diff --git a/compiler/GHC/Types/Id.hs b/compiler/GHC/Types/Id.hs
index 48ec97f6f8..172f9f4d18 100644
--- a/compiler/GHC/Types/Id.hs
+++ b/compiler/GHC/Types/Id.hs
@@ -162,6 +162,7 @@ import GHC.Core.Multiplicity
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import GHC.Utils.GlobalVars
import GHC.Driver.Ppr
@@ -239,7 +240,7 @@ localiseId :: Id -> Id
-- Make an Id with the same unique and type as the
-- incoming Id, but with an *Internal* Name and *LocalId* flavour
localiseId id
- | ASSERT( isId id ) isLocalId id && isInternalName name
+ | assert (isId id) $ isLocalId id && isInternalName name
= id
| otherwise
= Var.mkLocalVar (idDetails id) (localiseName name) (Var.varMult id) (idType id) (idInfo id)
@@ -298,19 +299,19 @@ mkVanillaGlobalWithInfo = mkGlobalId VanillaId
-- | For an explanation of global vs. local 'Id's, see "GHC.Types.Var#globalvslocal"
mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id
-mkLocalId name w ty = ASSERT( not (isCoVarType ty) )
+mkLocalId name w ty = assert (not (isCoVarType ty)) $
mkLocalIdWithInfo name w ty vanillaIdInfo
-- | Make a local CoVar
mkLocalCoVar :: Name -> Type -> CoVar
mkLocalCoVar name ty
- = ASSERT( isCoVarType ty )
+ = assert (isCoVarType ty) $
Var.mkLocalVar CoVarId name Many ty vanillaIdInfo
-- | Like 'mkLocalId', but checks the type to see if it should make a covar
mkLocalIdOrCoVar :: Name -> Mult -> Type -> Id
mkLocalIdOrCoVar name w ty
- -- We should ASSERT(eqType w Many) in the isCoVarType case.
+ -- We should assert (eqType w Many) in the isCoVarType case.
-- However, currently this assertion does not hold.
-- In tests with -fdefer-type-errors, such as T14584a,
-- we create a linear 'case' where the scrutinee is a coercion
@@ -320,7 +321,7 @@ mkLocalIdOrCoVar name w ty
-- proper ids only; no covars!
mkLocalIdWithInfo :: HasDebugCallStack => Name -> Mult -> Type -> IdInfo -> Id
-mkLocalIdWithInfo name w ty info = ASSERT( not (isCoVarType ty) )
+mkLocalIdWithInfo name w ty info = assert (not (isCoVarType ty)) $
Var.mkLocalVar VanillaId name w ty info
-- Note [Free type variables]
@@ -339,7 +340,7 @@ mkExportedVanillaId name ty = Var.mkExportedLocalVar VanillaId name ty vanillaId
-- | Create a system local 'Id'. These are local 'Id's (see "Var#globalvslocal")
-- that are created by the compiler out of thin air
mkSysLocal :: FastString -> Unique -> Mult -> Type -> Id
-mkSysLocal fs uniq w ty = ASSERT( not (isCoVarType ty) )
+mkSysLocal fs uniq w ty = assert (not (isCoVarType ty)) $
mkLocalId (mkSystemVarName uniq fs) w ty
-- | Like 'mkSysLocal', but checks to see if we have a covar type
@@ -356,7 +357,7 @@ mkSysLocalOrCoVarM fs w ty
-- | Create a user local 'Id'. These are local 'Id's (see "GHC.Types.Var#globalvslocal") with a name and location that the user might recognize
mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id
-mkUserLocal occ uniq w ty loc = ASSERT( not (isCoVarType ty) )
+mkUserLocal occ uniq w ty loc = assert (not (isCoVarType ty)) $
mkLocalId (mkInternalName uniq occ loc) w ty
-- | Like 'mkUserLocal', but checks if we have a coercion type
@@ -545,7 +546,7 @@ isJoinId id
isJoinId_maybe :: Var -> Maybe JoinArity
isJoinId_maybe id
- | isId id = ASSERT2( isId id, ppr id )
+ | isId id = assertPpr (isId id) (ppr id) $
case Var.idDetails id of
JoinId arity -> Just arity
_ -> Nothing
@@ -706,7 +707,7 @@ zapIdDmdSig id = modifyIdInfo (`setDmdSigInfo` nopSig) id
-- type, we still want @isStrictId id@ to be @True@.
isStrictId :: Id -> Bool
isStrictId id
- | ASSERT2( isId id, text "isStrictId: not an id: " <+> ppr id )
+ | assertPpr (isId id) (text "isStrictId: not an id: " <+> ppr id) $
isJoinId id = False
| otherwise = isStrictType (idType id) ||
isStrUsedDmd (idDemandInfo id)
diff --git a/compiler/GHC/Types/Id/Info.hs b/compiler/GHC/Types/Id/Info.hs
index 399937265c..f02409d03c 100644
--- a/compiler/GHC/Types/Id/Info.hs
+++ b/compiler/GHC/Types/Id/Info.hs
@@ -111,6 +111,7 @@ import GHC.Types.Cpr
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import Data.Word
@@ -334,13 +335,13 @@ bitfieldSetLevityInfo info (BitField bits) =
bitfieldSetCallArityInfo :: ArityInfo -> BitField -> BitField
bitfieldSetCallArityInfo info bf@(BitField bits) =
- ASSERT(info < 2^(30 :: Int) - 1)
+ assert (info < 2^(30 :: Int) - 1) $
bitfieldSetArityInfo (bitfieldGetArityInfo bf) $
BitField ((fromIntegral info `shiftL` 3) .|. (bits .&. 0b111))
bitfieldSetArityInfo :: ArityInfo -> BitField -> BitField
bitfieldSetArityInfo info (BitField bits) =
- ASSERT(info < 2^(30 :: Int) - 1)
+ assert (info < 2^(30 :: Int) - 1) $
BitField ((fromIntegral info `shiftL` 33) .|. (bits .&. ((1 `shiftL` 33) - 1)))
-- Getters
@@ -741,7 +742,7 @@ instance Outputable LevityInfo where
-- polymorphic
setNeverLevPoly :: HasDebugCallStack => IdInfo -> Type -> IdInfo
setNeverLevPoly info ty
- = ASSERT2( not (resultIsLevPoly ty), ppr ty )
+ = assertPpr (not (resultIsLevPoly ty)) (ppr ty) $
info { bitfield = bitfieldSetLevityInfo NeverLevityPolymorphic (bitfield info) }
setLevityInfoWithType :: IdInfo -> Type -> IdInfo
diff --git a/compiler/GHC/Types/Id/Make.hs b/compiler/GHC/Types/Id/Make.hs
index 06f4982e7d..d87db65f0f 100644
--- a/compiler/GHC/Types/Id/Make.hs
+++ b/compiler/GHC/Types/Id/Make.hs
@@ -81,6 +81,7 @@ import GHC.Driver.Session
import GHC.Driver.Ppr
import GHC.Utils.Outputable
import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import GHC.Data.FastString
import GHC.Data.List.SetOps
import GHC.Types.Var (VarBndr(Bndr))
@@ -601,9 +602,8 @@ mkDataConWorkId wkr_name data_con
`setLevityInfoWithType` wkr_ty
id_arg1 = mkScaledTemplateLocal 1 (head arg_tys)
res_ty_args = mkTyCoVarTys univ_tvs
- newtype_unf = ASSERT2( isVanillaDataCon data_con &&
- isSingleton arg_tys
- , ppr data_con )
+ newtype_unf = assertPpr (isVanillaDataCon data_con && isSingleton arg_tys)
+ (ppr data_con) $
-- Note [Newtype datacons]
mkCompulsoryUnfolding defaultSimpleOpts $
mkLams univ_tvs $ Lam id_arg1 $
@@ -821,7 +821,7 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con
; (rep_ids, binds) <- go subst2 boxers term_vars
; return (ex_vars ++ rep_ids, binds) } )
- go _ [] src_vars = ASSERT2( null src_vars, ppr data_con ) return ([], [])
+ go _ [] src_vars = assertPpr (null src_vars) (ppr data_con) $ return ([], [])
go subst (UnitBox : boxers) (src_var : src_vars)
= do { (rep_ids2, binds) <- go subst boxers src_vars
; return (src_var : rep_ids2, binds) }
@@ -1110,7 +1110,7 @@ dataConArgUnpack (Scaled arg_mult arg_ty)
-- A recursive newtype might mean that
-- 'arg_ty' is a newtype
, let rep_tys = map (scaleScaled arg_mult) $ dataConInstArgTys con tc_args
- = ASSERT( null (dataConExTyCoVars con) )
+ = assert (null (dataConExTyCoVars con))
-- Note [Unpacking GADTs and existentials]
( rep_tys `zip` dataConRepStrictness con
,( \ arg_id ->
@@ -1273,7 +1273,7 @@ wrapNewTypeBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
-- it, otherwise the wrap/unwrap are both no-ops
wrapNewTypeBody tycon args result_expr
- = ASSERT( isNewTyCon tycon )
+ = assert (isNewTyCon tycon) $
mkCast result_expr (mkSymCo co)
where
co = mkUnbranchedAxInstCo Representational (newTyConCo tycon) args []
@@ -1285,7 +1285,7 @@ wrapNewTypeBody tycon args result_expr
unwrapNewTypeBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
unwrapNewTypeBody tycon args result_expr
- = ASSERT( isNewTyCon tycon )
+ = assert (isNewTyCon tycon) $
mkCast result_expr (mkUnbranchedAxInstCo Representational (newTyConCo tycon) args [])
-- If the type constructor is a representation type of a data instance, wrap
@@ -1347,7 +1347,7 @@ mkPrimOpId prim_op
mkFCallId :: DynFlags -> Unique -> ForeignCall -> Type -> Id
mkFCallId dflags uniq fcall ty
- = ASSERT( noFreeVarsOfType ty )
+ = assert (noFreeVarsOfType ty) $
-- A CCallOpId should have no free type variables;
-- when doing substitutions won't substitute over it
mkGlobalId (FCallId fcall) name ty info
diff --git a/compiler/GHC/Types/Literal.hs b/compiler/GHC/Types/Literal.hs
index d2446b9fe5..4552f45bf8 100644
--- a/compiler/GHC/Types/Literal.hs
+++ b/compiler/GHC/Types/Literal.hs
@@ -374,12 +374,12 @@ litNumCheckRange platform nt i = case nt of
-- | Create a numeric 'Literal' of the given type
mkLitNumber :: Platform -> LitNumType -> Integer -> Literal
mkLitNumber platform nt i =
- ASSERT2(litNumCheckRange platform nt i, integer i)
+ assertPpr (litNumCheckRange platform nt i) (integer i)
(LitNumber nt i)
-- | Creates a 'Literal' of type @Int#@
mkLitInt :: Platform -> Integer -> Literal
-mkLitInt platform x = ASSERT2( platformInIntRange platform x, integer x )
+mkLitInt platform x = assertPpr (platformInIntRange platform x) (integer x)
(mkLitIntUnchecked x)
-- | Creates a 'Literal' of type @Int#@.
@@ -403,7 +403,7 @@ mkLitIntWrapC platform i = (n, i /= i')
-- | Creates a 'Literal' of type @Word#@
mkLitWord :: Platform -> Integer -> Literal
-mkLitWord platform x = ASSERT2( platformInWordRange platform x, integer x )
+mkLitWord platform x = assertPpr (platformInWordRange platform x) (integer x)
(mkLitWordUnchecked x)
-- | Creates a 'Literal' of type @Word#@.
@@ -427,7 +427,7 @@ mkLitWordWrapC platform i = (n, i /= i')
-- | Creates a 'Literal' of type @Int8#@
mkLitInt8 :: Integer -> Literal
-mkLitInt8 x = ASSERT2( inBoundedRange @Int8 x, integer x ) (mkLitInt8Unchecked x)
+mkLitInt8 x = assertPpr (inBoundedRange @Int8 x) (integer x) (mkLitInt8Unchecked x)
-- | Creates a 'Literal' of type @Int8#@.
-- If the argument is out of the range, it is wrapped.
@@ -440,7 +440,7 @@ mkLitInt8Unchecked i = LitNumber LitNumInt8 i
-- | Creates a 'Literal' of type @Word8#@
mkLitWord8 :: Integer -> Literal
-mkLitWord8 x = ASSERT2( inBoundedRange @Word8 x, integer x ) (mkLitWord8Unchecked x)
+mkLitWord8 x = assertPpr (inBoundedRange @Word8 x) (integer x) (mkLitWord8Unchecked x)
-- | Creates a 'Literal' of type @Word8#@.
-- If the argument is out of the range, it is wrapped.
@@ -453,7 +453,7 @@ mkLitWord8Unchecked i = LitNumber LitNumWord8 i
-- | Creates a 'Literal' of type @Int16#@
mkLitInt16 :: Integer -> Literal
-mkLitInt16 x = ASSERT2( inBoundedRange @Int16 x, integer x ) (mkLitInt16Unchecked x)
+mkLitInt16 x = assertPpr (inBoundedRange @Int16 x) (integer x) (mkLitInt16Unchecked x)
-- | Creates a 'Literal' of type @Int16#@.
-- If the argument is out of the range, it is wrapped.
@@ -466,7 +466,7 @@ mkLitInt16Unchecked i = LitNumber LitNumInt16 i
-- | Creates a 'Literal' of type @Word16#@
mkLitWord16 :: Integer -> Literal
-mkLitWord16 x = ASSERT2( inBoundedRange @Word16 x, integer x ) (mkLitWord16Unchecked x)
+mkLitWord16 x = assertPpr (inBoundedRange @Word16 x) (integer x) (mkLitWord16Unchecked x)
-- | Creates a 'Literal' of type @Word16#@.
-- If the argument is out of the range, it is wrapped.
@@ -479,7 +479,7 @@ mkLitWord16Unchecked i = LitNumber LitNumWord16 i
-- | Creates a 'Literal' of type @Int32#@
mkLitInt32 :: Integer -> Literal
-mkLitInt32 x = ASSERT2( inBoundedRange @Int32 x, integer x ) (mkLitInt32Unchecked x)
+mkLitInt32 x = assertPpr (inBoundedRange @Int32 x) (integer x) (mkLitInt32Unchecked x)
-- | Creates a 'Literal' of type @Int32#@.
-- If the argument is out of the range, it is wrapped.
@@ -492,7 +492,7 @@ mkLitInt32Unchecked i = LitNumber LitNumInt32 i
-- | Creates a 'Literal' of type @Word32#@
mkLitWord32 :: Integer -> Literal
-mkLitWord32 x = ASSERT2( inBoundedRange @Word32 x, integer x ) (mkLitWord32Unchecked x)
+mkLitWord32 x = assertPpr (inBoundedRange @Word32 x) (integer x) (mkLitWord32Unchecked x)
-- | Creates a 'Literal' of type @Word32#@.
-- If the argument is out of the range, it is wrapped.
@@ -505,7 +505,7 @@ mkLitWord32Unchecked i = LitNumber LitNumWord32 i
-- | Creates a 'Literal' of type @Int64#@
mkLitInt64 :: Integer -> Literal
-mkLitInt64 x = ASSERT2( inBoundedRange @Int64 x, integer x ) (mkLitInt64Unchecked x)
+mkLitInt64 x = assertPpr (inBoundedRange @Int64 x) (integer x) (mkLitInt64Unchecked x)
-- | Creates a 'Literal' of type @Int64#@.
-- If the argument is out of the range, it is wrapped.
@@ -518,7 +518,7 @@ mkLitInt64Unchecked i = LitNumber LitNumInt64 i
-- | Creates a 'Literal' of type @Word64#@
mkLitWord64 :: Integer -> Literal
-mkLitWord64 x = ASSERT2( inBoundedRange @Word64 x, integer x ) (mkLitWord64Unchecked x)
+mkLitWord64 x = assertPpr (inBoundedRange @Word64 x) (integer x) (mkLitWord64Unchecked x)
-- | Creates a 'Literal' of type @Word64#@.
-- If the argument is out of the range, it is wrapped.
@@ -551,7 +551,7 @@ mkLitInteger :: Integer -> Literal
mkLitInteger x = LitNumber LitNumInteger x
mkLitNatural :: Integer -> Literal
-mkLitNatural x = ASSERT2( inNaturalRange x, integer x )
+mkLitNatural x = assertPpr (inNaturalRange x) (integer x)
(LitNumber LitNumNatural x)
-- | Create a rubbish literal of the given representation.
diff --git a/compiler/GHC/Types/Name/Cache.hs b/compiler/GHC/Types/Name/Cache.hs
index 4a8ffb50d7..d1ba2b54d4 100644
--- a/compiler/GHC/Types/Name/Cache.hs
+++ b/compiler/GHC/Types/Name/Cache.hs
@@ -25,7 +25,6 @@ import GHC.Types.Unique.Supply
import GHC.Builtin.Types
import GHC.Builtin.Names
-import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
@@ -119,7 +118,7 @@ lookupOrigNameCache nc mod occ
extendOrigNameCache' :: OrigNameCache -> Name -> OrigNameCache
extendOrigNameCache' nc name
- = ASSERT2( isExternalName name, ppr name )
+ = assertPpr (isExternalName name) (ppr name) $
extendOrigNameCache nc (nameModule name) (nameOccName name) name
extendOrigNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
diff --git a/compiler/GHC/Types/Name/Ppr.hs b/compiler/GHC/Types/Name/Ppr.hs
index 14fb5670e1..ac19547738 100644
--- a/compiler/GHC/Types/Name/Ppr.hs
+++ b/compiler/GHC/Types/Name/Ppr.hs
@@ -112,7 +112,7 @@ mkPrintUnqualified unit_env env
-- Eg f = True; g = 0; f = False
where
is_name :: Name -> Bool
- is_name name = ASSERT2( isExternalName name, ppr name )
+ is_name name = assertPpr (isExternalName name) (ppr name) $
nameModule name == mod && nameOccName name == occ
forceUnqualNames :: [Name]
diff --git a/compiler/GHC/Types/Name/Reader.hs b/compiler/GHC/Types/Name/Reader.hs
index 7ec1356939..bdf2eae770 100644
--- a/compiler/GHC/Types/Name/Reader.hs
+++ b/compiler/GHC/Types/Name/Reader.hs
@@ -1368,7 +1368,7 @@ ppr_defn_site imp_spec name
2 (pprLoc loc)
where
loc = nameSrcSpan name
- defining_mod = ASSERT2( isExternalName name, ppr name ) nameModule name
+ defining_mod = assertPpr (isExternalName name) (ppr name) $ nameModule name
same_module = importSpecModule imp_spec == moduleName defining_mod
pp_mod | same_module = empty
| otherwise = text "in" <+> quotes (ppr defining_mod)
diff --git a/compiler/GHC/Types/Name/Shape.hs b/compiler/GHC/Types/Name/Shape.hs
index 456c1d6d24..c65124d51c 100644
--- a/compiler/GHC/Types/Name/Shape.hs
+++ b/compiler/GHC/Types/Name/Shape.hs
@@ -29,8 +29,7 @@ import GHC.Tc.Utils.Monad
import GHC.Iface.Env
import GHC.Utils.Outputable
-import GHC.Utils.Misc
-import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import Control.Monad
@@ -268,11 +267,11 @@ uName flexi subst n1 n2
uHoleName :: ModuleName -> ShNameSubst -> Name {- hole name -} -> Name
-> Either SDoc ShNameSubst
uHoleName flexi subst h n =
- ASSERT( isHoleName h )
+ assert (isHoleName h) $
case lookupNameEnv subst h of
Just n' -> uName flexi subst n' n
-- Do a quick check if the other name is substituted.
Nothing | Just n' <- lookupNameEnv subst n ->
- ASSERT( isHoleName n ) uName flexi subst h n'
+ assert (isHoleName n) $ uName flexi subst h n'
| otherwise ->
Right (extendNameEnv subst h n)
diff --git a/compiler/GHC/Types/RepType.hs b/compiler/GHC/Types/RepType.hs
index 4d325e0f5c..de7b36583b 100644
--- a/compiler/GHC/Types/RepType.hs
+++ b/compiler/GHC/Types/RepType.hs
@@ -39,6 +39,7 @@ import {-# SOURCE #-} GHC.Builtin.Types ( anyTypeOfKind, runtimeRepTy )
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import Data.List (sort)
import qualified Data.IntSet as IS
@@ -532,7 +533,7 @@ kindPrimRep doc ki
| Just ki' <- coreView ki
= kindPrimRep doc ki'
kindPrimRep doc (TyConApp typ [runtime_rep])
- = ASSERT( typ `hasKey` tYPETyConKey )
+ = assert (typ `hasKey` tYPETyConKey) $
runtimeRepPrimRep doc runtime_rep
kindPrimRep doc ki
= pprPanic "kindPrimRep" (ppr ki $$ doc)
@@ -543,7 +544,7 @@ kindPrimRep doc ki
runtimeRepMonoPrimRep_maybe :: HasDebugCallStack => Type -> Maybe [PrimRep]
runtimeRepMonoPrimRep_maybe rr_ty
| Just (rr_dc, args) <- splitTyConApp_maybe rr_ty
- , ASSERT2( runtimeRepTy `eqType` typeKind rr_ty, ppr rr_ty ) True
+ , assertPpr (runtimeRepTy `eqType` typeKind rr_ty) (ppr rr_ty) True
, RuntimeRep fun <- tyConRuntimeRepInfo rr_dc
= Just (fun args)
| otherwise
diff --git a/compiler/GHC/Types/Unique.hs b/compiler/GHC/Types/Unique.hs
index 0735539910..b74119caa3 100644
--- a/compiler/GHC/Types/Unique.hs
+++ b/compiler/GHC/Types/Unique.hs
@@ -52,8 +52,7 @@ import GHC.Prelude
import GHC.Data.FastString
import GHC.Utils.Outputable
-import GHC.Utils.Misc
-import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
-- just for implementing a fast [0,61) -> Char function
import GHC.Exts (indexCharOffAddr#, Char(..), Int(..))
@@ -311,7 +310,7 @@ Code stolen from Lennart.
iToBase62 :: Int -> String
iToBase62 n_
- = ASSERT(n_ >= 0) go n_ ""
+ = assert (n_ >= 0) $ go n_ ""
where
go n cs | n < 62
= let !c = chooseChar62 n in c : cs
diff --git a/compiler/GHC/Types/Unique/FM.hs b/compiler/GHC/Types/Unique/FM.hs
index 6c2eec6a6d..27371d0647 100644
--- a/compiler/GHC/Types/Unique/FM.hs
+++ b/compiler/GHC/Types/Unique/FM.hs
@@ -83,8 +83,7 @@ import GHC.Prelude
import GHC.Types.Unique ( Uniquable(..), Unique, getKey )
import GHC.Utils.Outputable
-import GHC.Utils.Panic (assertPanic)
-import GHC.Utils.Misc (debugIsOn)
+import GHC.Utils.Panic.Plain
import qualified Data.IntMap as M
import qualified Data.IntMap.Strict as MS
import qualified Data.IntSet as S
@@ -127,7 +126,7 @@ unitDirectlyUFM u v = UFM (M.singleton (getKey u) v)
-- Note that listToUFM (zip ks vs) performs similarly, but
-- the explicit recursion avoids relying too much on fusion.
zipToUFM :: Uniquable key => [key] -> [elt] -> UniqFM key elt
-zipToUFM ks vs = ASSERT( length ks == length vs ) innerZip emptyUFM ks vs
+zipToUFM ks vs = assert (length ks == length vs ) innerZip emptyUFM ks vs
where
innerZip ufm (k:kList) (v:vList) = innerZip (addToUFM ufm k v) kList vList
innerZip ufm _ _ = ufm
diff --git a/compiler/GHC/Types/Unique/Supply.hs b/compiler/GHC/Types/Unique/Supply.hs
index f3e2b4b353..c477177f09 100644
--- a/compiler/GHC/Types/Unique/Supply.hs
+++ b/compiler/GHC/Types/Unique/Supply.hs
@@ -43,9 +43,6 @@ import Data.Char
import GHC.Exts( Ptr(..), noDuplicate#, oneShot )
#if MIN_VERSION_GLASGOW_HASKELL(9,1,0,0)
import GHC.Exts( Int(..), word2Int#, fetchAddWordAddr#, plusWord#, readWordOffAddr# )
-#if defined(DEBUG)
-import GHC.Utils.Misc
-#endif
#endif
import Foreign.Storable
@@ -241,7 +238,7 @@ genSym = do
#if defined(DEBUG)
-- Uh oh! We will overflow next time a unique is requested.
-- (Note that if the increment isn't 1 we may miss this check)
- MASSERT(u /= mask)
+ massert (u /= mask)
#endif
return u
#endif
diff --git a/compiler/GHC/Types/Var.hs b/compiler/GHC/Types/Var.hs
index 4bb0b27ac8..f00ad29256 100644
--- a/compiler/GHC/Types/Var.hs
+++ b/compiler/GHC/Types/Var.hs
@@ -112,6 +112,7 @@ import GHC.Utils.Misc
import GHC.Utils.Binary
import GHC.Utils.Outputable
import GHC.Utils.Panic
+import GHC.Utils.Panic.Plain
import Data.Data
@@ -409,13 +410,10 @@ setVarType id ty = id { varType = ty }
-- abuse, ASSERTs that there is no multiplicity to update.
updateVarType :: (Type -> Type) -> Var -> Var
updateVarType upd var
- | debugIsOn
= case var of
- Id { id_details = details } -> ASSERT( isCoVarDetails details )
+ Id { id_details = details } -> assert (isCoVarDetails details) $
result
_ -> result
- | otherwise
- = result
where
result = var { varType = upd (varType var) }
@@ -424,13 +422,10 @@ updateVarType upd var
-- abuse, ASSERTs that there is no multiplicity to update.
updateVarTypeM :: Monad m => (Type -> m Type) -> Var -> m Var
updateVarTypeM upd var
- | debugIsOn
= case var of
- Id { id_details = details } -> ASSERT( isCoVarDetails details )
+ Id { id_details = details } -> assert (isCoVarDetails details) $
result
_ -> result
- | otherwise
- = result
where
result = do { ty' <- upd (varType var)
; return (var { varType = ty' }) }
@@ -683,7 +678,7 @@ mkTyCoVarBinder vis var = Bndr var vis
-- 'var' should be a type variable
mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis
mkTyVarBinder vis var
- = ASSERT( isTyVar var )
+ = assert (isTyVar var) $
Bndr var vis
-- | Make many named binders
@@ -848,7 +843,7 @@ setIdExported tv = pprPanic "setIdExported" (ppr t
setIdNotExported :: Id -> Id
-- ^ We can only do this to LocalIds
-setIdNotExported id = ASSERT( isLocalId id )
+setIdNotExported id = assert (isLocalId id) $
id { idScope = LocalId NotExported }
-----------------------