[commit: ghc] master: Empty alternative lint check: Explain why there are two checks (9cdd2e6)

git at git.haskell.org git at git.haskell.org
Tue Mar 24 08:38:15 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9cdd2e643cad099864a9c1e8218fb645d5989310/ghc

>---------------------------------------------------------------

commit 9cdd2e643cad099864a9c1e8218fb645d5989310
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Tue Mar 24 09:37:31 2015 +0100

    Empty alternative lint check: Explain why there are two checks
    
    This addresses https://ghc.haskell.org/trac/ghc/ticket/10180#comment:6
    [skip ci]


>---------------------------------------------------------------

9cdd2e643cad099864a9c1e8218fb645d5989310
 compiler/coreSyn/CoreLint.hs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index 81e5618..c0ca270 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -728,6 +728,15 @@ normal form. That is the first check.
 Furthermore, we should be able to see why GHC believes the scrutinee is
 diverging for sure. That is the second check. see #10180.
 
+In principle, the first check is redundant: exprIsBottom == True will always
+imply exprIsHNF == False.
+But the first check is reliable: If exprIsHNF == True, then there definitely is
+a problem (exprIsHNF errs on the right side).
+If the second check triggers then it may be the case that the compiler got
+smarter elsewhere, and the empty case is correct, but that exprIsBottom is
+unable to see it. Therefore, this check is not fully reliable, and we keep
+both around.
+
 ************************************************************************
 *                                                                      *
 \subsection[lintCoreArgs]{lintCoreArgs}



More information about the ghc-commits mailing list