Skip to content
Snippets Groups Projects
Commit 6111c5e4 authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

compiler: Ensure that Panic.Plain.assertPanic' provides callstack

In 36cddd2c @alt-romes removed CallStack
output from `GHC.Utils.Panic.Plain.assertPanic'`. While this output is
redundant due to the exception backtrace proposal, we may be
bootstrapping with a compiler which does not yet include this machinery.
Reintroduce the output for now.

Fixes #25898.
parent fe6ed8d9
No related branches found
No related tags found
No related merge requests found
......@@ -116,9 +116,17 @@ assertPanic file line =
Exception.throw (Exception.AssertionFailed
("ASSERT failed! file " ++ file ++ ", line " ++ show line))
-- | Throw a failed assertion exception taking the location information
-- from 'HasCallStack' evidence.
assertPanic' :: HasCallStack => a
assertPanic' = Exception.throw (Exception.AssertionFailed "ASSERT failed!")
assertPanic' =
Exception.throw
$ Exception.AssertionFailed
$ "ASSERT failed!\n" ++ withFrozenCallStack doc
where
-- TODO: Drop CallStack when exception backtrace functionality
-- can be assumed of bootstrap compiler.
doc = unlines $ fmap (" "++) $ lines (prettyCallStack callStack)
assert :: HasCallStack => Bool -> a -> a
{-# INLINE assert #-}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment