summaryrefslogtreecommitdiff
path: root/compiler/GHC/Types/Id.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Types/Id.hs')
-rw-r--r--compiler/GHC/Types/Id.hs19
1 files changed, 10 insertions, 9 deletions
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)