summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Opt
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2022-12-19 17:48:38 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-12-22 07:18:28 +0000
commit6810c15e71cc9f3c590f4c37c37e35d1fd8009d1 (patch)
tree1777ebbf2c62a90ea776fc0efe106d83b03734fd /compiler/GHC/Core/Opt
parent3d55d8ab51ece43c51055c43c9e7aba77cce46c0 (diff)
downloadhaskell-wip/T22634.tar.gz
Refactor mkRuntimeErrorwip/T22634
This patch fixes #22634. Because we don't have TYPE/CONSTRAINT polymorphism, we need two error functions rather than one. I took the opportunity to rname runtimeError to impossibleError, to line up with mkImpossibleExpr, and avoid confusion with the genuine runtime-error-constructing functions.
Diffstat (limited to 'compiler/GHC/Core/Opt')
-rw-r--r--compiler/GHC/Core/Opt/ConstantFold.hs2
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Iteration.hs2
-rw-r--r--compiler/GHC/Core/Opt/SpecConstr.hs2
3 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Core/Opt/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs
index 81dd594090..3d36368d5b 100644
--- a/compiler/GHC/Core/Opt/ConstantFold.hs
+++ b/compiler/GHC/Core/Opt/ConstantFold.hs
@@ -1810,7 +1810,7 @@ tagToEnumRule = do
-- See Note [tagToEnum#]
_ -> warnPprTrace True "tagToEnum# on non-enumeration type" (ppr ty) $
- return $ mkRuntimeErrorApp rUNTIME_ERROR_ID ty "tagToEnum# on non-enumeration type"
+ return $ mkImpossibleExpr ty "tagToEnum# on non-enumeration type"
------------------------------
dataToTagRule :: RuleM CoreExpr
diff --git a/compiler/GHC/Core/Opt/Simplify/Iteration.hs b/compiler/GHC/Core/Opt/Simplify/Iteration.hs
index 1e285dcccd..d8b95e7358 100644
--- a/compiler/GHC/Core/Opt/Simplify/Iteration.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Iteration.hs
@@ -3528,7 +3528,7 @@ missingAlt env case_bndr _ cont
-- See Note [Avoiding space leaks in OutType]
let cont_ty = contResultType cont
in seqType cont_ty `seq`
- return (emptyFloats env, mkImpossibleExpr cont_ty)
+ return (emptyFloats env, mkImpossibleExpr cont_ty "Simplify.Iteration.missingAlt")
{-
************************************************************************
diff --git a/compiler/GHC/Core/Opt/SpecConstr.hs b/compiler/GHC/Core/Opt/SpecConstr.hs
index fed1f32879..157cec6e49 100644
--- a/compiler/GHC/Core/Opt/SpecConstr.hs
+++ b/compiler/GHC/Core/Opt/SpecConstr.hs
@@ -1500,7 +1500,7 @@ scExpr' env (Case scrut b ty alts)
where
sc_con_app con args scrut' -- Known constructor; simplify
= do { let Alt _ bs rhs = findAlt con alts
- `orElse` Alt DEFAULT [] (mkImpossibleExpr ty)
+ `orElse` Alt DEFAULT [] (mkImpossibleExpr ty "SpecConstr")
alt_env' = extendScSubstList env ((b,scrut') : bs `zip` trimConArgs con args)
; scExpr alt_env' rhs }