summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Karachalias <george.karachalias@gmail.com>2015-12-30 16:09:29 +0100
committerBen Gamari <ben@smart-cactus.org>2015-12-30 19:35:20 +0100
commitbb7f2e33197e667eb694bd1243f125c722a0a868 (patch)
tree4e8b0c64052ba3da3117169eef4f3bc485408c8c
parent947c8a530e2f977f56601289e1b11cde42f95322 (diff)
downloadhaskell-bb7f2e33197e667eb694bd1243f125c722a0a868.tar.gz
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. Test Plan: validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1717 GHC Trac Issues: #11245
-rw-r--r--compiler/deSugar/Check.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs
index 78a8eaaa6f..fd0c6e0b59 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 "...")