summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Meredith <joshmeredith2008@gmail.com>2019-05-28 21:15:56 +1000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-05-29 10:43:03 -0400
commit2d2aa2031b9abc3bff7b5585ab4201948c8bba7d (patch)
treeab439d11b07e1c25e83e480657fac36e761fb73c
parentae968d419d861dcc01cd5d45e96dc86e16c363c5 (diff)
downloadhaskell-2d2aa2031b9abc3bff7b5585ab4201948c8bba7d.tar.gz
Provide details in `plusSimplCount` errors
-rw-r--r--compiler/simplCore/CoreMonad.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs
index 013b1414ee..3a2277a7a7 100644
--- a/compiler/simplCore/CoreMonad.hs
+++ b/compiler/simplCore/CoreMonad.hs
@@ -78,6 +78,7 @@ import qualified Data.Map.Strict as MapStrict
import Data.Word
import Control.Monad
import Control.Applicative ( Alternative(..) )
+import Panic (throwGhcException, GhcException(..))
{-
************************************************************************
@@ -314,7 +315,13 @@ plusSimplCount sc1@(SimplCount { ticks = tks1, details = dts1 })
| otherwise = sc2
plusSimplCount (VerySimplCount n) (VerySimplCount m) = VerySimplCount (n+m)
-plusSimplCount _ _ = panic "plusSimplCount"
+plusSimplCount lhs rhs =
+ throwGhcException . PprProgramError "plusSimplCount" $ vcat
+ [ text "lhs"
+ , pprSimplCount lhs
+ , text "rhs"
+ , pprSimplCount rhs
+ ]
-- We use one or the other consistently
pprSimplCount (VerySimplCount n) = text "Total ticks:" <+> int n