[Git][ghc/ghc][master] Provide details in `plusSimplCount` errors

Marge Bot gitlab at gitlab.haskell.org
Wed May 29 14:43:07 UTC 2019



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
2d2aa203 by Josh Meredith at 2019-05-29T14:43:03Z
Provide details in `plusSimplCount` errors

- - - - -


1 changed file:

- compiler/simplCore/CoreMonad.hs


Changes:

=====================================
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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/2d2aa2031b9abc3bff7b5585ab4201948c8bba7d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/2d2aa2031b9abc3bff7b5585ab4201948c8bba7d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190529/20cd0a47/attachment.html>


More information about the ghc-commits mailing list