From bfabf94f63b6644bd32982fd13ea0c8bca9aeae4 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Thu, 6 May 2021 14:52:53 +0200 Subject: Replace CPP assertions with Haskell functions There is no reason to use CPP. __LINE__ and __FILE__ macros are now better replaced with GHC's CallStack. As a bonus, assert error messages now contain more information (function name, column). Here is the mapping table (HasCallStack omitted): * ASSERT: assert :: Bool -> a -> a * MASSERT: massert :: Bool -> m () * ASSERTM: assertM :: m Bool -> m () * ASSERT2: assertPpr :: Bool -> SDoc -> a -> a * MASSERT2: massertPpr :: Bool -> SDoc -> m () * ASSERTM2: assertPprM :: m Bool -> SDoc -> m () --- compiler/GHC/Stg/Lift/Monad.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/GHC/Stg/Lift') diff --git a/compiler/GHC/Stg/Lift/Monad.hs b/compiler/GHC/Stg/Lift/Monad.hs index e43bda363d..c34c74d505 100644 --- a/compiler/GHC/Stg/Lift/Monad.hs +++ b/compiler/GHC/Stg/Lift/Monad.hs @@ -36,8 +36,8 @@ import GHC.Stg.Subst import GHC.Stg.Syntax import GHC.Core.Utils import GHC.Types.Unique.Supply -import GHC.Utils.Misc import GHC.Utils.Panic +import GHC.Utils.Panic.Plain import GHC.Types.Var.Env import GHC.Types.Var.Set import GHC.Core.Multiplicity @@ -183,7 +183,7 @@ collectFloats = go (0 :: Int) [] map_rhss f = uncurry mkStgBinding . second (map (second f)) . decomposeStgBinding rm_cccs = map_rhss removeRhsCCCS - merge_binds binds = ASSERT( any is_rec binds ) + merge_binds binds = assert (any is_rec binds) $ StgRec (concatMap (snd . decomposeStgBinding . rm_cccs) binds) is_rec StgRec{} = True is_rec _ = False -- cgit v1.2.1