[commit: ghc] ghc-8.0: Address #11245: Ensure the non-matched list is always non-empty (95fdf59)
git at git.haskell.org
git at git.haskell.org
Wed Dec 30 21:19:40 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/95fdf59c73e3f0d85f3e5d8540d27583cc310669/ghc
>---------------------------------------------------------------
commit 95fdf59c73e3f0d85f3e5d8540d27583cc310669
Author: George Karachalias <george.karachalias at gmail.com>
Date: Wed Dec 30 16:09:29 2015 +0100
Address #11245: Ensure the non-matched list is always non-empty
When there is an uncovered vector of length 0 (which in turn means that
it represents a guard failure) print "(incomplete guards)" instead of an
empty list of non-covered vectors.
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D1717
GHC Trac Issues: #11245
(cherry picked from commit bb7f2e33197e667eb694bd1243f125c722a0a868)
>---------------------------------------------------------------
95fdf59c73e3f0d85f3e5d8540d27583cc310669
compiler/deSugar/Check.hs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs
index 78a8eaa..fd0c6e0 100644
--- a/compiler/deSugar/Check.hs
+++ b/compiler/deSugar/Check.hs
@@ -1420,9 +1420,11 @@ dsPmWarn dflags ctx@(DsMatchContext kind loc) mPmResult
vcat (map (ppr_eqn f kind) (take maximum_output qs)) $$ dots qs
pprEqnsU qs = pp_context ctx (ptext (sLit "are non-exhaustive")) $ \_ ->
- let us = map ppr_uncovered qs
- in hang (ptext (sLit "Patterns not matched:")) 4
- (vcat (take maximum_output us) $$ dots us)
+ case qs of -- See #11245
+ [([],_)] -> ptext (sLit "Guards do not cover entire pattern space")
+ _missing -> let us = map ppr_uncovered qs
+ in hang (ptext (sLit "Patterns not matched:")) 4
+ (vcat (take maximum_output us) $$ dots us)
dots :: [a] -> SDoc
dots qs | qs `lengthExceeds` maximum_output = ptext (sLit "...")
More information about the ghc-commits
mailing list