[GHC] #13990: Core Lint error on empty case
GHC
ghc-devs at haskell.org
Wed Nov 8 11:32:13 UTC 2017
#13990: Core Lint error on empty case
-------------------------------------+-------------------------------------
Reporter: mbieleck | Owner: (none)
Type: bug | Status: patch
Priority: highest | Milestone: 8.2.3
Component: Compiler | Version: 8.2.1-rc3
Resolution: | Keywords: core-lint
| case
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4160
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
> But should we leave the scrut_diverges warning in place?
You are referring to this code in the `Case` equation for `lintCoreExpr`:
{{{
-- See Note [No alternatives lint check]
; when (null alts) $
do { checkL (not (exprIsHNF scrut))
(text "No alternatives for a case scrutinee in head-normal
form:" <+> ppr scrut)
; checkWarnL scrut_diverges
(text "No alternatives for a case scrutinee not known to diverge
for sure:" <+> ppr scrut)
}
}}}
Well, suppose `x :: T Bool`, where `T` is in comment:8. Then if I say
something like
{{{
case x of {}
}}}
then `x` is not sure to diverge but the case branches are legitimately
empty. Maybe you can add an example like this in a `Note` explaining why
there is no null-alts check here?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13990#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list