[commit: ghc] master: New lint check: exprIsHNF = True and alts = [] is bogus (29f7c10)

git at git.haskell.org git at git.haskell.org
Sun Mar 22 16:22:39 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/29f7c1030260f6efce108f1e8461bb6cd4e6f585/ghc

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

commit 29f7c1030260f6efce108f1e8461bb6cd4e6f585
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sat Mar 21 15:02:07 2015 +0100

    New lint check: exprIsHNF = True and alts = [] is bogus


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

29f7c1030260f6efce108f1e8461bb6cd4e6f585
 compiler/coreSyn/CoreLint.hs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index 5338359..690836a 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -637,6 +637,9 @@ lintCoreExpr e@(Case scrut var alt_ty alts) =
      ; alt_ty   <- lintInTy alt_ty
      ; var_ty   <- lintInTy (idType var)
 
+     ; checkL (not (null alts && exprIsHNF scrut))
+          (ptext (sLit "No alternatives for a case scrutinee in head-normal form:") <+> ppr scrut)
+
      ; case tyConAppTyCon_maybe (idType var) of
          Just tycon
               | debugIsOn &&



More information about the ghc-commits mailing list