summaryrefslogtreecommitdiff
path: root/compiler/stranal
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-07-26 12:08:59 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2016-08-25 18:24:43 +0200
commitfaaf31398110610a0f7068ca13d798d1ac21e02e (patch)
tree6221bb93fe8de309b570276cea1f66969e62471e /compiler/stranal
parentec7fcfdda7f4655f4cc4399d1b3f4bc2543809db (diff)
downloadhaskell-faaf31398110610a0f7068ca13d798d1ac21e02e.tar.gz
WwLib: Add strictness signature to "let x = absentError …"
indicating that it is bottom. This should help making the "empty cases" lint error give less false alarms.
Diffstat (limited to 'compiler/stranal')
-rw-r--r--compiler/stranal/WwLib.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs
index 812252cee8..0057f6fb78 100644
--- a/compiler/stranal/WwLib.hs
+++ b/compiler/stranal/WwLib.hs
@@ -709,7 +709,7 @@ every primitive type, so the function is partial.
mk_absent_let :: DynFlags -> Id -> Maybe (CoreExpr -> CoreExpr)
mk_absent_let dflags arg
| not (isUnliftedType arg_ty)
- = Just (Let (NonRec arg abs_rhs))
+ = Just (Let (NonRec lifted_arg abs_rhs))
| Just tc <- tyConAppTyCon_maybe arg_ty
, Just lit <- absentLiteralOf tc
= Just (Let (NonRec arg (Lit lit)))
@@ -719,10 +719,14 @@ mk_absent_let dflags arg
= WARN( True, text "No absent value for" <+> ppr arg_ty )
Nothing
where
- arg_ty = idType arg
- abs_rhs = mkRuntimeErrorApp aBSENT_ERROR_ID arg_ty msg
- msg = showSDoc (gopt_set dflags Opt_SuppressUniques)
- (ppr arg <+> ppr (idType arg))
+ arg_ty = idType arg
+ abs_rhs = mkRuntimeErrorApp aBSENT_ERROR_ID arg_ty msg
+ lifted_arg = arg `setIdStrictness` exnSig
+ -- Note in strictness signature that this is bottoming
+ -- (for the sake of the "empty case scrutinee not known to
+ -- diverge for sure lint" warning)
+ msg = showSDoc (gopt_set dflags Opt_SuppressUniques)
+ (ppr arg <+> ppr (idType arg))
-- We need to suppress uniques here because otherwise they'd
-- end up in the generated code as strings. This is bad for
-- determinism, because with different uniques the strings